0 registered members (),
17,758
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Per Pixel / Normal Mapping Tutorial v1.1..
[Re: Bright]
#30318
05/29/05 21:29
05/29/05 21:29
|
Joined: Sep 2004
Posts: 1,214 Austin, Texas
Josh_Arldt
Senior Developer
|
Senior Developer
Joined: Sep 2004
Posts: 1,214
Austin, Texas
|
Quote:
The tutorial link is broken for me
I may upload a dx9 version of the tutorial with a small demo even if I never get the little problem that it has fixed.  I'll also include the dx8 version.
|
|
|
Re: Per Pixel / Normal Mapping Tutorial v1.1..
[Re: Drew]
#30319
06/16/05 02:15
06/16/05 02:15
|
Joined: Jun 2003
Posts: 51 Ohio
Mantis1967
Junior Member
|
Junior Member
Joined: Jun 2003
Posts: 51
Ohio
|
I emailed Drew for this tutorial and he said he didn't have it anymore, if any one still has it I would be very grateful I you could share. Thanks in advance.
Mantis
Imagination is more important than knowledge...
|
|
|
Re: Per Pixel / Normal Mapping Tutorial v1.1..
[Re: Mantis1967]
#30320
06/16/05 02:21
06/16/05 02:21
|
Joined: Sep 2004
Posts: 1,214 Austin, Texas
Josh_Arldt
Senior Developer
|
Senior Developer
Joined: Sep 2004
Posts: 1,214
Austin, Texas
|
Quote:
I emailed Drew for this tutorial and he said he didn't have it anymore, if any one still has it I would be very grateful I you could share. Thanks in advance.
Mantis
I have it and I have converted it to dx9... it has a prob though.
If you want the dx8 version you can contact me through msn messenger. My msn address is humansandbag@hotmail.com
|
|
|
Re: Per Pixel / Normal Mapping Tutorial v1.1..
[Re: Josh_Arldt]
#30323
06/21/05 12:22
06/21/05 12:22
|
Joined: Sep 2002
Posts: 8,177 Netherlands
PHeMoX
Senior Expert
|
Senior Expert
Joined: Sep 2002
Posts: 8,177
Netherlands
|
Josh, I guess you will stick to ASM anyways, but I've found this one somewhere on my harddisk. It should work too... Code:
/**************************************************************/
// HLSL NormalMapping Shader
// -------------------------
// By: Daniel "Rhuarc" Niezgocki
// Requires: []VS 1.1
// []PS 1.4
// Skin1: Texture
// Skin2: Normal Map
//
// Usage: Free to use, credit is nice, but not required.
/**************************************************************/
function normalMap_init
{
mat_inverse(mtl.matrix, matWorld);
}
material normalMap_fx {
flags=tangent;
event = normalMap_init;
effect="
// VertexShader ------------------
float4x4 matWorldViewProj;
float4x4 matWorld;
float4 vecSunPos;
float4 vecViewPos;
float4x4 matMtl;
texture entSkin1;
texture entSkin2;
sampler base_map = sampler_state
{
texture = (entSkin1);
};
sampler bump_map = sampler_state
{
texture = (entSkin2);
};
struct VS_INPUT_STRUCT
{
float4 position : POSITION;
float3 normal : NORMAL;
float3 texcoord0 : TEXCOORD0;
float3 tangent : TEXCOORD2;
};
struct VS_OUTPUT_STRUCT
{
float4 position : POSITION;
float2 bump_map : TEXCOORD0;
float3 light_angle : TEXCOORD1;
};
VS_OUTPUT_STRUCT mainVS( VS_INPUT_STRUCT vsInStruct )
{
VS_OUTPUT_STRUCT vsOutStruct;
vsOutStruct.position = mul( vsInStruct.position, matWorldViewProj );
float3 position = mul( matWorld, vsInStruct.position );
vsOutStruct.bump_map = vsInStruct.texcoord0;
float3 light_normal_vector = mul( vsInStruct.normal, matWorld );
vsOutStruct.light_angle = light_normal_vector;
return vsOutStruct;
};
// PixelShader -------------------
float bumpiness = 0.5;
float specular = 0.5;
float4 vecAmbient;
float4 vecDiffuse;
float4 vecSpecular;
float vecViewDir;
struct PS_INPUT_STRUCT
{
float2 bump_map : TEXCOORD0;
float3 light_angle : TEXCOORD1;
};
struct PS_OUTPUT_STRUCT
{
float4 color0 : COLOR0;
};
PS_OUTPUT_STRUCT mainPS( PS_INPUT_STRUCT psInStruct )
{
PS_OUTPUT_STRUCT psOutStruct;
float3 base = tex2D( base_map, psInStruct.bump_map );
float3 bump = tex2D( bump_map, psInStruct.bump_map );
// Uncompress vectors ([0, 1] -> [-1, 1])
float3 lightVectorFinal = (psInStruct.light_angle - 0.5);
float3 bumpNormalVectorFinal = bumpiness * (bump - 0.5);
// Compute diffuse factor
float diffuse = dot(bumpNormalVectorFinal, lightVectorFinal);
psOutStruct.color0.rgb = ( diffuse * base + + max(diffuse-specular,0));
psOutStruct.color0.a = 1.0f;
return psOutStruct;
};
technique normalMap
{
pass P0
{
VertexShader = compile vs_1_1 mainVS();
PixelShader = compile ps_1_4 mainPS();
}
}
";
}
action normalMap_ent
{
my.material = normalMap_fx;
}
|
|
|
Re: Per Pixel / Normal Mapping Tutorial v1.1..
[Re: Josh_Arldt]
#30325
06/23/05 08:55
06/23/05 08:55
|
Joined: Jan 2003
Posts: 1,142 California
Daedelus
Senior Developer
|
Senior Developer
Joined: Jan 2003
Posts: 1,142
California
|
Phemox, That NormalMapping Shader is cool w/DX9? Didn't appear so after a quick test.
Last edited by Daedelus; 06/23/05 09:37.
|
|
|
Re: Per Pixel / Normal Mapping Tutorial v1.1..
[Re: Daedelus]
#30326
06/23/05 19:16
06/23/05 19:16
|
Joined: Sep 2004
Posts: 1,214 Austin, Texas
Josh_Arldt
Senior Developer
|
Senior Developer
Joined: Sep 2004
Posts: 1,214
Austin, Texas
|
Quote:
Phemox, That NormalMapping Shader is cool w/DX9? Didn't appear so after a quick test.
That's an old normal mapping shader that Rhuarc wrote. It doesn't have dynamic lighting or static lighting, so it may not be usefull to you.
|
|
|
Re: Per Pixel / Normal Mapping Tutorial v1.1..
[Re: Josh_Arldt]
#30327
07/01/05 07:56
07/01/05 07:56
|
Joined: May 2005
Posts: 819 U.S.
Why_Do_I_Die
Warned
|
Warned
Joined: May 2005
Posts: 819
U.S.
|
I have the tutorial from Drew , the original one , If anyone needs it let me know
Edit: Just saw steempipe's link to it , lol , btw , I'm getting the all black models error as well , Geforce FX 5200 Ultra Vid Card, DirectX9 , did anyone figure out how to fix this ?
Last edited by Why_Do_I_Die; 07/01/05 08:17.
|
|
|
|