Homogenous divide by W?

Started by
1 comment, last by Kalthorn 21 years, 2 months ago
From what I understand, the output position of vertex shaders should be in clip space meaning x,y, and z should be -1 to 1 (z from 0 to 1) so I set up a basic vertex shader to test this. I set constant 5 (c5) to something like (.5, 0, 0, 10) and mov c5 into oPos. Naturally the vertex appears at .05. I change w to 1 and the vertex appears at .5. Great. Same thing works for y values. Terrific. Not z values though. If I change z to 1.0 using the above examples, my vertex disappears; most values of Z cause the vertex to not appear. Testing finds the acceptable values of Z to be exactly 1/100th of W or less. Value of .3Z needs a 30.0W or nothing is rendered. What can be causing this or this normal? I've set my Viewport range from 0 to 1 and my Projection matrix is 0 to 100 but its not even being sent to shader at all. More testing shows that changing the zF of the projection matrix does alter this (ie. zF of 10 means the W need only 10* the z value of the vertex). Any chance this could be some sort of driver problem? [edited by - Kalthorn on January 18, 2003 7:49:48 PM] [edited by - Kalthorn on January 19, 2003 2:15:55 AM]
Advertisement
I think perspective divide is done outside a vertex shader, so u don''t have to do it. I may be wrong tho I new to this stuff.
Yeah I got it all worked out. Thanks though.

This topic is closed to new replies.

Advertisement