[Shader] Procedural Normal Maps

Hi all

I am not what I would call a proper programmer. I like programming, I use this skill in my day-time job (I’m a physics grad student) but I deal with programming problems that can be solved with logic and math only, (and for that I’m grateful Unity exists) and shader programming requires knowing a lot of stuff. But I have a pretty cool idea for simulating fabric wrinkles and I’d like to know how feasible it is. Judging by the absence of such a system, I assume LOW is the answer, but I’ll describe the idea anyway.

The math isn’t complicated. Just define a standard position for the cloth model as a relaxed state, then in run time calculate a stress tensor for each vertex based on its neighbor vertex. Then something something cough murmurs something inaudible make the normal map with fringes based on that calculation.

Of course, this alone wouldn’t produce great results. Some kind of blending with a proper hand-made map would likely be required. Or some way to use this system as a weight for the normal map or something like that.

Here’s the thing, if the cloth is dynamic it will produce it’s own wrinkles through natural shading and, well, wrinkles.

If the cloth is static, like a shirt on a dude, it will most likely have the normal maps already made, and just have their visibility strengthened when the guy bends and whatnot.

Definitely a cool idea, but when it comes to squeezing as much performance for graphics out of your game, dynamically calculating normals on a cloth in real time may be a bit too much for most games. :slight_smile:

Still, I’m very interested to see how it would look lol.

That would be the scenario I’m thinking. But most games have only one normal map for one standard position. It looks great in that position, but when they move it looks like shit. The idea of making several normal maps for different positions is not new but expensive, time consuming and increases the size because of the larger number of texture maps.

Yeah, I believe that will be the consensus in this thread lol. Cool, but too slow. :slight_smile: