2 registered members (AndrewAMD, 1 invisible),
1,395
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Wow! A flat grey shader!
#49040
07/11/05 20:44
07/11/05 20:44
|
Joined: Apr 2005
Posts: 64 Italy - Rome
_Tommo_
OP
Junior Member
|
OP
Junior Member
Joined: Apr 2005
Posts: 64
Italy - Rome
|
I'm a shader newbie, and i were trying to program a simple vertex shader just for test. The shader works, but after the level loads and the camera is loaded, all the objects using that material get a beautiful flat grey... and i'm sure that the shader's parameters aren't modified by starters or other functions... Here's the code: Code:
material mat_test { effect = " matrix matWorldViewProj; matrix matWorld; texture entSkin1; // texture entSkin2; // dword mtlSkill1; vector vecLight; vector vecViewDir; // default technique technique test { pass P0 { VertexShaderConstant[0]=<matWorldViewProj>; VertexShaderConstant[4]=<matWorld>; VertexShaderConstant[10]= <vecLight>; VertexShaderConstant[15]= <vecViewDir>; Texture[0] = <entSkin1>; Texture[1] = <entSkin2>; VertexShader = asm
vs.1.1 dcl_position v0 dcl_normal v3 dcl_texcoord0 v7
def c16, 0, 175, 175, 100 def c20, 175, 0.011,0,0 m4x4 oPos, v0,c0 sub r0, v3, -c15
mul r0, r0, c16
mul oD0, r0, c20.yyyy }; } } technique fallback { pass P0 { // set texture stage states Texture[0] = <entSkin1>; ColorArg1[0] = Texture; // stage 0 = skin texture ColorOp[0] = Modulate2x; ColorArg2[0] = Diffuse; // modulate by lighting } } "; // end of the effect string }
There are some useless things, and the shader itself it's useless, but someone has an idea of because it becomes flat grey after camera loading? Thanks, Tommo
|
|
|
Re: Wow! A flat grey shader!
[Re: _Tommo_]
#49041
07/12/05 02:36
07/12/05 02:36
|
Anonymous
Unregistered
|
Anonymous
Unregistered
|
I fixed the code for you. Please note: I'm not a shader programmer. Code:
material mat_test { effect = " matrix matWorldViewProj; matrix matWorld; texture entSkin1; // texture entSkin2; // dword mtlSkill1; vector vecLight; vector vecViewDir; // default technique technique test { pass P0 { VertexShaderConstant[0]=<matWorldViewProj>; VertexShaderConstant[4]=<matWorld>; VertexShaderConstant[10]= <vecLight>; VertexShaderConstant[15]= <vecViewDir>; Texture[0] = <entSkin1>; Texture[1] = <entSkin2>; VertexShader = asm vs.1.1 dcl_position v0 dcl_normal v3 dcl_texcoord0 v7 def c16, 0, 175, 175, 100 def c20, 175, 0.011,0,0 m4x4 oPos, v0,c0 sub r0, v3, -c15 mul r0, r0, c16 mul oD0, r0, c20.yyyy }; } technique fallback { pass P0 { // set texture stage states Texture[0] = <entSkin1>; ColorArg1[0] = Texture; // stage 0 = skin texture ColorOp[0] = Modulate2x; ColorArg2[0] = Diffuse; // modulate by lighting } } "; // end of the effect string }
|
|
|
Re: Wow! A flat grey shader!
[Re: _Tommo_]
#49042
07/12/05 07:04
07/12/05 07:04
|
Joined: Oct 2002
Posts: 8,939 planet.earth
ello
Senior Expert
|
Senior Expert
Joined: Oct 2002
Posts: 8,939
planet.earth
|
and what did you expect from that shader? when i apply it to a model the color changes as the camera-angle changes btw, both of you forgot the bracket at the beginning of the vertexshader asm section so lets look: Code:
technique test { pass P0 { VertexShaderConstant[0]=<matWorldViewProj>; VertexShaderConstant[4]=<matWorld>; VertexShaderConstant[10]= <vecLight>; VertexShaderConstant[15]= <vecViewDir>; Texture[0] = <entSkin1>; Texture[1] = <entSkin2>; VertexShader = asm { vs_1_1 dcl_position v0 dcl_normal v3 dcl_texcoord0 v7
def c16, 0, 175, 175, 100 def c20, 175, 0.011,0,0 m4x4 oPos, v0,c0 sub r0, v3, -c15 //r0 now contains : normal - ( - vecViewDir)
mul r0, r0, c16 //r0 gets multiplied by cyan mul oD0, r0, c20.y //ro gets scaled down by 0.011 }; } }
Last edited by ello; 07/12/05 07:11.
|
|
|
Re: Wow! A flat grey shader!
[Re: ello]
#49043
07/12/05 16:52
07/12/05 16:52
|
Anonymous
Unregistered
|
Anonymous
Unregistered
|
OK. I didn't know, but like I said, I'm not a shader programmer. Sorry.
|
|
|
Re: Wow! A flat grey shader!
#49044
07/12/05 18:42
07/12/05 18:42
|
Joined: Oct 2002
Posts: 8,939 planet.earth
ello
Senior Expert
|
Senior Expert
Joined: Oct 2002
Posts: 8,939
planet.earth
|
Quote:
OK. I didn't know, but like I said, I'm not a shader programmer. Sorry.
hey, take this excuse back, or i put you into a barrel full of ink:)
i cant hear those "sorry" here and "sorry" there.. sorry for what?? you dont need to be sorry:)
|
|
|
|