powroupi / blender_mmd_tools

mmd_tools is a blender addon for importing Models and Motions of MikuMikuDance.
GNU General Public License v3.0
1.8k stars 277 forks source link

Should MMD Tools be changing nodes on edits to MMD Texture or MMD Material? #300

Open nathanvasil opened 4 years ago

nathanvasil commented 4 years ago

I don't think it should.

I was just preparing a model for export, which has a bunch of custom Blender materials, which I want to keep because I don't have final texture bakes and because I'd like to preserve mats for rendering in Blender when desired, but I wanted to get some baseline mats for the MMD export, so was setting up values for MMD Texture and MMD Material-- and then I looked, and it had changed my Blender nodes, so I had to go fix all those.

I don't know what purpose is intended. If the plan is rendering in Blender, it doesn't make any sense to edit MMD Material or MMD Texture properties, as anything you can do there, you can do better by editing your nodes directly; the only reason that I can see for these properties to exist is to provide values for export.

If people really do want to update from the MMD values, it's my understanding that the "convert materials" operation will do that for them anytime they want.

ptrthomas commented 4 years ago

+1 to this. I'm one of those who wants to continue in the "Blender World" after import

on a side note can someone educate me on what happens when you click "Shadeless" and GLSL - because then the nodes don't seem to work, so now I guess it is the MMD Material stuff that "takes over". is that right ? my objective is to tweak those, so any tips on how / where in the code this is would be great

Lutiel-Seraphiria commented 4 years ago

Nice to meet you. I am a private MMD model maker. First of all, I would like to add a few words.This is a machine translation from Japanese to English.

I have been a great help to mmd_tools and I am grateful for it. Even if it was a paid add-on, I would normally just buy it and use it.

I have a similar request as nathanvasil, Esq.

I'm having a problem with my own Toon shader in Blender, when I change some settings in MMD Material of mmd_tools, the shader node is automatically replaced by MMDShaderDev.

Can you implement this switching function to automatically build a shader node or not?

It's just that much more useful. It doesn't help in GLSL or Shadeless mode. I want to use my own shader nodes in Blender to get them closer to what they look like in MMD.

In the MMD Material section, just like in the days of Blender 2.79, the PMX I want to use it as a setting for exporting.

Could you please consider the automatic generation of shader nodes?

So, thank you very much.

nagadomi commented 4 years ago

In my opinion, it would be nice if there was a checkbox to synchronize or not to synchronize material settings with the shader nodes.

@Lutiel-Seraphiria Currently there is a way to edit the MMDShaderDev and MMDTexUV nodes that mmd_tools uses for materials and save them in a startup file https://github.com/powroupi/blender_mmd_tools/issues/248#issuecomment-534549539.

The following is the explanation in Japanese with my words. mmd_toolsで独自のシェーダーを使う(エクスポートにMMD Materialも使う)

powroupi commented 4 years ago

If people really do want to update from the MMD values, it's my understanding that the "convert materials" operation will do that for them anytime they want.

"convert materials" only converts materials which don't use nodes and it use 'MMDBasicShader', 'MMDAlphaShader', and Blender (Blender Internal renderer) material properties.

"convert model" will convert Blender material properties to MMD material properties.

Changing MMD material properties will update (Blender Internal renderer) material properties on Blender 2.7x, material nodes on Blender 2.8x, and viewport material properties.

Currently MMD material properties doesn't contain Base Texture and Sphere Texture information. We need to add those properties to MMD Material (and fix compatibility issue as well) to avoid updating Blender material properties:

what happens when you click "Shadeless" and GLSL

The code is in mmd_tools/operators/view.py

In my opinion, it would be nice if there was a checkbox to synchronize or not to synchronize material settings with the shader nodes.

I think it's a User Experience design issue. What's the default behavior? Will it be better to enable/disable the checkbox everytime users want or don't want to update material settings for each material? Should we update all MMD material settings to keep every settings synchronized on synchronize being enabled? Or do we need to add 2 function [Blender to MMD] & [MMD to Blender] for MMD materials? I think we need a clear design without blindly adding /changing features. :sunglasses:

nathanvasil commented 4 years ago

Thanks, I see. So the issue is with the texture. And I see now, after I fixed all my materials, deleting the nodes it added, it went back and deleted the textures I entered into the texture fields, because that's how those fields are stored.

It may be the case that material settings aren't auto-updating the materials, just texture changes (I think of textures are being a property of materials, not something parallel with materials-- the old BI way of doing things never really clicked for me and I've always been using nodes.)

It does seem like it would be smart to have texture fields as custom data, as part of MMD material values. MMD rendering and Blender rendering are just so totally different, it would be nice not to have these texture values stored in information that Blender uses to render. Although now I see that I could probably just leave the named node groups, unlinked to anything, and the only cost would be some node clutter. There are probably some other ways MMD could handle it, without changing the fundamental structure-- like, instead of creating new node trees, edit existing node trees with the same name, and if none exist, then just make the nodes, don't make the connection to the Material Output node. That way, it wouldn't replace existing materials.

Doing automatic updating of viewport stuff is something I don't really care about one way or another. I change my viewport to be what I need it to be for whatever I'm working on anyways, I'm almost never in a textured or material solid preview.

It's true that, in a lot of ways, MMD Tools is trying to be the complete way for people to render MMD models in Blender at the same time that it's the complete way for people to export Blender models to MMD. Those are two very different things that it's doing, and ideal interfaces for each would be different. At the same time, trying to implement any kind of split between those functions sounds like a lot of work, with the potential for a lot of unanticipated problems, and MMD Tools works very very well without any changes at all :)

nagadomi commented 4 years ago

My suggestion was simply to disable relinking MMDShaderDev to the output node by a global flag in the scene custom properties. (MMDShaderDev and other settings are updated as normal.) I usually make two materials, one for baking textures and one for exporting. I'm currently changing it manually, but once mmd_tools stops relinking the output node, I can switch materials by changing the mix shader's factor value using the scene's properties and drivers.

However, when I implemented this function now, I realized that if the output of MMDShaderDev is linked to another node, it will not be relinked to the output node. :sweat:

So we can already create a material switcher like this: material_switcher

Lutiel-Seraphiria commented 4 years ago

I understand that there are various technical problems. The problem of confusing nodes is certainly serious.

However, is it too difficult to add just that kind of check box function to reconnect the shader node or not? (In the first place, I don't understand why it is reconnecting arbitrarily.)

Please be aware that I am not very familiar with programming skills, so I am not very familiar with them.

powroupi commented 4 years ago

In the first place, I don't understand why it is reconnecting arbitrarily.

I think that users can better understand the appearance of the model on MMD when adjusting the MMD material properties in Blender, it should be intuitive.

I'm not sure which links you don't want to be reconnected, but currently you can use @nagadomi's technique to workaround this issue. You can also link inputs (Tex, Alpha) of MMDShaderDev to another node to prevent reconnecting those links.

If you are not intend to export model to MMD, you could just ignore MMD material properties, only tweak Blender's material properties should be enough. Another way is to save 2 versions of your .blend file, one for Blender only, one for MMD only. (Mixed version would be troublesome for users and developers. :cry:)