Skip to main content
GameDev.net gamedev.net
🔒 Locked

Using Range-Fog in OpenGL?

Started by Kryzon Jan 17, 2010 at 12:05 PM 8 replies 2.1k views
Original Post
Kryzon
Kryzon
Hello, I'd like to know if it is possible to implement Range-Fog using OpenGL. For those that don't know, Range-Fog differs from the default modes because it uses the distance from the viewpoint to the vertices to calculate the amount of fog. This way, you really have a visible "range" around you (while in the default modes, if you turn your camera, sometimes some objects appear in the corners of the screen). Thanks in advance, Kryzon.
Kryzon
Kryzon
Oh, but is there a way to do it by hardware without using shaders (kinda like you would do with Direct3D, which supports Range-Fog natively)?

Kryzon
Kryzon
Ah, that's it!

Thanks for the help, guys.
zedz
zedz
I would use opengl fog at all, u will notice even in old games most of them never used it but preferred to do the fogging themselves.

As has been suggested youre better of doing it yourself in a fragment shader
Kryzon
Kryzon
I see; the thing is that I don't know how to program GlSl (or any other shader language, for that matter).

But why do you say that? what is the benefit from doing it yourself?

Native fog should be pretty optimized, one would think.
Brother Bob
Brother Bob
On cards that don't provide shaders, then the discussion about shader vs. native fogging is meaningless to begin with. On cards that do, the fogging, and the rest of the entire fixed function pipeline, is most likely shader implemented anyway.
HuntsMan
HuntsMan
Quote:
Original post by Kryzon
Native fog should be pretty optimized, one would think.


Because there's no such thing as native fog in cards from about 6 years ago, as the fixed function pipeline is internally implemented as shaders.
Kryzon
Kryzon
I had forgotten the term. I meant fixed-function pipeline fog versus custom fog methods.

My engine will be using fixed-function, so I'll stick with this "Radial-fog" extension.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.