I need a scene graph/management method for a 3D editor (brute force rendering is not really a possibility), where lots of data (geometry) are constantly being modified, it also would need to work great for picking (casting rays from the camera to select objects). Octrees seem to be a great solution, but i'm not quite sure.
Answer
Think only just one part of the data will be edited at the time, so that makes it easier. Do all just as normal and pick out the one that is editted to use a differend rendering method such as wireframe, coloured or whatever you need.
Brute force is actually never a good possibility unless you have only one checkersboard or such.
Two optimazations can be a vertex and texture cache. Collect objects that share the same vertex data and texture data. Then render all of those in one time. This saves a lot of gpu time as you only set the texture data once and then render 10 objects for instance. This is in addition too octree and frustum culling. Firstly check the distance from the camera, if further then the farplane, do not bother doing anything. Use bounding spheres, that's the cheapest way to determine if something is in view or not, then check the axis aligned bounding box (aabb). For higher precision you could do a boundingbox check.
EDIT: For ray picking I would create a new class. As I go through all objects on the next render I only pass in that ray instance so it can be filled. This means I have in the object class a method for a ray picking check where the ray class is being passed to. It will cost almost nothing.
Regards,
No comments:
Post a Comment