RenderEffect::has_cull_callback

I have been experimenting with classes derived from RenderEffect. My assumpltion has been that if I implement has_cull_callback to always return true then cull_callback is called each frame.

I created a new instance of my own RenderEffect and applied it to “render” (Python). What I found is that cull_callback gets called only if somewhere in the scene graph is a GeomNode. With the most simple scene graph - just “render” - the cull_callback has not been called.

Is there a way to trick the CullTraverser into calling MyRenderEffect::cull_callback even if the scene graph is just a single PandaNode?

Perhaps what you really want is a custom PandaNode, rather than a custom RenderEffect.

In your custom node constructor, you can call:

set_internal_bounds(new OmniBoundingVolume());
set_cull_callback();

and also overload is_renderable() to return true, and your node will always be visited every frame, and its cull_callback() method will always be called.

RenderEffect, on the other hand, is only visited if one if its children is a renderable node. The idea of a RenderEffect is that it applies some effect to the rendering of nodes below it, so it makes sense to call it only if it does in fact have renderable nodes below it.

David

Well, it is just a little experiment. Using custom PandaNodes is what I have done in a few other places before.

This is actually what I want to do. I want to have custom PandaNodes somewhere in the subgraph below, and the render effect should add a bit of geometry for these custom nodes, like for example the ShowBoundsEffect does.

The custom nodes are not implemented yet. They will be derived from PandaNode (not GeomNode). I will try to implement them next, and overloade is_renderable() on these custom PandaNodes.

Thank you for the clarifications.