Mapping Multiple Textures to Single Object
Hello all, I have an object from online which has two sets of Vertex, Vertex Normals and Vertex Texture Coordinates in an OBJ File. One for "Body" and one for "Decal". I believe I am supposed to read in what looks like two objects as if it were a normal object and apply each of the textures to each of the sub-objects. Is there a way you can bind them to the pipeline together and apply the texture accordingly or is there a different way to go about it? Here is a little diagram-type thing to help explain what I mean OBJECT.obj TEXTURES - # object Decal <--- decal.dds - v x y z - vn x y z - vt x y - f .... - # object Body (v, vn, vt, f) <--- obj_diffuse_texture.dds - v x y z - vn x y z - vt x y - f .... I hope this makes sense and many thanks in advance. GRMaverick :-)
Sign in to comment
Models are usually separated into sub meshes by material, so that each draw call can provide the material needed for that sub mesh, so you will want to generally render those separately. However, with shader model 5.1, you can dynamically index into a texture array. If you really needed to, you could take advantage of this feature to do what your asking. I don't recommend doing it this way because it will probably perform worse, but you can give each of your vertices an added attribute of the texture index of the texture needed to shade it. Then when you get to the pixel shader, you will use that index to get the correct texture from a texture array. You will have to make sure the texture array is ordered the way your vertex texture index's expect.