Skip to main content
gamedev.net
🔒 Locked

Stupid rendering question

Started by OberonZ Sep 17, 2000 at 7:36 PM 2 replies 250+ views
Original Post
OberonZ
OberonZ
I have a question to which the answer is, I''m sure, quite obvious. I just can''t wrap my head around it... Assuming you have several thousand polys arranged nicely in and octree... what is the best way to render them on the screen considering the camera can swivel and move around? I''m sure I will let out a big "duh" when I get the answer Thanks much! -OberonZ ---
PAGE FAULT: Please insert "Swap File, Disk 2"
and press any key to continue.
---
PAGE FAULT: Please insert "Swap File, Disk 2"
and press any key to continue.
baskuenen
baskuenen
You could recursively check every node. Then if it''s visible go down that node, if not don''t go down that node. Then if you''re at a certain depth, or reached the end, add element(s) to the visible parts buffer.

OberonZ
OberonZ
Yes, but my problem is figuring out the order in which the polys are rendered. Do I have to recalculate every polygon''s position relative to the camera? That sounds too expensive...

Thanks again
-OberonZ
---
PAGE FAULT: Please insert "Swap File, Disk 2"
and press any key to continue.
baskuenen
baskuenen
You need to copy the elements that get rendered from your tree to a simple "rendering array".
You could make this array a sorted linked list or binary tree, where each element gets sorted into the list/tree when added.

The extra computations you''ll need then are:
- recalculate every polygon''s position relative to the camera
- sorted add, into list or tree

Especially the sorting can take it''s time.

One thing I can tell you when you''re implementing this new linked list / binary tree, is to NOT allocate the memory every time. It''s much faster to use a uge buffer, and do your own "allocation".

But I haven''t coded an octree myself, so this might not be the best way to do it. Maybe some else can explain a faster algo...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.