Jump to content
  • Advertisement

Archived

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

dave

Unexpected Result in Simple Vertex Shader Code, please help?

This topic is 5202 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Ive changed that line, but it still comes out yellow, anything else please?

regards,

ace

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!