View Full Version : one more register question
Is there a way to keep fog working normally when using register combiners, or a way to reproduce the effect?
There is a fog register, but it seems useless for computing fog since you don't have the window z distance available (or the fog functions for that matter).
Do I have to go to 2 pass rendering?
Any help is appreciated.
11-17-2000, 04:44 PM
You can implement fog in the final combiner. The fog register's RGB contains the color of the fog in both the general combiners and in the final combiner, and in the final combiner, the alpha of the fog register becomes available. It contains the fog factor.
(1-A)B + AC just happens to be the fog equation. The + D, well, that's just another adder.
The fog factor is computed just like it is normally. You can set LINEAR, EXP, or EXP2 fog, and you can use a fog coordinate or one of the three fog distance modes (eye plane, eye plane absolute, or radial).
In fact, fog is more flexible with register combiners, because instead of being forced to blend using the fog factor, you can do other things with it. For example, you could output it as the G register (your pixel's alpha) and use it in an alpha test to clip away pixels that were more than or less than some given radial distance from the eye.
Just to avoid confusion, the final combiner equation for RGB is
AB + (1-A)C + D
which is functionally identical to what Matt said. Just the inputs to B and C would need to be swapped or the input mapping for A would need to be GL_UNSIGNED_INVERT_NV.
11-18-2000, 05:59 PM
Oops, yeah, I had the formula wrong.
Thanks, Matt. Knowing that the fog factor was in the alpha value was exactly what I needed. It works great http://www.opengl.org/discussion_boards/ubb/smile.gif
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.