Hey, I believe I have successfully implemented LinearFog and ExponentialFog in Xith3D, I have tested them both using JOGL for rendering and I think the LWJGL one works too but I haven’t tested it yet.
Currently it seems impossible to have more than 1 Fog node in the scenegraph but I haven’t the foggiest idea why this is. (hehehehe) I’m not sure if this is due to JOGL not being able to render more than 1 instance of fog or simply because my JOGL code is just sucky. So at the moment if two Fog type nodes are added the last one to be added to the scenegraph will be the only one displayed. I don’t really think too many people would really need > 1 Fog node in the scenegraph anyway? But it’s a start.
PICTURES:
No Fog:
http://www.users.on.net/~jwinters/nofog.jpg
Linear Fog:
http://www.users.on.net/~jwinters/linearfog.jpg
Exponential Fog:
http://www.users.on.net/~jwinters/exponentialfog.jpg
This is the list of files I ended up adding/changing (2 new files FogShader.java and FogShaderPeer.java). Basically all I did was copy the code from how Light nodes are already rendered in the scenegraph and apply it to Fog nodes, so it should fit in fairly nicely.
CHANGES:
View.java (scenegraph package - added instanceof check for Fog nodes if “nn” node variable is a state modifier)
ViewState.java (render package - added variables to store/support new FogShader class)
ViewStack.java (render package - added variables to store/support new FogShader class)
Fog.java (scenegraph package - added stateModifier = true)
FogShader.java (render package - newly created class to store rendering/shading information about Fog nodes)
ShapeAtom.java (render package - changed so that FogShader object in ViewState object is added as a shader correctly along with the LightingShader object)
RenderPeerImpl.java (render.jogl package - changed so that FogShaderPeer is registered shader class for FogShader class)
FogShaderPeer.java (render.jogl package - newly created class to handle rendering of fog)
RenderPeerImpl.java (render.lwjgl package - changed so that FogShaderPeer is registered shader class for FogShader class)
FogShaderPeer.java (render.lwjgl package - newly created class to handle rendering of fog)
Can somebody please tell me how I submit the changes/updates that I have made to the Xith3D code?
Also what is the difference between GL_EXP and GL_EXP2 fog modes in JOGL? Currently set ExponentialFog to use GL_EXP mode instead of GL_EXP2 mode (and LinearFog is set to GL_LINEAR mode).
Thanks.

