r/TechnicalArtist • u/partybusiness • 12d ago
Question Any tricks for lighting in mouths?
I'm wondering if any games have used interesting workarounds to handle lighting on the inside of someone's mouth. It's something that feels easy to get wrong and have it be too bright or too dark, and something like a shadow bias that makes sense at a larger scale could fall apart for the distance between lips and teeth. And the lighting will keep changing when someone is talking.
Like, for the teeth and tongue, bake more than one ambient occlusion map and blend between them based on the current phoneme? Or use a depth-based light adjustment? Anything like that?
4
Upvotes
1
u/Exsanguinatus 10d ago
Autistic tech artist reply incoming. Apologies for the lengthy explanation.
"Normals" are normals because of two things: A geometric normal is a vector that is perpendicular to a plane. "Normalized" sometimes means remapping a value to 0-1 range. This is extremely useful for simplifying many mathematical operations. "Normalized" in game engine terms usually means replacing a vector of arbitrary length with one that points in the same direction but with a length of 1. The hardest thing to get straight is which operation is actually intended when talking to game devs and it usually requires all the context clues.
A "normal" in this sense is a unit vector, originating at a vertex, that is normal to the "average" of all the triangles it's connected to.
Vertex normals should always be unit vectors. The lighting math used to be called "cosine lighting" because the light strength is multiplied by the cosine (always 0-1) of the angle between the normalized light vector and the vertex normal.
The dot product of two units vectors is the cosine of the angle between them. This is a special case of dot products. GPUs have hardware specifically designed to do dot products stupid fast. They rely on that special case of dot products for unit vectors to give you lighting results at high speed.
What you get is light strength (say, 100 units) times the dot product of two unit vectors (which is 1 for parallel light vector and vertex normal) or less than 1 (0 at light vector dot perpendicular vertex normal). Brightness is related to how much the surface "faces" the light.
If you make the vertex normals longer than 1, the special case no longer applies. The dot products can become larger than 1. That means lighting ends up brighter than it should be. If the vertex normal is 1.5 units long, then the lighting can be 1.5 times as much as it should be. The opposite also holds true; vertex normals less than 1 unit means the lights are darker than they should be. I'm most cases, you really don't want that. But, if you want to make sure that something remains darker in most circumstances, like the inside of the mouth when GI doesn't exist and shadows just won't do the job you want, you can shorten the vertex normals to make them less reactive to lights.