visualising those nodes

mmmm reading code doesnt give you the best idea of what the scene graph REALLY looks like. and then, when you think about it and think you understand it, more problems and questions arise.

anyway…

lets take the following 2 scenarios

in #1, we have a fog object that isnt attached to a node. we can easily refer to it by the pointer we assigned to it when creating it (just to clarify, the underlined is the pointer, right?:
Some_fog = Fog(“My Fog”)
)

in the 2nd picture for #1, we set the renders fog to this.it works fine, and everything now has the fog applied to it. nice.

ok, so lets look at #2. this time we have a node attached render, “containing” (?) the previous fog we created. so something like
fog_node = render.attachNewNode(Some_fog)

in the 2nd image for #2, we apply the fog to the render the same way as the first time…the node gets completely ignored? whats the point of assigning the fog to a node then?

we Can put the node to use though, by setting the fog for the render as fog_node.node() but thats essentialy the same as what i just said above? there isnt a need for the node?

the 2nd thing i wanted to ask was about “organizing” the scene graph. how would one do it? would there be a need to?

thats about it i think :laughing:

I had this idea before:

Name: base.writeSceneGraph(“scg.txt”, rtf = False)

Desc.: Would write the whole scene graph to a txt or rtf file


Name: base.visualiseSceneGraph(toNode = aspect2d, toJpeg = “scg.jpg”)

Desc.: Would write the scenegraph to a picture and display it on the aspect2d node.

well, not exactly answering anything but if something like that was possible, i could work out quiet alot on my own through experimenting and seeing what it looks like/how it works.

not to mention how much easier it would make it to manage/picture larger scene graphs? i cant imagine trying to picture one with dozens of nodes :astonished:

You can imagine a whole bunch of nodes like this:

my eyes hurt, my brain does, and btw: it didnt answer a single of his original questions.

fog traditionally was a non-nodepath. even today there is no real need to parent it anywhere in the scenegraph.

http://www.panda3d.org/apiref.php?page=Fog
a bit more detailed explanation can be found there.

reparenting it somewhere is useful for strange,very special and rarely used effects (strange enough i cant even name an exaple).
just creating the fog-node and do setFog() on one of your nodes should apply the fog effect to your nodepath.

btw. organizing the scenegraph is up to you, and how it suits you best.

Actually, linear fog has a position and orientation, so in that case it needs to be somewhere in the scene graph. Exponential fogs can be placed anywhere.

Basically keep in mind that a Fog inherits from PandaNode and is a node like any other kind of node. But placing it into the scene graph doesn’t make much sense if it’s an exponential fog.

if i understand fog correctly it has 2 parameters, similar to the light.

you parent the fog under a nodepath. this defines the position of the fog.

and you define setFog, on the nodes that should be influenced by the fog. All child nodes of the fogged node will receive fog, unless setFogOff is set.

That’s not exactly correct - Fog inherits from PandaNode, so it’s a node itself. A NodePath can simply point to that Fog.