Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

TexEnvCombine alpha scaling and clamping



Hi Y'all,

I have a tex env combine hack that goes something like this:

Unit 0:
RGB: replace from tex 0
alpha: subtract (tex fragment alpha - primary color alpha), then scale by 4x

Unit 1:
RGB: blend previous tex vs. tex 1, controlled by previous alpha
alpha: set to constant color (1)

The goal is to use the vertex color (primary color) and the texture 0 alpha almost like a "choose" function.

If the texture fragment is less than the primary color alpha (failing to meet the bar), we get 0 for alpha and end up with all of tex 0.

If the the difference is less than 0.25, then after multiplying by 4.0 we get at least 1.0 alpha and we get all of the second color.

The problem is with clamping...if I read the combine spec right, the resulting alpha from tex unit 0 should be clamped to [0, 1]. So I should always get tex 0, tex 1, or something in between.

But on my friend's G5 with an ATI Radeon card, he is seeing strange blue artifacts...upon close investigation, it _looks_ like we're getting an alpha blend factor > 1, causing the RGB colors to "clip" as they are overdriven...as they clip in different places we have a hue shift and our texure goes from a nice green and brown turf to a strange very brigiht cyan radioactive pile of goo. (At least that's how he describes it.)

- Am I interpretting the spec wrong, or is there a requirement to clamp after each TU operation on all four channels?

 - Anyone else seen this?

- Is this even worth reporting as a bug, or is this the kind of thing that's going to be so low down in the ATI driver implementation that it's not worth fixing for one user's special case app?

Our workaround is to not do the multiply by 4, which prevents color distortion, but gives us a lot less of the 'choose'-ness that we want...we always have a blend across all alpha values in our texture, not just from 0.0 to 0.25, with clamping for the rest.

*cheers*
Ben
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.