Specular Mapping in Irrlicht?

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
insidious611
Posts: 5
Joined: Wed Oct 24, 2012 6:23 am

Specular Mapping in Irrlicht?

Post by insidious611 »

I'm admittedly not the most familiar with 3D art or 3D programming in general. The artist/designer for the project I'm working on however chose me as a programmer because I'm fairly competent with my programming and am a good problem solver. When we got to her submitting assets though she was mildly peeved at one point when she submitted a model and 4 textures, a diffuse texture, a normal map, a specular map, and an illumination map, and I told her that as far as I could tell the Irrlicht engine could only natively support the first two. She said something about the models "Looking like plastic" without a specular map. Personally I think they look fine, but thats besides the point.

I looked up Specular Mapping in Irrlicht and was only able to find a few fairly old threads stating that if you wanted to do this you needed to write your own shader.

Thats where it gets more than a bit intimidating for me: I barely understand what a vertex is, I definitely don't understand what a tangent or a binormal is, I certainly have no idea what a TBNMatrix is, and from the very few shaders I've looked at all of it far above my head in terms of the low levels of 3D design.

So... is there a simple way to do this? And if not, can someone provide me with a prebuilt shader and material that will take a specular map out of say, texture index 2 of said material, while supporting a non-animating mesh and a normal map?

I realize thats a lot to ask but I'm trying very hard to learn everything required in order to build my own shader for this and hitting a real barrier of "Dear god, I have to learn ALL THIS?" :P

The illumination map texture I think I'm just going to hack together programmatically by finding where it maps onto the model and adding low intensity point lights of the requisite size and color.

On a related note: It seems like normal mapped models don't react properly to directional light. Is that true or am I doing something wrong with my directional light? I put a point light above the model just to verify the normal map is working because without it the model was very dark (though not completely black). Without the normal map the model seems to illuminate properly with directional light.

Its an outdoor scene in the sun with no other light sources at the moment so I'd like to avoid point lighting if I can.

Even if y'all can't help with this issue, I'd like to thank you for being very helpful so far. This forum has helped me find a physics library, interpret a few tutorials that had me scratching my head, and generally been very open and supportive of someone who is a bit out of his depth.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Specular Mapping in Irrlicht?

Post by Mel »

Firstly, good news, Irrlicht doesn't support 2 but 4 texture maps by default, and up to 8 if you recompile the engine, and up to 2 texture coordinates sets. For the specular map, either hack the current materials, or write your own shader, being the later more recomendable.

Second, the example 10 shows a good, somewhat simplistic, way to create useful shaders, study it, it is mildly complex but the time spent to understand it is worth. Shaders are a great and wide field of experimentation and investigation. Not obstant it documents how to USE shaders, not how to WRITE them.

third, You will need a shader, so i suggest you to download some shader authoring tools, like rendermonkey or FXcomposer, both are free, and have prebuilt shader examples including normal mapped and specular mapped ones.

forth. Have FUN
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Re: Specular Mapping in Irrlicht?

Post by Abraxas) »

Check out my shaders in irrlicht tutorial in the code snippets section.

Specular mapping is just one step away from what I was doing.
Post Reply