Box with different UV per face

Illidanz

06-02-2013 09:16:48

Hello,
I'm trying to create a box with different uv coordinates per face.

I tried using the BoxUVModifier but I don't quite understand how I should set the textures for it to work, for example with the MT_PACKED type.

I guess this stuff is still not finished so this probably isn't possible yet, but maybe I'm missing something and you can point me in the right direction.

Thanks in advance

mikachu

06-02-2013 09:44:06

Hello,
BoxUVModifier has been implemented for MT_FULL and MT_PACKED, it's just that the documentation hasn't been written yet.
MT_FULL mode maps each side of the box to the 0,0->1,1 rectangle.
MT_PACKED assigns different part of the texture to each side of the box, in the following order :
+X +Y +Z
-X -Y -Z
(For example the +Y face is mapped to the (.33,.5)->(.66,1) rectangle)

Illidanz

06-02-2013 10:12:19

Hi mikachu, thanks for the explanation.

I'm using this code right now:
Procedural::TriangleBuffer tb = Procedural::BoxGenerator().setSizeX(100).setSizeY(100).setSizeZ(100).setNumSegX(64).setNumSegY(64).setNumSegZ(64).buildTriangleBuffer();
Procedural::BoxUVModifier().setBoxSize(Ogre::Vector3(100, 100, 100)).setMappingType(Procedural::BoxUVModifier::MT_PACKED).setInputTriangleBuffer(&tb).modify();
tb.transformToMesh("Test");


With this sample texture http://imgur.com/Smc8yoy

And this is what I'm getting: http://i.imgur.com/ZmmxYB2.png

This is the first time I'm trying to use OgreProcedural so maybe I'm doing something wrong, any help is appreciated!

mikachu

08-02-2013 09:16:55

This is the first time I'm trying to use OgreProcedural so maybe I'm doing something wrong, any help is appreciated!
Your code looks ok, there's probably a bug in BoxUVModifier.. I'll have a look at it this weekend.

mikachu

08-02-2013 20:39:36

Fixed it :)

Illidanz

09-02-2013 19:09:34

Thanks a lot mikachu, it works great now :)