1 registered members (TipmyPip),
18,449
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Normalmapping (in development)
[Re: Matt_Aufderheide]
#117180
03/17/07 10:30
03/17/07 10:30
|
Joined: Aug 2001
Posts: 2,320 Alberta, Canada
William
Expert
|
Expert
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
|
Yeah, alternative shader code would solve this, at least, that's how I set up my game. Water for example, starts at 2.0, then goes to 1.1. The 2.0 takes more resources, but you can change quality settings in the menus if you need. But I guess A7 will be released this year, and possibly the 2.0 version of this code as well. I'm looking forward to this shader code; JCL's past shaders worked great. @Frank - I don't see any reason why that scene wont eventually be possible with the new FBX importer. Basically you'd just save your lightwave scene as FBX, import that scene in WED, and put your lights in. Hopefully though, the importer will also import omni lights from such programs as Max and Lightwave, then you can set your lights in your modeling program and just use WED for building and setting paths.
|
|
|
Re: Normalmapping (in development)
[Re: Matt_Aufderheide]
#117181
03/19/07 15:27
03/19/07 15:27
|
Joined: Jul 2000
Posts: 28,024 Frankfurt
jcl

Chief Engineer
|

Chief Engineer
Joined: Jul 2000
Posts: 28,024
Frankfurt
|
Quote:
And who has a pixel shader 1.0 only card? that's ONLY geForce 3 ( all other shader-capable cards supported higher versions like 1.3, 1.4 etc).
Yes, I meant 1.3/1.4 of course. A lot of systems are still below 2.0.
|
|
|
Re: Normalmapping (in development)
[Re: jcl]
#117182
03/21/07 10:50
03/21/07 10:50
|
Joined: Jul 2000
Posts: 28,024 Frankfurt
jcl

Chief Engineer
|

Chief Engineer
Joined: Jul 2000
Posts: 28,024
Frankfurt
|
This is the promised specular bumpmapping: Code:
MATERIAL mtl_bumpspecular { effect= " #include <transform> #include <fog> #include <pos> #include <normal> #include <tangent>
float4 vecSunDir; float4 vecColor;
texture entSkin1; // texture texture entSkin2; // normal map
sampler sBaseTex = sampler_state { Texture = <entSkin1>; }; sampler sBump = sampler_state { Texture = <entSkin2>; };
struct out_specular { float4 Pos: POSITION; float Fog: FOG; float4 Color: COLOR; float2 Tex: TEXCOORD0; float2 Bump: TEXCOORD1; float3 Normal: TEXCOORD2; float3 Halfway:TEXCOORD3; };
out_specular vs_specular( in float4 inPos: POSITION, in float3 inNormal: NORMAL, in float2 inTex: TEXCOORD0, in float3 inTangent: TEXCOORD2) { out_specular Out;
Out.Pos = DoTransform(inPos); Out.Tex = inTex; Out.Bump = inTex; // different coordinates required for ps_1_1 Out.Color = float4(1.0,1.0,1.0,1.0); Out.Fog = DoFog(inPos); CreateTangents(inNormal,inTangent); float3 N = matTangent[2]; Out.Normal = DoTangent(N) * 0.5 + 0.5;
float3 P = DoPos(inPos); float3 EyeDir = normalize(vecViewPos - P) - vecSunDir; Out.Halfway = DoTangent(EyeDir) * 0.5 + 0.5;
return Out; }
float4 ps_specular(out_specular In): COLOR { float4 base = tex2D(sBaseTex,In.Tex); float3 bumpNormal = tex2D(sBump,In.Bump); float light = saturate(dot(In.Halfway*2 - 1,bumpNormal*2 - 1)); light *= light; light *= light; light *= light; light *= light; return base *2*light; }
technique specular { pass One { VertexShader = compile vs_1_1 vs_specular(); PixelShader = compile ps_1_1 ps_specular(); } }
"; } However, here's indeed the shader 2.0 model a better solution - either that, or two passes. Due to the limitation to 4 texture coordinate sets under 1.1, I can not transfer the light coordinates to the pixel shader, which limits the specular shading to a "metal" effect. You can play with the "2" factor in the pixel shader, or return base + (0.1 + 2*light) for brightening the dark parts of the model.
|
|
|
Re: Normalmapping (in development)
[Re: jcl]
#117188
03/24/07 11:40
03/24/07 11:40
|
Joined: Oct 2006
Posts: 91
Ghost
Junior Member
|
Junior Member
Joined: Oct 2006
Posts: 91
|
|
|
|
|