0
\$\begingroup\$

I have recently learned how to texture a cube in DirectX with a single texture but I am now trying to put multiple textures on a cube. If your confused the photo below should clarify.

enter image description here

I am aware of the technique of Cube Mapping, but most tutorials online only use that method in the form of a Skybox which is not what I'm trying to achieve at the moment. If someone can explain how I can have different textures for different cube sides or any shape that would be great.

The MSDN documentation says that I need to use a Texture Cube/Array but it lacks information regarding implementation.

\$\endgroup\$
2
  • \$\begingroup\$ A cubemap is a cubemap, no matter if it's on a box or on the skybox \$\endgroup\$
    – Bálint
    Commented Oct 1, 2016 at 10:50
  • \$\begingroup\$ preferably use a model loader and make model with texutre \$\endgroup\$ Commented Oct 1, 2016 at 13:54

1 Answer 1

3
\$\begingroup\$

It's quite simple. There are 2 approaches:

  1. Split the model. Use one model per texture.
  2. Merge the textures. Make one big texture out of many small textures. Then map the right parts of the texture to the faces of the model.

Since you want it to work on any shape, these are the primary tools you have. Later on there's also the option to write custom shaders, but you don't need that yet.

\$\endgroup\$
9
  • \$\begingroup\$ Option 2 is vastly more preferable. Not only does splitting 1 model into 6 slaughter batching, code simplicity and with it, performance, it's way easier for artists to work on just one file instead of 6. \$\endgroup\$
    – asdfguy
    Commented Oct 1, 2016 at 13:07
  • \$\begingroup\$ @Peter I was thinking the exact same thing except that when I make my cube map how will I get the right UV coordinates for it? With a single texture it is as simple as defining it as 0,1 or 1,1. But with a cube map I need to get it right for each face, does a program like terragen give you the UV coordinates for it on export? \$\endgroup\$ Commented Oct 1, 2016 at 15:06
  • \$\begingroup\$ @ArjanSingh I don't know how terragen works, have never used it, but I'd be surprised if it didn't use the last option I've briefly mentioned, the custom shaders. I guess they might mix some tiled textures with some textures that are procedurally generated inside the shader (i.e. outside the scope of a question and answer format, need to run a couple tutorials to get there). \$\endgroup\$
    – Peter
    Commented Oct 1, 2016 at 18:59
  • \$\begingroup\$ @ArjanSingh UV mapping is a topic on its own, and while there is a whole lot to learn (it's far from trivial), there are also a lot of free resources to teach, and a lot of programs that aid with UV mapping. Personally I'd suggest starting with a Blender tutorial on UV mapping. \$\endgroup\$
    – Peter
    Commented Oct 1, 2016 at 19:02
  • \$\begingroup\$ @asdfguy Always depends on the case. Splitting the eyes off of a humanoid into another model is likely sensible, splitting off the weapon the humanoid is using could be sensible, and splitting off the button on the jacket the humanoid is wearing isn't sensible. Unless you're targeting ancient mobile hardware in which case neither are sensible. \$\endgroup\$
    – Peter
    Commented Oct 1, 2016 at 19:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .