PDA

View Full Version : Clip R,G,B,S,T



IG
04-23-2006, 04:15 AM
Are R,G,B,S,T clipped according to Z or 1/Z ?

memfr0b
04-23-2006, 04:46 AM
What exactly are you referring to? R,G,B sound like color components, S,T,R sound like texture coordinates. Neither of those are clipped. Color components, however, are clamped (limited to the range 0..1) before being interpolated and written to the color buffer, but there's no connection between either colors or texture coordinates and depth values (Z).

IG
04-23-2006, 04:52 AM
When clipping is done by hardware all parameters of color anf texture should be clliped accordingly. The clipping is done according to 1/z (if w=1, correct?) So are the color and texture componnets clipped the same way by the hardwrae ?

memfr0b
04-23-2006, 04:59 AM
Vertex positions are clipped agains w and -w, not z (z is being clipped itself). As homogenous coordinates are defined as (x, y, z, w) = (x/w, y/w, z/w, 1), all coordinates are effectively being clipped against -1 and 1. Clipping against w before the division allows vertices at infinity (w=0) to be clipped correctly.

Color and texture coordinates are not clipped. They are modified according to the clipping of the vertex position.

IG
04-23-2006, 05:06 AM
Are they modified linearly ?

memfr0b
04-23-2006, 05:19 AM
Yes. You can read the exact specification in the OpenGL Specification, Section 2.12 "Clipping" and 2.14.8 "Color and Associated Data Clipping".