A Normalmapping Demo

Posted By: Steempipe

A Normalmapping Demo - 11/10/04 07:38

//Edited title and desc.... misidentified as bumpmapping.//

===========================================================================
A small demo where we normalmap a model, and alter the lighting in realtime.
===========================================================================

Built: 11/9/04

Sourcecode: Not included

Needs:
-Pixelshader.1.4 or better, otherwise the engine exits.
-DX9.00c Runtimes


Eric Hendrickson-Lambert (Steempipe)

=================================================================

Download Zip - 2.79 MB





Posted By: Steempipe

Re: A Bumpmap Demo - 11/10/04 08:22

Progress is going good this evening:

Now we get Ambient lightcolor from the Engine.



As well as a variable for specular highlights...


Posted By: Red Ocktober

Re: A Bumpmap Demo - 11/10/04 09:04

Loooking good Steem... worked fine on Radeon9200/WinXP/DX9C machine...

what about multiple dynamic lights... how many dynamic lights will the shader accept so far?


--Mike
Posted By: Steempipe

Re: A Bumpmap Demo - 11/10/04 09:17

That is what I will exploring a little later tonight. Multiple light sources...
Posted By: Nadester

Re: A Bumpmap Demo - 11/10/04 09:53

Link dead mate.
Posted By: Josh_Arldt

Re: A Bumpmap Demo - 11/10/04 10:22

The link seems to work for me.

It looks awsome. Nice work Steempipe.
I can't wait for the source code of something like this.
Posted By: Drew

Re: A Bumpmap Demo - 11/10/04 10:23

WOW, very cool... is this the same as normal mapping?
Or just greyscale based bumping?
Posted By: Steempipe

Re: A Normalmapping Demo - 11/10/04 10:42

Drew: It is normalmapping... Thread title is a slip-up.

Got alot of exploring to do with it before the code is ready to post.

Edited: thread title to reflect effect as normalmapping.
Posted By: Nadester

Re: A Bumpmap Demo - 11/10/04 11:15

Ahhh.. works now. Looks really cool!
Posted By: Blattsalat

Re: A Bumpmap Demo - 11/10/04 12:35

very nice (allthough the model could be a little better ).
I really like how the shaders progress thanks to forum members like you.

very nice
Posted By: Drew

Re: A Bumpmap Demo - 11/10/04 13:26

theres a normal mapped crate with env map in my normal mapping (dx9.1) tutorial... doesn't matter to me if its just a tech demo, we get the point
I'm REALLY looking forward to this, its the cornerstone of my game art... Thanks!
Posted By: Limbi

Re: A Bumpmap Demo - 11/10/04 15:19

How to apply normal map to model or wall?
Posted By: fuxerz

Re: A Bumpmap Demo - 11/10/04 19:22

what can i say....impressive.!
release the code as soon as you can pleease
Posted By: Rhuarc

Re: A Bumpmap Demo - 11/11/04 05:42

Lol, you beat me to it- I just got a working version with light sources (I had to go to ASM because of some HLSL limits I didn't want to deal with). Mine still is rather buggy though, perhaps I'll get it working properly soon and release a version that works fully as well .

-Rhuarc
Posted By: Steempipe

Re: A Bumpmap Demo - 11/11/04 21:18

Mine is buggy, too. Alot of variables are hard coded in there right now.

Here's a small shot of current progress. The (2) light colors represent (2) light sources placed in the level. I am beating my head working on distance and attenuation factors. It took the better part of last evening to figure out why the (2) lights did not blend on the model in a smooth manner. These are not moving, yet.



Crate Texture Credit: Jeff R. Frazer.
Posted By: Rhuarc

Re: A Bumpmap Demo - 11/12/04 03:41

For the blending, I'll have to look it up first, but you have to first lerp the colors, then normalize them if I remember right... Otherwise they blend as graytones instead of color blends.

-Rhuarc
Posted By: Rhuarc

Re: A Bumpmap Demo - 11/13/04 09:10

Btw- this is what I have so far...

It works with a single point lightsource rather well, but working in ASM is giving me headaches- so I'm considering converting it back to HLSL (*shudder*) and crossing my fingers that it works and gets me past my last point in the HLSL from before (lol, talk about going the long way around ).

-Rhuarc
Posted By: Steempipe

Re: A Bumpmap Demo - 11/13/04 09:19

Looking pretty sweet.... Good work.

BTW: My issues were indeed solved with normalizing my light source vectors. Thanks.
Posted By: Rhuarc

Re: A Bumpmap Demo - 11/13/04 09:23

Good to hear .

EDIT: I got two sources now too- if you use two passes, you don't have to worry about the blending


-Rhuarc
Posted By: Josh_Arldt

Re: A Bumpmap Demo - 11/13/04 14:56

Looks awsome Rhuarc.

It looks beautifull.
Posted By: Steempipe

Re: A Bumpmap Demo - 11/13/04 15:06

Quote:

Good to hear .

EDIT: I got two sources now too- if you use two passes, you don't have to worry about the blending


-Rhuarc




That appears to be a good solution. Good you pointed it out.
Posted By: Rhuarc

Re: A Bumpmap Demo - 11/13/04 23:36

I've begun to build mine back into HLSL (so far so good, *crosses fingers*), here's how I manage the two passes:
Code:
technique normalMapping
{
pass EnvLight
{
//globals
zwriteenable= true;
zenable = true;

//shaders
VertexShader = compile vs_1_1 vs_main();
PixelShader = compile ps_1_4 ps_main();
}
pass DynLight
{
//globals
zwriteenable= true;
zenable = true;
Lighting=True;
AlphaBlendEnable=True;

SrcBlend=One;
DestBlend=InvSrcColor;

BlendOp=Add;

//locals
ColorOp[0]=SelectArg1;
ColorArg1[0]=Texture;

Alphaop[0]=SelectArg1;
AlphaArg1[0]=Texture;

//shaders
VertexShader = compile vs_1_1 vs_main2();
PixelShader = compile ps_1_4 ps_main2();
}

}



vs_main2() and ps_main2() omit the base texture and only render the lighting pass; it is rendered with alpha blending over the other pass, illuminating the texture from it.

Of course, there are also advantages to keeping both lights in a single pass, as you can condense the shader more and not worry about going overkill :P.

-Rhuarc
© 2024 lite-C Forums