Jump to content


The Complexity of Transparency


11 replies to this topic

#1 balfieri

    New Member

  • Members
  • Pip
  • 7 posts

Posted 12 February 2007 - 02:25 AM

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.ominousde...A/MayaTrans.jpg

#2 Reedbeta

    DevMaster Staff

  • Administrators
  • 4782 posts
  • LocationBellevue, WA

Posted 12 February 2007 - 02:56 AM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 balfieri

    New Member

  • Members
  • Pip
  • 7 posts

Posted 12 February 2007 - 03:35 AM

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.

#4 Reedbeta

    DevMaster Staff

  • Administrators
  • 4782 posts
  • LocationBellevue, WA

Posted 12 February 2007 - 04:00 AM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

#5 balfieri

    New Member

  • Members
  • Pip
  • 7 posts

Posted 12 February 2007 - 04:23 AM

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?

#6 Reedbeta

    DevMaster Staff

  • Administrators
  • 4782 posts
  • LocationBellevue, WA

Posted 12 February 2007 - 05:55 AM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

#7 hovermonkey

    Member

  • Members
  • PipPip
  • 38 posts

Posted 12 February 2007 - 11: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.

#8 Nick

    Senior Member

  • Members
  • PipPipPipPip
  • 1225 posts

Posted 12 February 2007 - 01:15 PM

Could this help: Interactive Order-Independent Transparency?

#9 Reedbeta

    DevMaster Staff

  • Administrators
  • 4782 posts
  • LocationBellevue, WA

Posted 12 February 2007 - 03:49 PM

Nick, that paper just describes depth peeling. :)
reedbeta.com - developer blog, OpenGL demos, and other projects

#10 balfieri

    New Member

  • Members
  • Pip
  • 7 posts

Posted 12 February 2007 - 04:30 PM

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.ominousde.../SA/Overlap.jpg

#11 balfieri

    New Member

  • Members
  • Pip
  • 7 posts

Posted 14 February 2007 - 12:12 AM

I move this question here: http://www.devmaster...44723#post44723

#12 Nick

    Senior Member

  • Members
  • PipPipPipPip
  • 1225 posts

Posted 15 February 2007 - 06:18 PM

Reedbeta said:

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users