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.
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.
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.
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.
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?
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.
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.