Archived

This topic is now archived and is closed to further replies.

Halo Vortex

Rendering characters

Recommended Posts

When working on rendering of skinned characters, I faced a problem of frustum culling. For it to work, I need to create bounding boxes, bounding spheres or something similar. But that sure can''t be made at pre-process time as meshes are constantly deformed during the animation, and calculating Min, Max coords for bounding boxes each frame by looping through all the vertexes is too expensive. How can I handle it? Another question is, how can I approx. calculate amount of screen space a given AABB or a bounding sphere takes if I have frustum, FOV and any other info. I need this to determine LOD for the characters.

Share this post


Link to post
Share on other sites
You could calculate a fairly accurate bounding box by storing a bounding box per bone, then transforming the 8 points of each box by the joint matrix each frame and generating a box from the minimum and maximum these points.

I don''t know if that''s the best way, but it''s a way.

You could also use the distance from the camera to your object for your LOD calculation.


Why you shouldn''t use iostream.h - ever! | A Good free online C++ book

Share this post


Link to post
Share on other sites
Well, I don''t really need a BBOX per bone. I need one per mesh-object e.g. head, body.

One way I could use your idea is to have a bbox per bone, transform it, and then see what bones are visible. Then cycle through all the meshes and if it has a reference to at least one visible bone, render it. But that would mean that if I have a character, that can be logically divided into 3 parts ->head, body, legs that I want to check for visibility, and I have a skeleton made of 15 bones, I''ll have to frustum-check 15 bboxes, not 3 bboxes! And that''s quite expensive.


As for LOD, yeah, I guess simple distance calculations would do.

Share this post


Link to post
Share on other sites
"I''ll have to frustum-check 15 bboxes, not 3 bboxes! And that''s quite expensive."

why? you just merge them into a single AABB...
those bounding boxes around each bone being a simplified spacial representation of your mesh, instead of looping throught all your skin''s vertices, you loop through all your simplified skin''s vertices, and extract an AABB from that...

pretty much the same as simplifying hi-res meshes for rigid body dynamics...
here you simplify even more, but if the culling isn''t exactly accurate, it doesn''t really matter, the important thing being that the character doesn''t get culled away too early, and having a bounding mesh bigger than the original mesh prevents that..

Share this post


Link to post
Share on other sites
No, it''s not about frustum-culling the whole character - that''s easy. I need to frustum-cull separate parts in case of close-up views, but you gave me an excellent idea, here it is.

For each mesh-part e.g. head+eyes, body+hands, legs (Can be divided more, but I guess there''s no need for this), make a list of all influencing bones, construct those 15 bboxes - constructing aprox. bboxes from bones is MUCH cheaper than from all the vertices, although much less accurate.

Then, for each mesh merge bboxes of influenced bones. That would give a very aprox., but still feasable results.

Share this post


Link to post
Share on other sites
so if I understoof you right, you''ll create the bones bounding boxes?
that could work but... you''re not guaranteed that the actual mesh won''t go out of these boxes.. accuracy doesn''t matter much as soon as the mesh is inside the box, if the box is slightly bigger than necessary, it won''t hurt anyone, but the opposite will... and from what I understood, you might get boxes smaller that what they should be :|

and, ok.. didn''t understand clearly that you wanted to cull separate parts
at least my post gave you an idea... that''s better than nothing ^^

Share this post


Link to post
Share on other sites