Archived

This topic is now archived and is closed to further replies.

dave

Unexpected Result in Simple Vertex Shader Code, please help?

Recommended Posts

hi, What i''m attempting to do is use the value of 1 passed to the shader in c4 to set the vertex colour to white. dcl_position v0 // This is the vertex postion (x, y, z). dcl_color v1 // This is the vertex color. m4x4 r0, v0 , c0 // This will translate the vertex by setting its new position. mov oPos, r0 // Here we will move the position in r0 to our output (oPos). mov r1, v1 // mov colours to a temp variable mov r1, c4 mov oD0, r2 For Some reason the vertex comes out as yellow. Can anyone help me? regards, ace

Share this post


Link to post
Share on other sites
Ok thats all been corrected but now when i pass the value of 1 to c4 then mov that to r1 then pass r1 as the colour output, it is always yellow.

dcl_position v0 // This is the vertex postion (x, y, z).

dcl_color v1 // This is the vertex color.

m4x4 r0, v0 , c0 // This will translate the vertex by setting its new position.

mov oPos, r0 // Here we will move the position in r0 to our output (oPos).

add r1, r1, c4

mov oD0, r1 // v1 holds the original vertex color. We will keep this.

any further ideas?

I Haven't had any expected results at all so far with this vertex shading lark! hehe



[edited by - ace_lovegrove on April 22, 2004 6:01:12 PM]

Share this post


Link to post
Share on other sites
add r1, r1, c4
mov r1, c4

Additionally your pixel processing stage, whether pixel shader or fixed function needs to be correct to actually use the vertex colour instead of say the texture colour or a constant.

[NB: there are plenty of optimisations to be had with this code too, but its best to learn the basics before you learn how to optimise]

Share this post


Link to post
Share on other sites