realbasic-games
[Top] [All Lists]

Re: Rendering translucent polygons (depth sorting)

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: Rendering translucent polygons (depth sorting)
From: Frank Condello <developer at chaoticbox dot com>
Date: Mon, 25 Oct 2004 17:30:30 -0400
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <E3820F75-2631-11D9-AD85-000A95DB6C90 at fireyesoftware dot com> <54021994-26AC-11D9-A60F-0003933EA538 at chaoticbox dot com> <27103494-26C2-11D9-AF21-000A95DB6C90 at fireyesoftware dot com>
On 25-Oct-04, at 4:12 PM, Asher Dunn wrote:

When I render each model group and model, I translate and rotate the current modelview matrix, so when I get to the mesh, I can calculate the world position of each vertex. I would then sort by that depth.

You'll probably want to save transparent polys transformed in world space at this point, then draw them in batches using the view matrix to avoid redundant transformations.

I don't understand what you mean here.

You have to sort and draw transparent meshes in world space so you might as well copy them into a "transparent poly buffer" at this point and transform the copies into world space (i.e. transform the actual vertices using the same matrix you're supplying to OpenGL). Once all the opaque objects are drawn, sort the transparency buffer (already in world space), apply the view matrix, and draw the transparent polygons back to front - no need to do costly, possibly per-polygon, model view transformations at this point.

A single mesh object can have some opaque polys and some translucent. Is this a bad idea? I could loop through each poly, checking to see whether it's opaque. If it is, render it. If it's not, then store it somewhere, sorted by depth, and render it in a second pass.

Does this seem like a decent idea? Does anyone have a better one?

If possible, pre-process the mesh and convert it to two meshes; one that's all opaque and one that's all transparent (or mostly transparent). This way you can at least draw the the opaque parts as one array/list. If the transparency values change frame-to-frame then it may be easier to just flag the whole mesh as transparent.

That's a good idea, but it I still have to do the actual depth sorting *every frame* for moving/rotating objects.

Yes, but my point is that this only needs to be done for the transparent parts - Treat mixed opaque/transparent models as two discrete meshes as far as rendering is concerned whenever possible. This should really be up to the modeller/artist though.

Frank.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>