Speculars with Gouraud on low poly

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
mikeem
Posts: 7
Joined: Wed May 01, 2013 5:37 pm
Location: A country called Germany

Speculars with Gouraud on low poly

Post by mikeem »

Hello everybody,

specular lights don't look good with gouraud shading and low poly models. What do I have to do to get nice looking specular light on my low poly b3d sphere?

bye
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Speculars with Gouraud on low poly

Post by mongoose7 »

Use a pixel shader. The normal will be interpolated and should give you what you want.
mikeem
Posts: 7
Joined: Wed May 01, 2013 5:37 pm
Location: A country called Germany

Re: Speculars with Gouraud on low poly

Post by mikeem »

mongoose7 wrote:Use a pixel shader. The normal will be interpolated and should give you what you want.
Hello, so you say i should create a normal map in blender, save it as JPG and then load it in irrlicht, put it in material slot 2 and set the ~EMT_NORMAL_MAP material flag?
Why cant b3d (as irrlichts most favorit model format), not include a normal map :(
Or is there a alternative method that shortens the process? at the moment it is:
1. Blender: create and export model as FBX
2. Blender: create and export normal map as JPG
3: fragmotion: import FBX, export as B3D
4. irrlicht: load model as mesh
5. irrlicht: load normal map JPG as model-material-set-2
6. irrlicht: set model-material flag to normal map
7. irrlicht: drawAll()

I guess this is the workflow everybody is using?
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Speculars with Gouraud on low poly

Post by mongoose7 »

Presumably you had already done something like this in order to make the statement in the original post. But, regardless, Irrlicht won't give you good specular on low poly models, so you will have to write a pixel shader. Therefore, it doesn't matter about setting the material, you just need to pass your textures to your pixel shader. And because the normal map is only valid in "tangent space", you will need a vertex shader to map the eye and light vectors into that space.
mikeem
Posts: 7
Joined: Wed May 01, 2013 5:37 pm
Location: A country called Germany

Re: Speculars with Gouraud on low poly

Post by mikeem »

but wait, i thought that because irrlicht explicitly supports that material flag, it will create a standard pixelshader itself and use that and therefore make dealing manually with a pixelshader obsolete here (normalmap case). so you still have to manually create the pixelshader and implement the normal mapping? i hoped for a more comfortable solution for this very popular use case :(

uhm, in the desciption of emt_normal_map_solid, i must totally misunderstand what is says:

quote:
EMT_NORMAL_MAP_SOLID = A solid normal map renderer.
First texture is the color map, the second should be the normal map. Note that you should use this material only when drawing geometry consisting of vertices of type S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into this format using IMeshManipulator::createMeshWithTangents() (See SpecialFX2 Tutorial). This shader runs on vertex shader 1.1 and pixel shader 1.1 capable hardware and falls back to a fixed function lighted material if this hardware is not available. Only two lights are supported by this shader, if there are more, the nearest two are chosen.


What does that mean? it talks about it as a "map renderer" and SHADER. yet you say this material flag is not important for my case. am very confused!
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Speculars with Gouraud on low poly

Post by mongoose7 »

There is only one shader in Irrlicht, it is a parallel-mapping shader, coded in assembly. You tell me, but I don't think it supports specularity. But if EMT_NORMAL_MAP_SOLID works for you then good luck with it.
Post Reply