Sign in to follow this  

face display problem

This topic is 3721 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! I'm not real smart with things like this, I usually leave 3d math to existing apis, but I'm in a position where I need to sort a mesh's faces because they have alpha textures, and not 1 bit types. I think it's called back2frontsorting. I don't want to use this PSB tree method I know of because it seems like it won't work. I have a mesh that is different every frame and rotates and such. Is there any method that can kind of guess the face order quickly just by checking the x,y,z every time? (even if it's occasionally wrong) A code example would be good. I could really use some help with this.

Share this post


Link to post
Share on other sites
I created a face sorting algorithm that keeps track of all faces in an std::map

anytime a face is sorted, I add it to the map and calculate the distance of it from the camera. Before I render all my faces, I sort the map and then go.

Share this post


Link to post
Share on other sites
It is really expensive and difficult to do correct transparency (take a look at depth-peeling) and PSB are one way to go, but only sorting your faces is not enough and very expensive (sorting=O(n log n)).

Ask yourself, do you really need a high level solution for transparency ?

There are already solutions for special transparency 'cases' like water, grass, trees, convex hulls etc. If you only have this kind of transparency 'problem' go for the special solutions.

--
Ashaman

Share this post


Link to post
Share on other sites

Hi,

BSP is the only method presented here to give a perfect back to front order of translucent surfaces. However, with modern hardware, BSP isn't really efficient as it is evaluated on CPU. BSP does work, but personally I wouldn't use it on very complex models. You can google for implementation details.

Distance based sorting will fail at certain situations (e.g. surfaces intersecting each other, etc).

I suggest studying different alpha drawing methods as they produce different artefacts on different cases.

Good luck !

Share this post


Link to post
Share on other sites

This topic is 3721 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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