Texture Buffer and LOD

I’m using a rectangular area with texture added via off screen rendering buffer and ortho camera as one of my LOD node switch children.

Question: is the active buffer constantly writing to the area even when the child is switched out or when the actual model is switched in ?

if so, is there a way to check when the “imposter” area is switched in and visible so I can turn buffer active, then turn buffer inactive when switched out ?

Thanks for any ideas.

tim

Yes. The buffer will continue to render as long as it is active, whether or not its texture actually appears in the main frame. (You can see this happen in PStats, incidentally.)

There aren’t any 100% reliable ways to ask whether the textured object appears onscreen, but you can test its bounding volume against the view frustum of the camera, or you can at least ask Camera::is_in_view() for a given point of your model.

David

Thanks for the quick reply

yeah, I thought so from some of the forum posts I was reading. I wanted to check what was in view of the frustum too and was wondering about that, so thanks for the tip. In LODNode Class there is a protected member function called compute_child, I wonder if I can derive a class from that and call the function.

I think most of my LOD lower detail nodes will be simple cross quad type with pre made textures, but for a few models it might look better with the on the fly textured billboard type; but I want to control when it gets rendered, really doesn’t need to be be rendered all the time when it’s far away and view angle doesn’t change much, and it gets switched to 3D model when camera gets closer anyway.

Thanks again :slight_smile:

tim

Oh, right, I forgot we’re talking about C++. That does give you a few more options.

If you’re subclassing from PandaNode, you can override cull_callback(), which is called whenever the node is visited during the cull traversal (in preparation for rendering). This is the normal place to hang a hook to do some special render processing; it’s where the LODNode calls compute_child, for instance. Note that you also have to call set_cull_callback() in your constructor to avoid the optimization that would otherwise not bother to call cull_callback().

For that matter, you can also override Texture::cull_callback(), which has the same purpose. (In this case you also want to overload has_cull_callback() to avoid the optimization).

David

I think this is exactly what I was looking for.
I’ll start experimenting and see what kind of trouble I can get into ;}

Thanks for all your help.

tim