Normal map questions

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
Mercyful
Posts: 8
Joined: Tue May 29, 2007 5:01 pm

Normal map questions

Post by Mercyful »

Hi, I have a few question ralated to normal map, I hope you can help me

1- This works as normal map

Image


2- If I use some program to make it black and white, still works?

3- I want use normal map in the model of a house, but I don't know how, I wanna make the textures in Blender, should I set the normal map texture in blender itself and then use the code in Irrlicht? in the example 11 the model only use 1 set of textures in the whole model but a house need a lot of textures, Should I make the rooms of the house manually?, I mean make first the floor, then the walls, etc. diferent models in diferent nodes

Well, thanks for you time, thanks
LLDD
Posts: 43
Joined: Fri May 11, 2007 9:50 am

Post by LLDD »

Well if you want to have different textures with custom materials (irrlitch's parallax, a shader etc) you should do something like this:

Code: Select all


stringc Diffuse, Normal;		// Diffuse being the name of the texture in the model. Normal is the name of the texture to use as a normal map

for(int i=0;i<LevelNode->getMaterialCount();++i){
	// Getting the material
	SMaterial &material=LevelNode->getMaterial(i);
	// Checking if first texture exists
	if(material.Texture1){
		// If found changing material type
		if(strstr(material.Texture1->getName().c_str(), Diffuse.c_str())){
			normalMap = driver->getTexture(Normal.c_str());
			material.Texture2=normalMap;
			material.MaterialType=(E_MATERIAL_TYPE)NMS->NormalMapShader;
		}
	}
}
That looks for all the materials in the model until it finds a material using the texture you specified on Diffuse. Once found you just change the material type to what you desire ( in this case a normal map shader).
________
Toyota A Transmission History
Last edited by LLDD on Sun Feb 20, 2011 7:49 am, edited 1 time in total.
Mercyful
Posts: 8
Joined: Tue May 29, 2007 5:01 pm

Post by Mercyful »

Thanks for the reply, I will try that.
Post Reply