UuuNyaa / blender_mmd_tools

MMD Tools is a blender addon for importing/exporting Models and Motions of MikuMikuDance.
GNU General Public License v3.0
1.94k stars 92 forks source link

Refurbish default shader #67

Open UuuNyaa opened 1 year ago

UuuNyaa commented 1 year ago

New default shader

https://user-images.githubusercontent.com/70152495/190411840-7d28a731-5464-47ff-9040-279340331c1d.mp4

Old default shader

https://user-images.githubusercontent.com/70152495/190411865-93af3f6f-78e5-4e22-ac68-166dd3c78d41.mp4

UuuNyaa commented 1 year ago

Support in Blender 3.3 LTS or later, because it depends on Combine Color and Separate Color.

nagadomi commented 1 year ago

In Blender 3.3, when a material includes Shader To RGB, SSS and SSR effects disappear. (There have been several reports on this breaking change, but it is unlikely to be fixed.) So including Shader To RGB in MMDTexUV may cause problems when creating PBR materials for rendering with Blender. This is not a problem of mmd_tools, but I guess this problem also happens with your blender_mmd_uuunyaa_tools.

UuuNyaa commented 1 year ago

Thanks for the comment 😃 I had assumed that someday the development team would fix this issue, but it appears I was wrong.

https://docs.blender.org/manual/en/latest/render/shader_nodes/converter/shader_to_rgb.html

Using this conversion breaks the PBR pipeline and thus makes the result unpredictable when used in combination with effects such as ambient occlusion, contact shadows, soft shadows and screen space refraction.

Do you know a good way to acquire the surface color and intensity of lighting?

nagadomi commented 1 year ago

but it is unlikely to be fixed.

This is just my opinion. I have posted related issues but have not received any positive replies.

Do you know a good way to acquire the surface color and intensity of lighting?

I am not very familiar with shader. One way is to implement a Half-Lambert Shader on Shader Editor, but it would be difficult to synchronize a complex scene with multiple lights. I think a simple workaround is to add a color output to MMDShderDev that does not use ToonUV (ToonTexture) and use that if SSS is needed.

UuuNyaa commented 1 year ago

@nagadomi Thanks for the answer. I will try to figure out a way.

nagadomi commented 1 year ago

In Blender 3.3, when a material includes Shader To RGB, SSS and SSR effects disappear. (There have been several reports on this breaking change, but it is unlikely to be fixed.)

This issue is now fixed in blender's master and blender-v3.4-release branch. I do not know if it will be fixed in 3.3.

https://developer.blender.org/D16533

Edit: This is fixed when the MixShader factor is 0. I think the problem is not fixed in the above shader node.

UuuNyaa commented 1 year ago

@nagadomi Thanks for the information 😃