Imagination PowerVR SDK Blog

how to apply six textures on a Cube pod having single mesh and 6 sides?


#1

hi guys,



Can anyone please help me that i have made a single cube in maya and export it as a pod … in the coding when i fetch the info regarding pod, i got that there is single mesh and 492 nNumFaces.

i upload one texture and expecting that to visible on all sides, which happens but textures is straight on two sides only, on other sides, somewhere upside down, flipped, there is only one frag n vert shader, if i flip the texcoord by multiplyng them to -1 in vsh, some of them get straight and some other get flipped. now i want to load six texture on six sides. if there were six meshesn then i know how to differtiate the sides but now how can i differentiate the sides of cube having one mesh and load six textures and straight textures, not flipped, please help me asap… i need that thing to be done.


#2

Hello



i am not sure to understand fully the problem but allow me to try to help you.

if you have 6 differents texture to apply ,i usually use a multi sub texture ,use UNWRAP UV with the FLIP V coordinante activated in the exporter.i did complex mapping with it , it s working very well.

sure you can assign texture from scratch as well in this case , the sdk is full of sample.



regards

david


#3

Thanks for reply DAVID, but i didnt get you… I am very new to this thing.

problem is straight, i know how to apply different textures on different meshes by using nNumMesh but i dont know how to apply different textures on one mesh. i can easily apply six textures on six sides with different meshes, but how can i apply six textures on sides with one mesh only.


#4

what i mean is from your design tools you can assign material ID that are link to each of your textures

so you will have 6 material Ids.you need UV as well correctly calculated, so unwrap uv does it for you ,then export the POD with the v flip and your done .

If you do it manually it can be more complicated because you have to calculate the UV yourself and create your VEXTEX BUFFER OBJECT from :



Vertex

Normal

UVs



the OGLES2Shaders.cpp demo show that very well in the ParametricSurface building ( and many other places ).



Kind regards

david


#5

ok Thank you david. i can try this method, but one question, when i get the texture IDs , is it possible to change the textures dynamically afterwards using the same texture IDS. ?


#6

sure it is !!!

have a look to the shader demo or skybox2 for instance, superbe example :slight_smile:



regards

david


#7

thnk you david, it sorts out


#8

Super cool Man !!!