Sign in to follow this  
Kest

Sorting Transparency

Recommended Posts

I've always thought that the best one could do to sort transparent objects was to sort individual polygons from back to front. I still have problems with this. If polygon 'one' overlaps polygon 'two', and polygon two also overlaps polygon one, one of the polygons will be hidden by the invisible parts of the other - because of the z-buffer. Take a look at this snap shot from Mount&Blade: Free Image Hosting at www.ImageShack.us It looks to me like the polygons I've highlighted are only two individual polygons. Each of them are overlapping the other, yet nothing is being hidden. What am I missing here? Any help is appreciated :)

Share this post


Link to post
Share on other sites
So this is the classic problem where you have perpendical quads and neither are in front or behind the other. Well i think the only easy solution here would be to dided the quads in half vertically at the intersection line so you have 4 quads. Then render these back to front.

Are you actually having problems with the sorting and vertex buffer manipulation or just this particular problem?

ace

Share this post


Link to post
Share on other sites
I'm not really having problems yet. I currently just sort entire models for transparency. But trees are high on my todo list, and I'm trying to figure out what exactly I'll be falling into.

I don't like the idea of messing with vertex buffers, though. Is that what they're doing? Wouldn't it be better in this case to simply build that tree section with four polygons instead? And if you're going to build with four polygons, why make them look like two intersecting polygons instead of making the tree look more natural?

Are you sure that's what they're doing?

edit: Forgot to say thanks :)

Share this post


Link to post
Share on other sites
Well 4 polygons is very easy to sort and looks reasonably good as well as being cheap. If you create your vertex buffer with Dynamic usage then writing to it isnt so expensive.

I would suggest that in that picture they are using 4 polygons and sorting them as i said before. I have an example of a cube i rendered transparent with something inside of it, if you are interested you can have the code, might be a reasonable working example.


ace

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this