PARALLAX_MAP getting darker with each instance [solved]

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
Holiday
Posts: 42
Joined: Thu Apr 19, 2007 2:47 pm

PARALLAX_MAP getting darker with each instance [solved]

Post by Holiday »

Hello, i am creating nodes from tangent meshes with parallax mapping as showed in the tutorial, but with each node created, all the nodes get darker. What could be the problem?
Thank you :)
Last edited by Holiday on Thu Aug 20, 2009 10:12 pm, edited 1 time in total.
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

are they getting further and further away from the light by any chance?? :D

Alos, more information + code if possible, screenshots etc. We cant help with no info :)
Holiday
Posts: 42
Joined: Thu Apr 19, 2007 2:47 pm

Post by Holiday »

screens:
Image

code:

Code: Select all

smgr->getMeshManipulator()->makePlanarTextureMapping(newMesh->getMesh(0), 0.003f);
        scene::IMesh* tangentMesh = smgr->getMeshManipulator()->createMeshWithTangents(newMesh->getMesh(0));
		node = smgr->addMeshSceneNode(tangentMesh);
		video::ITexture* normalMap = driver->getTexture("test.jpg");
		driver->makeNormalMapTexture(normalMap, 11.0f);
		node->setMaterialTexture(1, normalMap);
		node->setMaterialFlag(video::EMF_FOG_ENABLE, true);
		node->setMaterialType(video::EMT_PARALLAX_MAP_SOLID);
		// adjust height for parallax effect
		node->getMaterial(0).MaterialTypeParam = 1.3f;

		tangentMesh->drop(); 
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

node->setMaterialFlag(video::EMF_FOG_ENABLE, true);
Not sure if this is causing it, but it seems like theres no point to putting fog yet. Try not executing that line ?
Holiday
Posts: 42
Joined: Thu Apr 19, 2007 2:47 pm

Post by Holiday »

deleted that line with no result..
DeM0nFiRe
Posts: 117
Joined: Thu Oct 16, 2008 11:59 pm

Post by DeM0nFiRe »

Well, what a parallax map does is selectively darken the mesh to give the illusion of depth. Are your nodes all created with the same mesh? Could it be possible that you are adding multiple parallax maps to the same mesh, therefore darkening it more and more?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

As DeM0nFiRe said-

Code: Select all

driver->makeNormalMapTexture(normalMap, 11.0f); 
Do you call this multiple times?
In this case you're making a normal map from a height map (copying height from brightness into the channel alpha, putting normals into colour channels), then doing the same again on the normal map. After calling it the first time the texture is no longer a height map, so subsequent calls will cause problems.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Holiday
Posts: 42
Joined: Thu Apr 19, 2007 2:47 pm

Post by Holiday »

yes, that was the cause.
Now i call it only once and the problem is solved!

Thank you very much
Post Reply