[fixed]irr 1.6. makeNormalMapTexture break texture

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
IrrDelphi
Posts: 32
Joined: Tue Oct 13, 2009 10:59 am

[fixed]irr 1.6. makeNormalMapTexture break texture

Post by IrrDelphi »

Hi all..

I have obj wth mtl file:

listing mtl:

Code: Select all

...
newmtl material1
Ka  0.6 0.6 0.6
Kd  0.6 0.6 0.6
Ks  0.9 0.9 0.9
d  1.0
Ns  0.0
illum 2
map_Kd br.tga
bump br_bump.tga
#
newmtl material2
Ka  0.6 0.6 0.6
Kd  0.6 0.6 0.6
Ks  0.9 0.9 0.9
d  1.0
Ns  0.0
illum 2
map_Kd br.tga
bump br_bump.tga
...
In COBJMeshFileLoader::readTextures we have code:

Code: Select all

...
SceneManager->getVideoDriver()->makeNormalMapTexture(texture, bumpiness);
...


Engine read first material "material1", and do makeNormalMapTexture for "br_bump.tga"... and read second material "material2" AND do makeNormalMapTexture for "br_bump.tga" AGAIN - it's break texture..

Fix (dirty, but worked):

ITexture.h

Code: Select all

...
	//! constructor
	ITexture(const io::path& name) : Name(name)
	{
		Name.make_lower();
		bumped=false; //fix
	}
...
protected:

	io::path Name;

public:
	bool bumped; //fix
};
....
CNullDriver.cpp

Code: Select all

...
void CNullDriver::makeNormalMapTexture(video::ITexture* texture, f32 amplitude) const
{
if (texture->bumped)
	return;
....
	texture->regenerateMipMapLevels();
texture->bumped = true;
}
....
Sorry for my bad english, it is not my primary language. I hope you understand me)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

We'll better put a fix to the mtl loader and add a check for the texture in the texture cache first...
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, I've added a fix to the mtl loader. Hope it works for all examples, I see a problem if a normal map is used as a usual texture as well. Don't know if this would happen, though.
Post Reply