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.
askona
Posts: 14 Joined: Wed Jun 01, 2011 3:45 pm
Location: Ukraine
Post
by askona » Thu Jun 02, 2011 12:20 pm
I have few textures in one .psd file. How can i use textures for road (for example),and not to receive picture like this:
I loading textures for road from file:
Code: Select all
irr::video::SMaterial* roadMaterial = new SMaterial();
roadMaterial->setTexture(0,driver->getTexture("models/road.psd"));
Klunk
Posts: 264 Joined: Mon Jan 10, 2011 5:21 pm
Post
by Klunk » Thu Jun 02, 2011 12:22 pm
you need to set the uv coordinates of the model to the correct values, either in code of in the modeller/level editor.
askona
Posts: 14 Joined: Wed Jun 01, 2011 3:45 pm
Location: Ukraine
Post
by askona » Thu Jun 02, 2011 12:36 pm
How can i do that? I`m beginer in graphics and irrlicht, so don`t completely understand how to work with textures
Code: Select all
irr::video::SMaterial* roadMaterial = new SMaterial();
roadMaterial->setTexture(0,driver->getTexture("models/road.psd"));
roadMaterial->Lighting = false;
IMesh* fterr;
IMeshSceneNode* planeNode;
fterr = smgr->addHillPlaneMesh("",dimension2d<f32>(100,100),dimension2d<u32>(25,25),roadMaterial,1,dimension2d<f32>(200,200),dimension2d<f32>(3,3));
planeNode = smgr->addMeshSceneNode(fterr);
Radikalizm
Posts: 1215 Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium
Post
by Radikalizm » Thu Jun 02, 2011 12:36 pm
Be aware that a texture atlas like this can cause mipmapping artifacts for smaller mipmaps
Klunk
Posts: 264 Joined: Mon Jan 10, 2011 5:21 pm
Post
by Klunk » Thu Jun 02, 2011 12:46 pm
something like ?
Code: Select all
planeNode->getMesh()->getMeshBuffer(mat)->getTCoords(i)
where mat is either a smaterial or its index and i is the vertex index. The trouble with handling uv in code is you need to know which vert is which. Its much easier to do this kind of thing in a modeling package/level editor as you get visual feed back to what you are doing.
otherwise just use non-atlas textures
askona
Posts: 14 Joined: Wed Jun 01, 2011 3:45 pm
Location: Ukraine
Post
by askona » Fri Jun 03, 2011 5:14 pm
I found that my .psd file contents 16 equal parts
maybe i can use it? i did`n understood what can i do with coords of my texture...even if i get few vector2df , what should i do with it?