godot-blender-exporter
godot-blender-exporter copied to clipboard
Blender2.80 - Transparency problem and washed out model.
OS: Linux
Godot version: Godot 3.1 beta 10 mono.
Blender version: 2f67c350e2591153efb3d00dfb789bdb01074271 (I think, installed via yay).
Issue description: I have a model created with MakeHuman, and want to export it to Godot. In previous versions on the master branch it worked fine. Now when working with Blender 2.8 I got issues with the materials and transparency. Also the model looks washed out. The transparency problem seems to be connected to the Transparent BSDF node. In the connected Mix Shader, which gets the Alpha Output from the Texture as Fac is set to 1.0 in the generated shader code. When I changed the variable to the Alpha in the shader it worked much better. Only having problem with the eyes and the washed out look.
Am I missing anything or having a wrong export option?
Old Code (lines 145 and 146):
EMISSION += textureLod(SCREEN_TEXTURE, SCREEN_UV - NORMAL.xy * uni2_refraction_offset, ROUGHNESS).rgb * (1.0 - var25_alpha);
ALBEDO *= var25_alpha;
New Code (lines 145 and 146):
EMISSION += textureLod(SCREEN_TEXTURE, SCREEN_UV - NORMAL.xy * uni2_refraction_offset, ROUGHNESS).rgb * (1.0 - var2_Alpha);
ALBEDO *= var2_Alpha;
Screenshot that show the problem:
How it looks in Blender:
Node setup:
How it looks in Godot with Materials applied, but shader code not fixed:
Comparison of old export (Blender 2.79, Windows and Godot 3.0.6 - the right variant is the washed out problem where I applied the materials and changed the shader code as shown above):
Export Options:
Well, I copied most of the shader generating code from 2.7 branch to 2.8, the only different thing between is the 'roughness' calculation in function node_bsdf_principled
. In 2.8 the sqrt
is removed because I saw some blender's change log. Maybe it is wrong.
blender2.8
blender2.79
could you try again with the latest blender2.8 branch in your convenience? The material exporting has been all reworked, I believe the alpha mixing is correct now.
Besides, the washout
issue, could you try to change the roughness
in the PrincipledBSDF as I mentioned above to see if the problem is solved? Really thanks
Hey, sorry for the long response time, busy times here. I've updated the repo to the latest version and tried to export with that. But now it looks even weirder.
It's hard to tell for me what the issue is exactly since I'm not very experienced with shader programming, especially in Godot. But there seem to be several problems.
First of all, I tested a bit with the
sqrt(roughness);
and it seems to have helped a little bit, but it still looks washed out.
But current problem is that everything looks like a mirror.
If I comment out refraction_fresnel(VERTEX, NORMAL, node6_shader_in11_ior, node6_var1_bsdf_alpha);
it helps a little, but transparency is not working at all then:
If I then replace the last line
ALPHA = 1.0;
with ALPHA = node1_out1_alpha;
it looks better again.
And finally, when I do the roughness change, very little noticable.
I only adapted the shader of the hair mesh for the screens here. Also I noticed that the texture shader parameter appears twice now in the shader.
I used the latest Beta from March 18th.
Thank you very much! A lot of useful information.
Ah, I made transparent principled BSDF to have glass effect, I should not do that..
Hey Jason, I've tested the latest version. the unmodified output looks a lot better. It's still washed out and the eye looks weird, but it's a step in the right direction and fixes the transparency issue.
Should I open a separate ticket for the washed out and eye thing?
One last question, the transparency on the rim of the hair can probably be improved?
Thanks for the help! :)
It's fine to follow up in this thread. Yeah, I have not find the causing of the wash-out problem, so it still need some fix and I will continue to look into it once I got some time.
For the eye's issue, could you give me some information about what is its material? it looks like a transparence issue, but I can not tell much from how it looks.
By the way do you change anything at the blender2.79 output?
( the left part of
I am pretty surprised myself that how good it looks, it could be an objective for the exporter.
Sure, so, first: For the 2.79 model I'm trying to retrace all my steps. I just remembered that I had some trouble with the materials. So I experimented a lot. Worst case I used the materials from one of the Better Collada exports, sorry. If you want I can try to retrace my steps. I still have the setup on my other OS and could try doing a new export.
About the eye: I can't figure out why it looks how it looks, the setup is simple.
Nodes:
Eye UV:
What I don't understand is, that in object mode the outline doesn't fit the vertices... Can't see any modifiers or other objects that might cause it:
It's straight from MakeHuman to Blender. So far the transparency node doesn't seem necessary. I might try removing it.
When removing the transparency it gives a funny Demon like look:
Sorry for the late response (Have been quite busy in last several weeks).
I found this post is very similar with the 'white eye' shown in Godot. According to it, there are two layers in the eye and the out layer is a transparent 'cornea'. The issue should be the on transparency of the'`cornea'. It actually explains
that in object mode the outline doesn't fit the vertices...
the outlier there is exactly the 'cornea' in the human eye.
I think it would be helpful if you can find both the Cycle material and the Godot shader script generated for the 'cornea'.
For the following alpha mixing node graph, I have carefully tested it, the current blender2.8
branch handles it correctly.