Game Development Community

Texture with UV coords (NOT verticies with UV coords)

by Ves · in Torque Game Engine Advanced · 09/20/2007 (8:28 pm) · 4 replies

I have a quirky idea for a system to runtime generate a huge amount of clothing/armor options via a shader. But it involves a concept that I am sure someone has already come up with and apatly named but I just don't know what it's called.

Here is what I want to do:

Use Maya or blender and generate a very hires model of cloth (think of a peice of cloth with 512x512 verticies). Wrap the cloth on a human model of and run one of the many cloth simulations. This should create relistic folds, etc. I then want to map it to a flat texture (one that just has a pattern but no folds or light built into it) to produce UV coords for each verticie. The idea here being that each pixel of 512x512 texture is represented by a verticie in the real model. And what I want to generate is ultimatly a texture that has 16 bit UV coords (based on the verticies UV coords) instead of color values.

This texture (that holds my UV coords) would then act as a sort of parrallex texture offsetting a real texture in a pixel shader? I could have a huge library of flat cloth texture patterns that produce real texture maps procedurely in the shader.

This is a bit of reverse of the way its done now as a vertex of a model would store a UV coord to a texture that held a UV coord to the real pixel color value (so two UV mapping ops in the shader but thats cheap op so its not a big deal). I know someone must have come up with this solution before and I would love to do some research I just don't know what this technique would be called.

Any one well versed enough in 3D modeling to know what it might called?

I tried to be as clear as I could but if it's still difficult to understand I could probably draw a few pictures.

Ves

#1
09/20/2007 (8:53 pm)
Wikipedia to the rescue... I think what I want to do is called displacement mapping....

Ves
#2
09/21/2007 (11:18 am)
So you're going to use up 80,000+ triangles just for a sheet of cloth?
#3
09/21/2007 (8:05 pm)
As cards get faster, displacement mapping is going to be a nice technology. Especially for online games where the graphics tend to get old in the older games, but displacement mapping can upgrade those older graphics and still run great using the same models. The performance on it though is pretty prohibitive today unless you have a Quad-SLI system. If your designing a game for three years down the road though, then it starts becoming more viable.
#4
09/21/2007 (9:13 pm)
No, I was thinking just the oppisite. Do a texture render with 80,000 tri's to simulate real cloth movement in maya. Storing not actual texture data but displacement data. Then torque uses a pixel shader to render that data in real time overtop of flat peice of cloth. It a similar illusion to bump/parralax/relief mapping. The individual texels are displaced based on a map that was created with a real very hi tri model. The idea is that I create a few of these displacement maps to simulate what high tri cloth looks like when worn, I then runtime combine this with any number of flat cloth textures. The theoretical result is that I can get a huge amount of clothing options with just a few textures that are combined at runtime.

Think of rendering every type of clothing in a white a texture and creating a sort of lightmap. Then runtime mapping a real colored texture on top of that to create a normal shirt, cape or vest. Now if the colored texture had say a logo on it that wouldn't look so good because the logo would simply map across the folds. But if we could generate and store "displacement" data then the logo bend and stretch with the folds of the cloth and map correctly. Now even this trick is broken technically since the displacement map would only be perfectly accurate from one angle (usually looking straight on) but when we create clothing texture maps today this is exactly what we do.

It's just a theory and I verfying its viablity in composer but I am pretty sure I can get it to work. I am positive its been done before (or there is a real good reason why it won't work) but I can't find a resource that does it exactly like I am suggesting. My goal is not so much looks but to create a nearly infinite number of clothing options from just a few base textures that are pixel shader combined. And most importantly adding a new peice of clothing would be as simple as finding a cloth texture and adding it in. No photoshop mucking, no UV coord mapping/wrapping, Nothing. Just link the texture to a pixel shader input and bam new clothing option. It's really an art pipeline tool but it could end up looking really good if I approach it correctly.

Ves