https://github.com/bchao1/go-render

🎦 3D renderer in Go.

https://github.com/bchao1/go-render

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • â—‹
    CITATION.cff file
  • ✓
    codemeta.json file
    Found codemeta.json file
  • â—‹
    .zenodo.json file
  • â—‹
    DOI references
  • â—‹
    Academic publication links
  • â—‹
    Academic email domains
  • â—‹
    Institutional organization owner
  • â—‹
    JOSS paper metadata
  • â—‹
    Scientific vocabulary similarity
    Low similarity (9.4%) to scientific vocabulary

Keywords

3d 3d-graphics camera computer-graphics geometry go golang light rasterization rendering texture
Last synced: 5 months ago · JSON representation

Repository

🎦 3D renderer in Go.

Basic Info
  • Host: GitHub
  • Owner: bchao1
  • Language: Go
  • Default Branch: master
  • Homepage:
  • Size: 66.8 MB
Statistics
  • Stars: 19
  • Watchers: 2
  • Forks: 1
  • Open Issues: 1
  • Releases: 0
Topics
3d 3d-graphics camera computer-graphics geometry go golang light rasterization rendering texture
Created over 5 years ago · Last pushed over 5 years ago
Metadata Files
Readme

readme.md

go-render

A simple renderer (rasterization-based) written in Go.

The OG tinyrenderer project helped me alot. It's amazing stuff, and I highly recommend everyone check it out.

Usage

The code is pretty self-contained. I only used a 3rd-party library imaging to flip images vertically.

To do your custom render: go run render.go <path to .obj file> <path to texture file> For example, see run.sh: go run data/obj/bunny_2.obj data/textures/bunny_texture.jpg

Of course, you can first build render.go, and then run the executable: go build render.go ./render <path to .obj file> <path to texture file>

Customization

You could also play with some other parameters (light direction, camera position, spectral lighting, and etc) in render.go. - eye: The camera position. Default is (0, 0, 1). - center: Position the camera is looking at Default is (0, 0, 0). - up: The vertical axis of the camera. Default is (0, 1, 0), which is the y-axis. - lightDir: Light ray direction. Default is (0, 0, -1), which means the light is parellel to user's eye. - specCoeff: Weight of spectral lighting. (For the shiny dragon above, I used 20.0) - imageHeight: Pixel height of output image. - background: Whether to color output image background black. If not, then output image has transparent background. - outFile: Render output file path. - defaultFill: If no texture is specified, use this color.

Demo

Basics

||| |--|--| |Wireframe|Triangle rasterization| |img|img|

Shading

|Flat shading|Gouraud shading|Phong shading| |--|--|--| |img|img|img| |img|img|img|

Perspective

||||| |--|--|--|--| |img|img|img|img|

Textures

Kudos to the author of this article for providing custom Stanford bunny texture files.

|Colored|Terracotta| |--|--| |img|img|

Camera

||||| |--|--|--|--| |img|img|img|img| |img|img|img|img|

Light

||||| |--|--|--|--| |img|img|img|img| img|img|img|img|

Specular lighting

The stronger specular lighting is, the more "glossy" the object surface becomes. I simply used uniform power for each pixel since specular intensity is not specified in my texture files. |No specular|Some specular (used)|Intense specular| |--|--|--| |img|img|img|

.obj sources

  • https://www.prinmath.com/csci5229/OBJ/index.html
  • https://people.sc.fsu.edu/~jburkardt/data/obj/obj.html
  • https://groups.csail.mit.edu/graphics/classes/6.837/F03/models/
  • https://casual-effects.com/data/
  • https://github.com/alecjacobson/common-3d-test-models

Owner

  • Name: Brian Chao
  • Login: bchao1
  • Kind: user
  • Location: Stanford, California
  • Company: Stanford University

Stanford Ph.D. student. Research in computational photography, displays, and computer graphics. Open source enthusiast.

GitHub Events

Total
Last Year

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • exprez135 (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
proxy.golang.org: github.com/bchao1/go-render
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Stargazers count: 4.8%
Dependent packages count: 7.0%
Forks count: 7.0%
Average: 7.0%
Dependent repos count: 9.3%
Last synced: 8 months ago