3ds texturing problem

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

3ds texturing problem

Post by afecelis »

I got a simple box textured and uvmapped in 3dsmax; I'm using it to test the new per pixel stuff and to make it simple I'm loading only 1 texture; this is what it looks like in 3dsmax:
http://www.danielpatton.com/afecelis/sc ... ds_max.jpg
check how the horizontal textures match on walls.

I then load my model into Irrlicht's mesh viewer and my uvmapping loads ok:
http://www.danielpatton.com/afecelis/sc ... _mview.jpg

but then when I load it into Irrlicht this is what I'm getting in DX:
http://www.danielpatton.com/afecelis/sc ... 3ds_dx.jpg
check that the middle wall now matches the ceiling.

and to top things of, in opengl fog doesn't work:
http://www.danielpatton.com/afecelis/sc ... 3ds_gl.jpg

are there any specific texturing values to set for the texturing?
I changed the default:

Code: Select all

smgr->getMeshManipulator()->makePlanarTextureMapping(roomMesh->getMesh(0), 0.003f);
for a value of 0.008f which makes the textures show up better, but are there any other values to tweak to get a 1:1 correspondence with your uvmapping in max?

thnx guys!

:D
Guest

Post by Guest »

try rotating the world...
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

Thnx for replying guest; rotated the world and the result is still the same.

:shock:
Guest

Post by Guest »

comparing 3ds_max to 3ds_gl it appears that the box is rotated 90 degrees
on the z axis. Rotate the box by 90 degrees and it should look the same,
from what i can see in the image post. However the bottom of the box
in gl is so dark cannot see it very well to tell. :)
Guest

Post by Guest »

(different guest here)

The previous poster is correct:
what Irrlicht probably does is load vertices from the 3DS's coordinate system into Irr's coordinate system without translation.
Since 3DS presumably has the z-axis pointing up instead of into or out of the screen, that results in rotation and possibly mirroring. (Something you can also see when you load MS3D meshes).

In order to fix it, you do need to rotate it, like the previous poster stated, but when you do, you must also not use the planar texture mapping. That just replaces the original UV coordinates with a formula based on the vertex coordinates.
Soulil
Posts: 6
Joined: Tue Mar 08, 2005 7:52 pm

Post by Soulil »

Yes like Guest suggested,

have you tried to load your model without using "MakePlanarTextureMapping"

when i load a 3ds textured model into irllicht i don't use any command to apply my texture. It seems like 3ds (keeps the uv coords) and apply textures automaticaly that's why when u load into Irrlicht and retexture you end up with something different from what you got in Max or in the mesh viewer :)




ben.kicks-ass.net
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

Thnx for all those replies and valuable ideas guys!

Gonn atry them right away.

About using "MakePlanarTextureMapping", I used it caused according to Niko on the per pixel example:
I am no good modeler at all and so I totally messed up the texture
mapping in this model, but we can simply repair it with the
IMeshManipulator::makePlanarTextureMapping() method.
Thinking it would help textures to be displayed properly.

But I definitely gotta try without using it.

thnx! :D
cartoonit
Posts: 286
Joined: Mon Nov 15, 2004 6:36 pm

Post by cartoonit »

This is slightly off the topic of this, but I get similar things when using the quake 3 BSP with fog, lighting, etc... In OpenGL everything seems fine, but DirectX 9 just hates it, and the level just goes immensely dark, as I've said before I'm gonna start playing with the values a bit more and see if I can fix it... :D
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

yay! commenting out:

Code: Select all

smgr->getMeshManipulator()->makePlanarTextureMapping(wallMesh->getMesh(0), 0.008f)
did it!

It seems you don't need it if your 3ds is properly uvmapped. As Niko said, he used it to fix messed up textures, but in this case my textures were ok :D

thnx for the help guys!
back to experimenting.

ps. Final word, I rotated the world 360 degrees on 90 degrees intervals and the texturing was wrong all the time. Only what I mention above fixed it.
Post Reply