shrekshao / gltf-avatar-threejs

A glTF-based 3d avatar system
https://shrekshao.github.io/gltf-avatar-threejs/
MIT License
255 stars 73 forks source link

Question regarding skin visibility control #6

Closed jamesdeantv closed 4 years ago

jamesdeantv commented 4 years ago

To have skin visibility control, you need to have an extra texture called body id map, which labels an id number in R channel (0-255) for each part of the skeleton mesh. You can generate this by texture painting in blender, or export uv snapshot and paint in Photoshop, GIMP etc.

I am a bit lost. For me, a typical skeleton mesh includes a head, torso, arms, legs, eyes etc... Are you suggesting that for each mesh I add an addition material in the texture data slot?

Screen Shot 2019-11-23 at 1 04 11 PM

Where are the controls to

label... an id number in R channel (0-255)

Can you possibly show a screen shot of this step in blender? Even better, can you share an example blend file with basic setup ready?

shrekshao commented 4 years ago

I used only one mesh for the skin body. If you have multiple meshes for the pure skin, and all these separate meshes you need them to have visibility control, then yes. But in this particular case, Do you need to hide your eye meshes? I think even if you need to have a say sunglass, the glass would just occlude the eyes and likely the eyes won't have z-fighting issues

jamesdeantv commented 4 years ago

I snapped that screen shot as an example to ask how I should label the material. I won't be hiding the eye mesh. The armature I use in production is a standard humanoid mesh (head, legs, arms, torso etc.)

It is similar to this current setup except that once I successfully rig the armature to your library, I will move the clothing layers to a separate armature as per your instructions.

With that being said, the complete armature of the previous screen shot is as follows...

Screen Shot 2019-11-24 at 4 27 40 AM

So, I assume that I will add an additional material for each mesh layer.

Next, where, in blender, do I

label... an id number in R channel (0-255)

Here's the thing. I looked through the entire gltf-avatar-threejs repository and found no references to "body id map". I did, however, find references to bodyIdLUT. Is this the id that you used.

Im sure that I am simply misunderstanding a step in the process.

Let me know if I need to better explain my issue && Thanks for your assistance.

shrekshao commented 4 years ago

Here's the thing. I looked through the entire gltf-avatar-threejs repository and found no references to "body id map". I did, however, find references to bodyIdLUT. Is this the id that you used.

Yes bodyIdLUT is the thing.

label... an id number in R channel (0-255)

This is the body id map in my test model in the repo:

It's essentially a texture image. Each pixel of the image is consisted of RGBA channel. The R (red) channel value is treated as the body part id.

You can edit this texture in GIMP/PS, etc. Or directly use texture paint functionality in blender. Doesn't matter you which software you use to generate this image.

My old laptop with the blender project file is lost when it's stolen. I cannot post any blender screenshot unfortunately.

jamesdeantv commented 4 years ago

I've elaborated on this topic in a new post. So, I'll be closing this issue now. #7