Archived

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

Very simple pixel&vertex shader problem (oD0)

This topic is 5150 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, For some reason, which I cant figure out, the color information is not being passed from my vertex shader to the pixel shader. Here is the shader code:
//vertex shader:
def c5, 1, 1, 1, 1
	mov oT0.xy, v7
	dp4 oPos.x, c0, v0
	dp4 oPos.y, c1, v0
	dp4 oPos.z, c2, v0
	dp4 oPos.w, c3, v0
	mov oD0, c5

//this doesnt work, its all black:
ps.1.3
def c0, 1,1,1,1
tex t0
mul r0.rgb, t0, v0
+ mov r0.a, c0.a

//but this does: (no supprise)
ps.1.3
def c0, 1,1,1,1
tex t0
mul r0.rgb, t0, c0
+ mov r0.a, c0.a
 
Does anybody know what could possibly be causing the information in oD0/v0 to disapear? Lighting is off, fog is off, and everything renders as expected with the second pixel shader.. Ideas? Thanks.

Share this post


Link to post
Share on other sites
The problem was that you cant define constants in the vertex shader. Well, more accurately, you can, but then they dont work if you set any of the other constants during runtime.

10 points to the brillient guy who thought that behaviour was a good idea to include in DirectX.

The people at nVidia also get a few points for having CG create code that relies on constants in this way aswell.

Share this post


Link to post
Share on other sites