0 registered members (),
1,089
guests, and 10
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Normal-Mapping Shader (The Best @ vsps2.0)
[Re: foodstamp]
#120754
04/06/07 17:09
04/06/07 17:09
|
Joined: Dec 2005
Posts: 414 Munich, Germany
Robotronic
Senior Member
|
Senior Member
Joined: Dec 2005
Posts: 414
Munich, Germany
|
Quote:
I still noticed that it dont apply the effects of being raised.
Well, I did some tests now, and I can confirm this, even when I create the normal map (or should I call it a DOT3 bump map) based on a greyscale texture, that has a lot of contrast (I use a little ATI tool for this). The 3D effect is only visible in areas with high specularity. Maybe for this shader the normal maps are better created with a different tool or procedure (maybe with 3D models)? I will try that. Or is there a line in the .fx file, that controls the strength of the 3D effect?
There are some other things, that I noticed ...
1) For outdoor stuff it would be great if the shader could react to changes of sun_color. At the moment I would have to adjust the material, but this works fine (like with predefined materials btw., so it is consistent).
2) Objects with the NM material seem to be immune for shadows. I just tested with stencil shadows. Shadows are not rendered on the surface of the normalmapped models and the models also do not cast shadows.
3) The shading on the faces - when they receive sun_light is not really realistic. There is a visible fall-off (on large faces). The sun_light however should not produce such a fall-off even if it looks nice sometimes
All my tests were done in a model-based level without blocks and lightmapping.
Anyway itīs a really nice and very useful shader!
|
|
|
Re: Normal-Mapping Shader (The Best @ vsps2.0)
[Re: Robotronic]
#120755
04/06/07 20:16
04/06/07 20:16
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
OP
Expert
|
OP
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
1) sun_color isn't passed to the shader, but you can easily amke it so that the material values are set to the sun_color every frame. Just open the NM.wdl, go to the mat_NM_event() and add vec_set(mtl.specular_blue, sun_color);
2) Stencil shaddows worked just fine for me...
3) I thought I left out the attenuation on sunlight. I'll do some testing. Also, the large faces your using for testing, are the just faces, or actaully shapes. The vertice normal are interpolated, so the edges might think their facing away from the sun...
4) Static lighting only works when their are blocks to read the lightmaps from. Only stencil shadows will work. The shadows are not controlled by the shader at all. stencil shadows also pass through objects, so use them carefully...
xXxGuitar511 - Programmer
|
|
|
Re: Normal-Mapping Shader (The Best @ vsps2.0)
[Re: xXxGuitar511]
#120756
04/06/07 22:40
04/06/07 22:40
|
Joined: May 2005
Posts: 2,713 Lübeck
Slin
Expert
|
Expert
Joined: May 2005
Posts: 2,713
Lübeck
|
Thank you for this very nice contribution! After playing around with this shader, I noticed that the c_trace slows the entity rendering speed down a lot. I havenīt a clue about shaders, but I remembered a ffp-bumpmapping effekt, wich was everytime as bright as the ground below it, or at least it seemed so. I took a closer look at it and found vecLight. I replaced your mtlSkill1 with vecLight and this looks all right in my testlevel (ok itīs a bit brighter then using the trace). So my question is, whatīs wrong with vecLight? Another thing wich interests me is c_scan cause in the manual it sais: Quote:
c_scan (VECTOR* pos, ANGLE* dir, VECTOR* sector, var mode); [...]
The following mode values can be set: [...] SCAN_LIGHTS Scans for static lights. [...]
Modifies: you Pointer to the closest detected entity. result Distance to the closest detected object. target Position of the closest detected object. bounce Angle of the closest detected level camera position. tex_color Color of the closest detected static light.
[...]
Are these static lights those placed in WED?
Thanks, Slin
Last edited by Slin; 04/06/07 22:52.
|
|
|
Re: Normal-Mapping Shader (The Best @ vsps2.0)
[Re: Robotronic]
#120760
04/07/07 01:41
04/07/07 01:41
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
OP
Expert
|
OP
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
@Slin: The c_scan() method only returns the color of the lightmap below the entity, not the lights position. I'm doing the same thing with c_trace(). I am using this method to light the model with static lights (as you can see). When I was working on the shader, I was getting horribly incorrect results with vecLight, therefore I wrote my own method for doing static lighting. I'll mess with it some more.
@TSGames: It is possible, but not realistic. Shaders on WED blocks are TOO slow. This is why many developers are now creating thier levels with models.
@foodstamp: Robotronic explained the problem. This was for testing, and I had forgotten to remove it. I'll remove it tonight.
@Robotronic: Adjusting specularity by the alpha channel, should be the alpha channel of the normal map, not the diffuse map. I used stencil shadows in my testing, and had no problems, but I also was using a 24 bit tga for my diffuse map, therefore no alpha channel there. Only in my normal map. I may be wrong here, so please correct my if I am.
@All: As always, the are some bugs that needed to be fixed. I'm going to update the code tonight, and then post it when it's working again. Thank you all for your comments, help, and kind gratitude...
xXxGuitar511 - Programmer
|
|
|
|