Skip to content

Lighting

This merge request adds basic Phong lighting to the 3D render pipeline. Support for diffuse + ambient lighting, as well as specular reflections, has been implemented.

Screenshots

Currently, the only visible use of lighting in the engine is the Material Editor preview, which currently shows a sphere lit by a nearby cyan light. This cyan light is hardcoded into the render pipeline, meaning none of this is currently suitable for actual scenes. Nonetheless, enjoy the big blue ball.

Screenshot of a white sphere lit by a bright blue light in a hellish sky

Notice the sky in the background? That's part of the render pipeline too. Like the cyan light, the red sky is hardcoded into the render pipeline, so I need to work on that some more as well. Nonetheless, you can see the Sun in the Scene View.

The Sun

Other fixes

  • Finally curbstomped the random startup crashes.
  • PNG images no longer import with Y-flipping enabled.
  • Fixed a texture coordinate issue in the UI system when specifically drawing image quads, leading to them being upside down. This bug was why PNG images needed to be imported with Y-flipping enabled.
  • Fixed a crash when attempting to render with a shader that expects surface normals. Crash happens if you try to correctly supply surface normals, because the engine didn't know what they are.
  • The Camera component now lets you query its relative view matrix (i.e., direction it is facing if it is located at the world origin). This is useful for view-space lighting, but I'm sure games can find other uses for it.
  • Added an API for generating spheres, Mesh.Sphere().
  • Shape.Cube() is now Mesh.Cube(), and returns a mesh instead of a shape component.

Merge request reports

Loading