when occurs the perspective correction in directx pipeline ?

Started by
2 comments, last by Zbychs 14 years, 5 months ago
1. the perspective correction occurs when tex2D ? 2. or when coming into pixel shader ? so all value coming from TEXCOORDn is corrected related to linear interpolation ? 3. in rasterization , perspective correction occur to TEXCOORDn value ? i searched for the doc about that , but i cant
Advertisement
Values coming out from vertex shader are interpolated with perspective correction and fed to pixel shader. Any data in PS is already "perspectively correct".
perspective correction work well for texture coordinate (u,v)
cuzo the (u,v) is linear to (x,y,z) in world coordinates.

but if one value is not linear to (x,y,z) in world coordinates.
and the value comes from vertex shader,then the the interpolation of perspective correction is wrong method for the value.
if the value is interpolated correctly by the spherical interpolation or dual quaternion,
what can i do for the value to be correctly interpolated ?


If you need other than linear interpolation you'll have to correct somehow the values. For example linearly interpolating normals will give you non-normalized vectors. You can normalize them in the pixel shader to correct them (a bit). If you need some special interpolation you can use additional texture as a lookup (linearly interpolated value -> correct value). Normal maps can be thought of as a case of this approach.
Anyway, I don't think there's any general way of handling arbitrary interpolations.

This topic is closed to new replies.

Advertisement