Best way to scene incremental drawing

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Best way to scene incremental drawing

EvilMax
Hello!

I need to draw quite complex scene, where there will be objects with different drawing algorithm. For example, several objects that should be rendered with different ray marching algorithm, several 3D objects with different geometry (spheres, polyhedrons, axes etc) plus text. These objects will have different position plus some of them will be added and removed dynamically.  According to my needs I think that solution will be FBO (and I have used it for ray tracing inside the volume), but questions are following:

1. What is the best (from performance) way to draw such scene incrementally, when different objects must be rendered separately in different classes? I.e. how to combine ray traced volumes, simple geometry actors, text which should be displayed in different parts of the program?
2. How to preserve correct depth tests in this case? (Well, I know that FBO can have some thing called 'depth attachment' but have no idea how to reuse it in different parts of the program to correctly render objects as the whole scene)

Actually, answer with links to some articles, chapters in books and samples will be the best, because I have some skills in OpenGL, but never coped with incremental drawing/ depth testing before.

All help will be appreciated.

P.S.  All is being implemented according to requirement that OpenGL 3.3 should be supported, so all drawings I do in 'modern way' through VAOs/VBOs.
Reply | Threaded
Open this post in threaded view
|

Re: Best way to scene incremental drawing

gouessej
Administrator
Hi

Why not looking at how this kind of case is handled in a "modern" 3D engine like JMonkeyEngine? It's just a bit trickier for ray marching. Are you talking about this?

If the geometries are really different, if the meshes aren't identical, you can't use mesh instancing but if some of them are always in the scene and remain unchanged, consider putting them into the same static VBO (if the buffers is very large, you might have to split them into smaller ones) or at least in the same VAO.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Best way to scene incremental drawing

EvilMax
Yes, exactly - medical volume rendering. I have already implemented it but now I need to add another volume with different ray casting algorithm to the scene plus add some geometry and text. So main problem - correctly combine all of this into single scene.

Thank you for the pointers about engine, I am going to look into its implementation.

Are there some general thoughts what technique could be used for implementation of such rendering?
Reply | Threaded
Open this post in threaded view
|

Re: Best way to scene incremental drawing

EvilMax
After some research, I think I understood the way to implement required. But need help of community to check and now instead of very general question have small and concrete. Hope, you can help me. What I can see from GL tutorials, FBO docs and some engines code. To render incrementally I need to have FBO with Render Buffer attached with storage (texture where to render) and depth buffer. Procedure I've used:
1. Render back face of bounding box to texture
2. Put texture onto the input of second shader program
3. Switch to default (window system provided) framebuffer
4. Render to screen.

What should I do to render incrementally:

1. Render everything from all objects that want to draw themselves to FBO (offscreen). So, depth will be preserved and no breaking.
2. Display FBO contents on screen.

Two questions.

First: how to do FBO contents displaying faster? Now I see only following the following possibilities:

1. Blit framebuffer via glBlitFramebuffer displaying contents of the FBO on the default framebuffer.
2. Initially add texture attachment and at last stage draw fullscreen quad and copy data in fragment shader.
From Song Ho i think (2) could be faster, but I am not sure that these are the only ways to do task.

Second: what to do if one of the objects have complex rendering and requres to generate its own framebuffer? Generate new, switch, draw and then perform operation above (switch to previous framebuffer and render final result there) or else?