Re: [Plib-devel] Cull Draw and many viewports
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2000-06-03 01:49:07
|
Brad Colbert wrote: > If I have a couple of viewports that I want to render in the same window > is it possible to cull for each viewport then draw in each viewport? No. SSG doesn't cull into some kind of list and then draw the list - it culls down to a leaf node, then draws that node, then goes back and does a bit more culling and so on. You are probably thinking "that's different from Performer" (which *can* do interleaved Cull and Draw like SSG - but by default does a full cull into a "display list" (not an OpenGL display list) and then draws everything in one fell swoop after that. The Performer approach is interesting when you have multiple CPU's and a heavy cull load because one CPU can be culling while another is drawing the results of the previous cull. However, 99% of PC users are single-CPU and it's more efficient to interleave cull and draw because the hardware rendering engine would be idle if you spent a prolonged period of time doing a full cull at the start of the frame. In a single CPU environment, it's better to get some polygons into the graphics card as soon as possible, and while it's chewing away at rendering them, you can go back and do a bit more culling. Hopefully you produce some more polygons before the hardware has finished and gone idle - but not so soon that you fill up the input FIFO on your 3D card and stall the CPU waiting for it to complete. Hence, I believe that it's best to interleave culling and drawing. One possible contrary viewpoint says that it would be better from a CPU cache perspective to have the cull code resident for as long as possible - and then the draw code resident for a continuous stretch...I've heard that argument - but I don't buy it because there is the issue of data coherency too - having visited a node in order to cull test it, it's handily in cache ready for drawing. Having said that SSG doesn't store a "display list" (bad name - but that's what Performer calls it) for subsequent rendering, in fact I *do* keep such a list so that I can render translucent leaf nodes after all the opaque ones. One other reason to cull to a display list is to allow sorting by material property - which can (under some circumstances) improve rendering times...it's really hard to do that well without greatly increasing the amount of matrix pushing and popping that needs to be done. > Would this save any time or is ok to call ssgCullAndDraw for each > viewport? No - I don't think it would help much...use an ssgContext (new feature - not yet documented) for each viewport and call ssgCullAndDraw for each of them. -- Steve Baker http://web2.airmail.net/sjbaker1 sjb...@ai... (home) http://www.woodsoup.org/~sbaker sj...@ht... (work) |