this post was submitted on 05 Jun 2025
1 points (100.0% liked)

No Stupid Questions (Developer Edition)

1047 readers
28 users here now

This is a place where you can ask any programming / topic related to the instance questions you want!

For a more general version of this concept check out [email protected]

Icon base by Lorc under CC BY 3.0 with modifications to add a gradient

founded 2 years ago
MODERATORS
 

This is for models that use vertex colors. I want all faces with the max brightness of the object. So in daytime lighting it should look unshaded, but in a dark environment it should darken (like the thumbnail).

What I've tried:

  • using vertex_lighting* and then setting the normal directly (eg NORMAL = vec3(0.0, 1.0, 0.0);)
    • this works, but only if the lighting is perfectly overhead... a slightly wrong angle or even too far into the middle of an omnilight will create a shadow
  • attempting to save the original color value, change the normal, and then bring it the old brightness back via max() if the new value is dimmer
    • lots of moving parts/assumptions on my part here
  • other math stuff with NORMAL/VERTEX, abs() and normalize() etc
    • on top of the direction failure, there's also failure to keep consistent brightness (with a spinning animation), and darkening across a TextMesh

I also know I could do this with unshaded and just multiply/mix it in the shader, but I don't really like the idea of making a custom lighting/detection system (rather than using actual lights, that is).

I am not totally against diffuse shading, something like a vertex toon shader (2-3 brightness bands) could be interesting aesthetically. If that's even possible, it seems like the vertex light calculation is hardcoded (though it's also possible I just don't understand it).

* this is a relatively re-added feature (4.4)

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here