Page 1 of 1

Custom loading scene

Posted: Sat May 23, 2009 12:13 pm
by seventhtear
Hi,

I have a few questions.
I have read tutorial about parallax mapping and I know how to do this but it's only describe problem when loading mesh from .3ds in code. I have made scene in IrrEdit (few models from .3ds). And I'm loading it in my code by LoadScene("file.irr") . But mesh in scene have no information about tangent. So what now? I have an idea to iterate all node in scene, generate new mesh with tangents (like in tutorial), delete in scene the old one and add the new. But this is stupid. Is there a better way to do this?

Second thing is that, that if I place a light near mesh with parallax mapping everything is ok, but if there is no lights the mesh have no texture. I want no lights, and want to display mesh properly with parallax.

And last thing. When I set in IrrEdit parallax (in material) mesh is black. Why? If IrrEdit don't support parallax why not display it simply with first texture? When I place some objects in my scene and set parallax, all is black and I don't recognize them, is there a way to display them correctly?

I use Irrlicht 1.5 and IrrEdit 1.5

Posted: Sat May 23, 2009 1:40 pm
by marrabld
per pixel lighting example -->

Code: Select all

scene::IMesh* tangentMesh = smgr->getMeshManipulator()->createMeshWithTangents(

			roomMesh->getMesh(0));
I used this with a .3ds file I made in Blender and it worked fine.

not sure about your second question, i always have lighting in my scenes. Isn't that the point?

Posted: Sat May 23, 2009 2:06 pm
by seventhtear
Well that's not an answer I want.
I use LoadScene to load .irr file. After that ,all models are loaded to scene manager. So to correct parallax I must get each node, unload, create with tangents, and load again. And that is very stupid.

I don't want lights. If I load simple solid mesh everything is ok, I see it. But when I load mesh with parallax i can't see unless I place any light.

Posted: Sat May 23, 2009 2:14 pm
by marrabld
*laughs* well that's the thing about asking for help isn't it. You may not get the answers you want.

I am sorry I misunderstood you question. Good luck

Posted: Sat May 23, 2009 3:58 pm
by seventhtear
Ok, here is more information to my second question.

I have one mesh with parallax mapping in my scene and one light.
It doesn't matter if I set node->setMaterialFlag(video::EMF_LIGHTING, false) or node->setMaterialFlag(video::EMF_LIGHTING, true) it always display mesh correctly. But if I do not add light to my scene, mesh is not displayed. And it doesn't matter too what I set in material flag.
How can it be?

My first and third problems are still open

Posted: Sat May 23, 2009 6:08 pm
by hybrid
You want per-pixel light without lights? Just learn what this technique means. You can use .irrmesh format to support tangent information in the mesh, otherwise you have to set the node's name to some special value, search for that node and convert the mesh manually. 3ds files also support parallax mapping automatically, just set the materials properly.

Posted: Sat May 23, 2009 6:21 pm
by seventhtear
Thanks, that's all I need. Now I understand everything :D