Rune Petersen wrote: > Keith Whitwell wrote: >> Rune Petersen wrote: >>> It turns out I missed something obvious... >>> >>> The parameters are passed correctly, I have just not transformed the >>> vertex.position to the fragment.position >> I guess that's the viewport transformation, or maybe a perspective >> divide followed by viewport transformation. > > I did do a viewport transformation, but I didn't map the z component > from a range of [-1 1] to [0 1]. > Perspective divide is also needed, but not in my test app (w=1) > > ATI appears to do perspective divide in the fragment shader. > > I hit a problem constructing this: > > - In order to do range mapping in the vertex shader (if I so > choose) I will need a constant (0.5), but how to add it? > > - If I do perspective divide in the fragment shader, I will need to > remap the WPOS from an INPUT to a TEMP. > >> But I think there's a bigger problem here -- somehow you're going to >> have to arrange for that value to be interpolated over the triangle so >> that each fragment ends up with the correct position. >> >> Maybe they are being interpolated already? I guess it then depends on >> whether the interpolation is perspective correct so that once >> transformed you really get the right pixel coordinates rather than just >> a linear interpolation across the triangle. > > Is there a way to visually verify this?
Yes of course - once you've got it working, emit the position as fragment.color and have a test program read it back. If it is correct on triangles that are 'flat' but incorrect on ones that are angled away from the viewer, then it is wrong. My guess is it'll probably be fine. Keith ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV -- _______________________________________________ Dri-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/dri-devel
