PDA

View Full Version : vertex coordinates as verterx program output



lua
05-28-2005, 12:17 AM
hello, all
suppose i output vertex coordinates (x, y, z) in vertex program to fragment program in cg, and i want each fragment can have an attribute: containg a vector signify this fragment's real current positons' coordinates in world coordinates system . does it work?

Java Cool Dude
05-28-2005, 06:41 AM
Passing the vertex position from the vertex to the fragment shader will have the rasterizer linearly interpolating it and producing the fragment correct (x y z) world, object or camera space position depending on how you handle your things.
For the transfer operations, you can use varying variables or a spare texture interpolant.

lua
05-28-2005, 04:39 PM
big thanks