godot-blender-exporter icon indicating copy to clipboard operation
godot-blender-exporter copied to clipboard

Blender2.80 - Transparency problem and washed out model.

Open Skalli opened this issue 5 years ago • 8 comments

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: blender Node setup: nodeeditor How it looks in Godot with Materials applied, but shader code not fixed: godot 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): comparison Export Options: export options

Skalli avatar Mar 04 '19 23:03 Skalli

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 image

blender2.79 image

Jason0214 avatar Mar 14 '19 20:03 Jason0214

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

Jason0214 avatar Mar 17 '19 06:03 Jason0214

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.

New export 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: no_fresnel If I then replace the last line ALPHA = 1.0; with ALPHA = node1_out1_alpha; it looks better again. alpha_change And finally, when I do the roughness change, very little noticable. sqrt roughness

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.

Skalli avatar Mar 18 '19 22:03 Skalli

Thank you very much! A lot of useful information.

Ah, I made transparent principled BSDF to have glass effect, I should not do that..

Jason0214 avatar Mar 18 '19 23:03 Jason0214

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.

image

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! :)

Skalli avatar Mar 27 '19 20:03 Skalli

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 outputs I am pretty surprised myself that how good it looks, it could be an objective for the exporter.

Jason0214 avatar Mar 27 '19 20:03 Jason0214

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 Nodes Eye UV: 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: Eye Object 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: DemonLook image

Skalli avatar Mar 27 '19 23:03 Skalli

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. image

Jason0214 avatar Apr 16 '19 05:04 Jason0214