Quadtree based renderer

Source-code only - please, don't post questions here.
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Quadtree based renderer

Postby relsoft » Apr 05, 2007 3:13

Download here:
http://rel.betterwebber.com/junk.php?id=89


'' ********************************************************
'' ** This code is best viewed in FBEDIT ( By ketilO )
''
'' Octree/Quadtree Tutorial 205
''
'' Filename:
'' Tree_tute_quad_tree_5.bas (April 5, 2k7, 11:30 AM)
''
'' Code:
'' Richard Eric M. Lope BSN RN (Relsoft)
'' Bleeding Edge Software
'' http:://rel.betterwebber.com
''
'' Description:
'' A code supplement for my octree/quadtree tutorial
'' Implements a quadtree in OpenGL
'' Node culling is done via frustum checks instead of gluUnproject
''
'' Purpose:
'' This demo shows you how to speed up your
'' scene renderer by node based clipping(even in HW accelerated GFX).
''
''
'' Notes:
''
'' This demo shows you how to use a quadtree to speed up your rendering even in OpenGL.
'' I've used a new approach in making the sources for the tutes. From now on, I'll be abusing
'' FB's OO approach to programming. This would not only make the source easier to read but also
'' minimizes some coding mistakes. I should know, I spent half an hour trying to figure out the
'' problem as to why my nodes look weird. Turned out as an ommision of the .z member of the
'' vector (operator overloading fixed it).
''
'' You should also use FBedit to compile the sources. Although this could be compiled
'' with just about any IDE, you only have to double click the .FBP file using FBedit and viola!
''
'' I used a heightmap to make the meshin this demo. If you still don't know how to make
'' meshes with heightmaps, you should check out some of nehe's tutes.
''
'' Read the code line by line because much have been changed. The orientation is right-handed
'' so the quad tree is made using the x and -z axes as bases. Y is always equal to 0 node-wise.
''
''
'' Notes on Optimization...
'' * To further optimize this render you could...
'' 1. Texture batch your meshes
'' 2. Use GPU stored redering methods such as..
'' a. Display lists
'' b. Vertex arrays or Vertex buffer objects
'' c. Reducing fillrate by drawing nearer things first
''
'' ********************************************************

Richard Eric M.Lope BSN RN
Bleeding Edge Software
http://rel.betterwebber.com


Image
Zamaster
Posts: 1020
Joined: Jun 20, 2005 21:40
Contact:

Postby Zamaster » Apr 05, 2007 3:18

Ya know... this is awesome. I still dont get whats happening here, but obviously alot based off of the frame rates! I got 30 to 70!
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Postby relsoft » Apr 05, 2007 3:54

Yeah, quadtrees, octrees, BSp trees, limit the amount of triangles sent to the GPU to the ones that you can only see (inside the view volume).

So you could like have 20k to 10 million triangles for your mesh and the FPS would almost always be the same.

Return to “Tips and Tricks”

Who is online

Users browsing this forum: Google [Bot] and 0 guests