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

Models look grey in shadow in Blender exports with shade texture unassigned #36

Open
lyuma opened this issue Mar 14, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@lyuma
Copy link
Member

lyuma commented Mar 14, 2022

Here is an example showing the issue. This affects VRM models with no _ShadeTex set in a MToon material:
Karin by komado, showing versions with shade texture, no shade texture, and buggy shader on right
Left = both main & shade texture are set.
Middle = only main texture, with bug fix.
Right = only main texture, current state.

There was a line commented out in mtoon*.shader. Uncommenting this line seems to fix the issue:

	shade = min(shade, lit); ///// Mimic look of non-PBR min() clamp we commented out below.

I'm not sure why this line was left commented. I wrote it as a workaround to avoid taking min() of the final lighting output (to avoid the clamped lighting problems we commonly see in VRChat and LDR platforms)

The reason we haven't encountered this before is this only causes problems on models with Lit texture assigned but Shade texture unassigned. The Unity shader inspector for MToon automatically assigns shade texture. Blender export, however, does not... which is really a bug with the VRM addon for Blender.

Also, with this change, materials will look more bland when shade texture is unassigned, because the min() happens after multiplication with shade color, rather than before.... but I tested in Unity and see the same behavior there so I think it's correct:
ShadeTex assigned vs unassigned in Unity

It might also be worth filing a bug against VRM-Addon-for-Blender, since these generated materials will have very bland shading which the author probably did not intend.

@lyuma
Copy link
Member Author

lyuma commented Aug 3, 2023

This issue was really a problem with the asset creation flow, and not an issue with the importer.

As far as creation workflow, I think this has been addressed upstream in the Blender tooling (And UniVRM already made this easy to get right), so I'm not sure if we have any issue to solve related to import. Assets in the wild do not have this problem, just the ones I created by hand using an unusual workflow.

Note that since Godot has VRM export, the same issue is possible there. We also should probably add a workflow for conversion between Standard and MToon shader (and back).

When we do this, then it would be an appropriate point in such workflow to duplicate the Lit texture to the Shade texture slot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants