View Full Version : The Complexity of Transparency
balfieri
02-11-2007, 06:25 PM
The game I am currently working on relies heavily on transparent shaders and lots of overlapping geometry. A problem we are running into is with geometry that is both in front of and behind another piece of geometry. Consider a torus rotating around a sphere. I've looked all over the internet for a solution to this problem, and the only thing I have really found is method call depth peel that looks too processor intensive. However, when I model this type of scenario in Maya, Maya seems to pull it off perfectly in the viewports, which are openGL. Any idea on what Maya is doing here?
Here is a screen shot out of Maya:
http://www.ominousdev.com/SA/MayaTrans.jpg
Reedbeta
02-11-2007, 06:56 PM
You just have to split the torus up into multiple pieces and depth sort the pieces, so you render the part of the torus behind the sphere, then the sphere, then the remaining part of the torus.
balfieri
02-11-2007, 07:35 PM
Thanks for the response Reedbeta. Do you know of a resources where I could learn how to break up a mesh like that? Preferably some in DirectX.
Reedbeta
02-11-2007, 08:00 PM
I meant the mesh has to be modelled in separate pieces by the artist. You mentioned depth peeling, which basically does something similiar automatically and in real time, but is computationally expensive.
balfieri
02-11-2007, 08:23 PM
Ah. The problem with that is that the torus is animated and rotating around the sphere so it doesn't seem like there would a good way to break it up. Plus, the torus is all one piece in Maya and it displays correctly even with animation. Does this mean that Maya is using depth peel or are there any other possibilities?
Reedbeta
02-11-2007, 09:55 PM
Just do pie slices, with the slices being small enough that one of them can't appear both in front of and behind the sphere (eyeballing your screenshot it looks like 3 or 4 pieces should be sufficient).
I'm not sure what Maya's doing, but it quite possibly is depth peeling.
hovermonkey
02-12-2007, 03:48 AM
I don't think Maya does anything clever with transparent objects. Set each individual object part in the screenshot to a different colour and set their transparency to a low value (say 20%) and it will be more obvious what Maya is doing.
Could this help: Interactive Order-Independent Transparency (http://developer.nvidia.com/object/Interactive_Order_Transparency.html)?
Reedbeta
02-12-2007, 07:49 AM
Nick, that paper just describes depth peeling. ;)
balfieri
02-12-2007, 08:30 AM
Good suggestion hovermonkey. I just tested that out in Maya and I can see the objects popping back and forth as Maya tries to decide which one is in front of the other. Looks like Maya isn't so magic after all.
Thanks to everyone for their help.
And one more question. :) Now consider a torus (with its backfaces culled) that has rotated into a position such that it is overlapping itself. Being that it's one object, how do I set it up to blend with itself?
A screenshot of Maya do this:
http://www.ominousdev.com/SA/Overlap.jpg
balfieri
02-13-2007, 04:12 PM
I move this question here: http://www.devmaster.net/forums/showthread.php?p=44723#post44723
Nick, that paper just describes depth peeling. ;)
Oh, I thought it was a specific hardware-friendly implementation. :blush:
But what's the problem with implementing it this way? It looks fairly efficient and straightforward to implement.
vBulletin, Copyright ©2000-2010, Jelsoft Enterprises Ltd.