How to hide a part of the mesh to save render time

Hi panda forum! :smiley:

I think that the title of the thread explain very well what’s my question.

Lets suppose that I have a character creator, in which you have the option to put clothes even on top other clothes not just over the character skin, so, in order to save some render time:

:question: How can I hide the part of the character’s mesh which is covered with clothes and it’s not visible?

:question: Is there a way to subdivide the character’s mesh in pieces that can be hidden to speed up the rendering?

As long as I can understand from the manual, the closest you can get in Panda3D is the occlusion culling, which is great to hide entire models but not to hide a part of a model.

I’ve read the threads concerning the character creation thing in Panda3D, but I think that there’s no info about this subject.

I’ve thinking in making different models for the character: one model if the character doesn’t have shirt, one model if he does have a shirt (with some polygons, the chest ones, removed from the mesh), but it could be way better to have just one mesh and modify it for the occasion :smiley:

EDIT: I’ve forgot to mention that I want the different clothes in different nodes, to easily change it’s colours and textures, plus, in that way I can reuse some meshes.

Thanks in advance! :smiley:

You can just .hide() stuff, you just have to set up your modes so that you can .find() sub-nodes.

Check these out:
[Looking, gripping and... dressing)

[Folders to .mf)

Thank you for that!! :smiley: :smiley:

I didn’t knew about that thread. I’ll dig into that sample and try to find what I’m looking for, when I find it I’ll post the it :smiley: :smiley:

Thanks again!!! :smiley: :smiley:

Usually, separating your model into multiple geoms so you can hide individual parts is slower than just using a single geom for the entire model and rendering it all the time.

This is because separate geoms means that separate batches are used to send the data to the GPU, which is slow - you should always try to keep the number of batches as low as you feasibly can.

Hmm… If I may interject, what in that case is the general recommendation for such cases as applying clothes to an avatar? One could model the clothes separately, then attach them (potentially scaling them as called for), but that seems to amount to much the same thing as hiding sub-geoms of a model. On the other hand, creating a separate entire character model for each combination of clothes might significantly increase the amount of work to be done. Is there no better way?

Hi all! thanks for the help! :smiley: :smiley:

The reason why I’m interested in this is to save performance, but reading the rdb’s post, now I think that maybe having a mesh with subparts is not the best option. :confused:

speaking of the attached clothes, I’ll go with separated meshes for the clothes, I think is the best way but, the question now is:

What is the impact in the performance for using an avatar with attached clothes?

and let’s say that it’s a possibility to have more than one avatar at a time (let’s say, 15) with this kind of configuration, I assume that this would be kind of awful for the engine so, is there a better way to do this?

Thanks in advance! :slight_smile: :slight_smile:

Sorry for double post, but I’ve found this on the python reference: unify

Let’s say that I have the meshes that conform my character in separated models but with the detail that every single mesh match the neighbour meshes (for example: the bottom torso have the same amount of vertexes than the upper legs, or upper pants, etc), so, can I use this “unify” method to glue all meshes in a single one?

The only catch I see on this, is that you have to make a texture for every mesh you generate in a similar way, because I suppose that, once you “merge” the meshes in one, the uv’s are shared.

Anyway, I think this could be the way to go. What do you think? :question: :question: :question:

The unify() method is basically the lower-level method used by methods like NodePath.flattenStrong().
It seems to me like your suggestion creates more problems than it solves. And if separate parts have different textures, they cannot be (as easily) merged into a single geom.

Well, I guess that I’ll go with separated meshes for clothes then.

At first, I’ll try with full body suits change to see what’s the hit on the performance, and then try with more parts.

Thanks for the help! :smiley: