Sign in to follow this  

Any tools or plugins for controling mesh's index order

This topic is 2341 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

sometimes, we need more precisely control about triangle rendering order. For example, a hair mesh, we wish underneath triangle render first, then the upper layer, because of proper alpha blend. so we need adjust the mesh's index buffer when modeling or exporting.
however ,as far as I know, 3ds max does not provide anything like that. And surprisingly, there's nearly no article talk about this matter.

so my question is, is there any tools or plugins can help doing this.
or how can I do this, If I have to do it by myself. Any useful reference?

thanks.

Share this post


Link to post
Share on other sites
Split the mesh in MAX by layer and tag each meshe with a 'layer' number, then on export or read into your engine, combine the mesh but order the triangles properly?

Share this post


Link to post
Share on other sites
The problem is that when the view angle changes, the correct depth order (back to front) is often not the same as in most other angles. This is why it is not usually practical to establish a geometry depth order during modeling.

The algorithm itself is very simple, though, if you wish to do this for some special reason (for example, if you know that you'll view the model always at the same angle). Just sort the geometry by depth and store the new sorted indices.

In MAX, you can tag meshes with custom properties; in your case, you could define a "isTopmost" bool property which would be set to true for everything that you want to export as the topmost geometry. Then, your exporter can read this property and sort the stuff by it before writing it to your output file. Or, your engine could read that property (if it is exported as is) and sort the stuff on the fly.

Share this post


Link to post
Share on other sites
Yep, you also could go a step further and rebuild the index buffer at runtime

Chances are not all triangles need real alpha blending, too - the rest maybe just alpha test? If so, can split those into a separate mesh that doesn't need any kind of special treatment

If you do any kind of OIT I guess you can avoid all of the issues without any magic

Share this post


Link to post
Share on other sites
thanks for ideas.

yes, transparent rendering is a large topic, and I have already done a lot of R&D on that. But here, I would like focus on triangle ordering.

@Nik02
"tag meshes with custom properties" you mean "Object Properties" per object or infomation that can tag to mesh's faces ?
if you mean "Object Properties", that means mesh will be splited into many objects like RDragon1 suggests, right?




Share this post


Link to post
Share on other sites
[quote name='Garuda' timestamp='1310831914' post='4836024']
@Nik02
"tag meshes with custom properties" you mean "Object Properties" per object or infomation that can tag to mesh's faces ?
if you mean "Object Properties", that means mesh will be splited into many objects like RDragon1 suggests, right?

[/quote]


I don't remember the 3DSMAX terminology, it's been a while since I've used it. But yes, I mean object-specific properties that the user can establish (and then access from scripts). And yes, that means splitting the geometry to multiple object to which you can set discrete values of those properties.

It is also possible to mark triangles in different ways; for example, painting vertex colors or assigning face or smoothing groups. But the best technique depends on your own requirements regarding the workflow, and the requirements of the engine (what type of data can it load and handle). It may even be possible to create named face groups nowadays (so as to identify them in code), but I'm not sure about this.

MAX is very extensible, but the tool programming effort can be significant depending on the degree of extension you want to do.

Share this post


Link to post
Share on other sites

This topic is 2341 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