My Account


RSS
oZone3D.Net RSS Feeds»RSS 2.0 Feeds

Blogs
»Demoniak3D Blog
»JeGX's Infamous Lab

Sponsors

Modul8: real time video mixing and compositing


Link to Us

oZone3D.Net 100% Realtime 3D

»All Links

Web Partners

www.geeks3d.com
www.benchmarkhq.ru
www.tdt3d.com
www.steph3d.net
www.g-truc.net
www.worldpcspecs.com


Banners Exchange

www.jmax-hardware.com
cgindia.blogspot.com
grapejuice.c.la
www.game-lab.com


Links Exchange

»CYGAD's 3DXtra

Search
Google
Web
oZone3D.Net
 
Fog in GLSL

By Jerome 'JeGX' Guinot - jegx_AT_ozone3d(dot)net

Initial draft: December 21, 2007


[ Index ]

Page 1 | Page 2 | Page 3 | Page 4 | Page 5

»Next Page





2 - Fog Density Equations

These equations allow to define the way fog density behaves according to the distance between the camera and a given vertex . The aim of these equations is to compute a fog factor, (the fogFactor) that will allow to mix the fragment color (at the pixel shader level) with the fog color. With fixed pipeline, there are two ways to compute the fog factor: linear or exponential.

We will focus on the exponential method, because of its more realistic fog rendering possibilities . But keep in mind that those methods are linked to the fixed pipeline and that with the programmable pipeline we can compute totaly different calculus which shall suit better to a given scene (as an example, for each color composant we can set a different fog factor) .

The fog density equations are as follows :

Linear equation (corresponds to GL_LINEAR):

fogFactor = (end - z) / (end - start)

Exponential equations (correspond to GL_EXP and GL_EXP2):

fogFactor = e-(density * z)

and
fogFactor = e-(density * z)2

The following chart shows the fog factor evolution according to the distance :

Fog Factor - GL_LINEAR - GL_EXP - GL_EXP2





[ Index ]

Page 1 | Page 2 | Page 3 | Page 4 | Page 5

»Next Page







Language:


Demoniak3D
Current Version: 1.23.0
»Demoniak3D
»Download
»Libraries and Plugins
»Demos
»Online Help - Reference Guide
»Codes Samples


GPU Caps Viewer
Current Version: 1.5.0
»GPU Caps Viewer
»GPU DB Submissions


FurMark
Current Version: 1.4.0
»FurMark
»Benchmark Submissions


Geeks3D News
Page generated in 0.098478078842163 seconds.