https://github.com/maluoi/sklightbake
Scene management and light baking in StereoKit
https://github.com/maluoi/sklightbake
Last synced: 3 months ago
JSON representation
Scene management and light baking in StereoKit
- Host: GitHub
- URL: https://github.com/maluoi/sklightbake
- Owner: maluoi
- License: mit
- Created: 2022-10-02T00:16:29.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-21T22:28:50.000Z (over 1 year ago)
- Last Synced: 2025-04-02T19:42:55.874Z (about 1 year ago)
- Language: C#
- Size: 328 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Light Baking and Scene Management Demo
This is a quick demo for performantly managing static scenes, and baking lighting into them with StereoKit! This bakes lighting into the vertex colors of the mesh, so is visually limited by the number of vertices the mesh has, and will merge meshes together.

## [StaticScene.cs](StaticScene.cs)
This is a small class that will store `Model`s and `Mesh`es in a list, and draw them with the least amount of overhead. It also provides tools for raycasting on the scene, and managing 'draw only' and 'raycast only' elements.
This does not work with animated `Model`s.
## [BakedScene.cs](BakedScene.cs)
This class will take a `StaticScene`, as well as lighting information for the scene, grab the mesh data, bake vertex colors and combine the meshes together.
Baking involves casting rays throughout the environment for a single bounce of lighting. 0 samples will provide hard shadows and direct lighting, while more samples will improve the quality of lighting at the cost of quite a bit more time.
See the code for details on how to use it.
## License
This code is MIT licensed, feel free to use it in your own projects!