Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MToon 1.0: Backfaces have flipped normals when double sided. #1022

Closed
lyuma opened this issue Jun 11, 2021 · 3 comments
Closed

MToon 1.0: Backfaces have flipped normals when double sided. #1022

lyuma opened this issue Jun 11, 2021 · 3 comments

Comments

@lyuma
Copy link
Contributor

lyuma commented Jun 11, 2021

Describe the bug

In MToon 1.0, if I set "Double Sided" to On, the back faces are using the normals of the front face. (So a skirt appears as if lit from below.)

MToon should add code to use VFACE or SV_IsFrontFace to display backface normals properly.

This bug is new to MToon 1.0, because the old MToon shader had a hack to flip normals which was incorrect. See also: Santarh/MToon#56

To Reproduce

  1. Open a project with UniVRM installed.
  2. Edit Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon.shader and remove Hidden/ from the shader name, so it can be selected on a VRM 0.0 model.
  3. Add AliciaSolid to the scene.
  4. Rotate the Directional Light to X=90 so the light comes directly from above. Turn Shadows Off on the light.
  5. Disable the cloth1 and cloth2 objects inside mesh in the hierarchy. (Alicia has both layers of the skirt as separate objects: disabling these objects allows us to simulate a single sided mesh)
  6. Open AliciaSolid_vrm-0.51.Materials folder, and shift click all the materials. Change the shader to VRM10/vrmc_materials_mtoon
  7. Select the alicia_wear material. Change Double Sided to On, and set Shade Color to black.

It will show the same shade of lighting on both the topside and the underside of the character's skirt.

Expected behavior

Ideally, the underside of the clothing will be darkened, and the topside will be lit, because the light comes from up.

Screenshots

If you follow the process above:
image

Here is a custom version of Alicia I made in Blender, to illustrate the problem more clearly:
MToon 1.0 - Cull Off has wrong normals

Environments (please complete the following information):

  • OS: Windows 10
  • Unity version: Unity-2018.4
  • UniVRM version: latest master: be9220c

Additional context

See my comment on the original MToon issue here: Santarh/MToon#56 (comment)

@Santarh
Copy link
Contributor

Santarh commented Jun 11, 2021

Thanks your report.

Yes, I know this issue because MToon1.0 is now WIP and has not been released.
At this stage, I prioritize the implementation of ideal specifications over Unity-specific behavior.

I will work on it.

@Santarh
Copy link
Contributor

Santarh commented Jun 11, 2021

I consider this VFACE fix on Unity 2017.4.28f1, too.
Because now UniVRM supports only Unity 2018.4 LTS or later ! 😄 😄 😄 😄

Santarh/MToon#56 (comment)

@Santarh
Copy link
Contributor

Santarh commented Jun 14, 2021

Fixed with #1024

@Santarh Santarh closed this as completed Jun 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants