Usage of Fog

The manual approach requires the user to set up a scene for dumping the needed shader, dump it, then load it manually. Not very tidy, but not impossible. The main problem I see here is people might still need to know some Cg to be able to set up the correct shader inputs.

As for the fog, now that I think about it a filter based one would be better in the sense that you would be able to have your NodePaths with custom shaders affected by it. This could mimic only the exponental fog I think, but would still be a life saver for people using custom shaders.
rdb, we’re asking a lot from you, but it would be great if you would implement this feature as well.

being impatient

Isn’t that the Quake3 custom map The Doom that came to Dunwich?

We have been talking about post-prod fog since 2009. How is it being used in Panda3d?

Yeah, I suppose it is that map.

The fog I implemented is not a post-processing filter, it is applied in the shader on the model itself, in order to 100% match the fixed-function fog effect. You can simply enable fog the usual way, and enable the shader generator on the node.

Can someone get this postprocess fog working? code.google.com/p/pandademomaste … p&can=2&q=
Maybe this could be added as a CommonFilter. That way everyone would be happy.

Did you guys decide on the other issue? I’m really looking forward to using texture projection on a per-pixel lit terrain in my project :slight_smile:

I’m working on it.

David

Okay, sorry for being pushy.

I just tested the demomaster fog filter with the buildbot release and it works now.
I’ll see if I can merge it with CommonFilters.

EDIT: Okay, here’s a standalone version of clcheung’s postprocess fog. 4shared.com/file/LlhIjglw/demo_fog.html

Could someone with Cg knowledge explain how this works? It seems like the exponent density is calculated from “focus” and “fog density” shader inputs. The original non-postprocess method of Panda3d just requires a single ExponentDensity value.

I forgot why there is such a parameter and I have not much Cg knowledge to explain. May be it was there because I was developing a DOF demo at that time…

You can ignore that parameter and use only fog density.

Maybe I should have checked the cg file even though I didn’t know the language. It seems the focus is just multiplied to the final value so you can safely remove it.
There’s still something wrong.
I think this illustration could explain it better than words:

In other words, if black is no fog and white is completely covered by fog, then the distant objects are never completely obfuscated by fog, unless you use really high values, but then you won’t be able to see things few units away.

I would expect setFog/clearFog to work the same way as setLight/setLightOff and setShaderAuto/setShaderOff

import direct.directbase.DirectStart
from pandac.PandaModules import *

myFog = Fog("Fog Name")
myFog.setColor(0.4,0.4,1)
myFog.setExpDensity(0.03)
render.setFog(myFog)

environ = loader.loadModel('environment')
environ.reparentTo(render)

environ.clearFog()

run()

I thought like lights and shadergenerator, fog would be applied to render’s children and you could disable fog on the nodes you want later.

Drwr and Rdb, did either of you work on the original Panda engine? You seem to know a lot about its structure. Just wondering.

I was watching some of the Panda Class videos and I’m guessing the teacher in the videos is one of the originators of the engine.

I know Disney had it’s grip on the engine and something happend to set it free (don’t know what though).

It would be sweet to chat with some of the orginators of Panda3D. I would probably ask questios about Panda that would give them a headache for six months. :smiley:

drwr worked on the original engine, I think. I didn’t, I’m quite a newbie to the engine compared to him.

The teacher in most of the videos is drwr.

I remember the old gource videos showed how much and long drwr has worked on this engine.

BTW, any news drwr?

setFog/clearFog works just like setLight/clearLight.
setFog/setFogOff works just like setLight/setLightOff.

I think I don’t understand their difference by reading the API doc.
Let me try to guess: clearFog() undoes fog settings like setExponent(), but doesn’t disable/remove fog from the node?

BTW, in what phase is my most wanted feature? :slight_smile:

setFogOff() explicitly sets an “off” fog attribute to the node. This will ensure that all nodes at this level and below do not have fog, overriding a normal “on” fog attribute applied at a higher level. For instance, you might use render.setFog() to turn on fog globally, but then use object.setFogOff() to turn off fog for this one particular model.

clearFog() removes any fog attribute, on or off, that had previously been applied to this node.

All of the other attributes follow a similar model. setTextureOff() sets an “off” texture attribute, while clearTexture() removes any texture attributes. And so on.

I’m still looking into it, but it’s not a very high priority for me right now. It is, like most of these things, more complicated to do than it appears at first.

David

So the difference is that if you have fog enabled on a higher node, clearFog() won’t disable fog on the node?

I just hope it won’t be forgotten. I have found the issue in many cases when using the engine in the past few years.
If a Launchpad report will help, I can make one.

Right. clearFog only affects that particular node that you call it on. clearFog undoes the effect of any setFogOff or setFog previously set on that very node.

FYI, the auto-shader fix is now in place and available on the current buildbot release. You should now be able to slide texture coordinates, or do other interactive adjustments to the state, without forcing the auto-shader to continually regenerate itself.

David

Excellent work! Many thanks!