75 instructions - Vertex shader cost of 3D cloth displacement
I have spent years trying to get APEX cloth to work on characters without needing NVIDIA's APEX integration with Maya or 3DS Max, but I cannot figure out how to authorize it, nor have I seen anyone else do it. In my open world project, Jake, the main character was always butt-naked. He was intended to have a red flowing cape. My folk's chargin with having a naked character and insistence that he wear something made me decide to try a different tactic: cloth displacement and normal calculation from textures. And surprisingly, the results from this method look even better than low-density APEX simulations.
The overall gist of this method is to offset sine and cosine waves flowing down the cloth by textures to flow in a unique pattern, transform from local space to world space and combine them to form the resulting vertex displacement, and using the sine data to drive a normal calculation. To the best of my knowledge, nobody has come up with a displacement/normal driven technique like this before. I'm calling this method "Rolling Cloth" due to the way the sine waves roll with the curvature of bends in the cloth rather than across them.
The benefits of this method are:
- Extraordinarily cheap and detailed cloth displacement (great for console, mobile, and PC, assuming the API can handle texture displacement)
- Rolling normals calculation looks great on low-poly cloth, even with no displacement at all
- Highly scaleable to intended hardware
- Normal calculation is fairly accurate
- Artistically driven by textures for great flexibility in final results
- Looks great with smaller textures (64-128 pixels)
- Easily supports tiling cloth texture normals
- Requires API to be capable of running textures to vertex displacement
- Wind is manually driven by attributes in local space, not automatic in world space
- Oddly enough, this is why the shader does not support triangle explosion through tessellation, because transforming from local to world space is incompatible with tessellation
- The cloth is NOT simulated, so it will pass through world objects and characters
- Movement rolls with bends in the fabric instead of across them
No comments:
Post a Comment