Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Improve Blender Lighting Hack #194

Open
sunjay opened this issue Feb 21, 2020 · 0 comments
Open

Improve Blender Lighting Hack #194

sunjay opened this issue Feb 21, 2020 · 0 comments
Labels
Area: Renderer Issues related to rendering/shaders bug Something isn't working

Comments

@sunjay
Copy link
Contributor

sunjay commented Feb 21, 2020

It's currently really hard to match the colors produced by a Blender-exported 3D model. It's possible that this isn't Blender-specific, but that's the main 3D program we're targeting right now.

Notice how different the colors in these two images are:

isodog isodog pixel art

The left is a render produced by Blender and the right is an image produced by spritec (without the intensity hack in #193). The colors having different brightnesses indicates a lighting issue to me. While the colors are certainly affected by our use of toon shading, I think a larger issue at play is the lighting hack we had to implement because of a bug in Blender's glTF exporter:

// HACK: The glTF exporter for Blender has a bug where it exports the light intensity in
// the wrong units. This works around that issue.
// See: https://github.com/KhronosGroup/glTF-Blender-IO/issues/564
let intensity = light.intensity() / 1000.0;

I chose to divide by 1000.0 because Blender lights start at 1000 W and this makes the default light have an intensity of 1.0. In practice however, this is not a good approximation. We should play around with the way we normalize the Blender light values. Since Watt is a unit of power, maybe the relationship is actually exponential? (i.e. maybe we should take the log?)

Another possible solution: Maybe we should just give in and implement glTF's physically-based lighting model?

@sunjay sunjay added Area: Renderer Issues related to rendering/shaders bug Something isn't working labels Feb 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: Renderer Issues related to rendering/shaders bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant