Skip to main content
gamedev.net
🔒 Locked

Sorting Transparency

Started by Kest 2 replies 450+ views
Original Post
Kest
Kest
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 :)
dave
dave
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
Kest
Kest
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 :)
dave
dave
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.