johnzero7 / XNALaraMesh

Blender addon Import/Export XPS Models, Poses
517 stars 94 forks source link

Transparent Textures are White #9

Closed Gnates closed 6 years ago

Gnates commented 7 years ago

Hello, thank you for making this great addon. I'm still fairly new to Blender so it's possible I may have overlooked something. I'm using Blender 2.78.5 Hash: f9963f2 on Windows 7 64bit

In Blender Cycles, after importing XPS models to Blender, and converting materials to Cycles, the transparent textures become white in the Material Viewport Shading and sometimes in the Rendered Viewport Shading. Rendered Viewport Shading: https://i.imgur.com/ix4sgHY.jpg Material Viewport Shading: https://i.imgur.com/0hb1uEi.jpg Here is a recent XPS model I've tested: https://xcrofty.deviantart.com/art/The-King-of-Fighters-XIV-Mai-678059999

Also, I wasn't sure if I should make this a separate topic, but will XPStools incorporate Blender's new Principled Shader in the future?

Thank you for taking the time to read this, and thanks again for making this addon.

johnzero7 commented 7 years ago

Hi, glad you liked the addon :)

It's something weird that thing about the transparencies in the viewport. For example the transparency of the hair looks kinda fine. But the shading of the eyes or the eyebrows make the whole model transparent. If you align the model correctly, you can see whatever is behind thru the transparency. I don't have much experience in blender either. So I don't know if its a limitation of the viewport or a problem with the setup of the material. https://imgur.com/a/GOelf In this example you can see the grid behind the model.

The reflections, for example on the hair, were very wrong, so I updated the addon to make them a little better.

About adding a conversion to the Principled Shader... maybe. From what I see the PBR workflow uses similar textures, but they are not the same. For example the diffuse texture used in the classical workflow, in PBR are replaced by an albedo map. The difference between this 2 textures is that the albedo map does not contain shadows, AO, or any kind of shading information. So the textures used in XPS would not be the best to use in this new shader. But maybe the result would be good enough, or it could be convenient to have the nodes converted automatically if you intend to replace the textures. we'll see.

Gnates commented 7 years ago

I did a little render with low and bright lighting: https://gfycat.com/smoothdimpledhammerheadbird The reflection on the hair is better, but it seems a bit unusual under darker lighting. I guess I can take a shot at fixing it with the node editor, or maybe experiment with the principled shader.

The white transparency stuff in the Material Shading View is strange. I've tested quite a few XPS and FBX models, and they somehow end up with the white alpha regions in Material Shading View. I want to animate XPS/FBX models, but sometimes the white transparency stuff can be a little annoying, especially when animating facial expressions. Ofcourse this is probably something outside the range of XPStools, so hopefully the Blender devs have an idea.

Found this old bug report, which might be related: https://developer.blender.org/T45789

johnzero7 commented 7 years ago

Found another error in the converter, again, the reflection should look a little better now.

Still, there are 2 thing that you should keep in mind:

  1. In XPS the render group use for the hair is emissive. For this reason, if you set the lighting to 0 in XPS, you will still see the reflection. When the model is imported to Blender it is also set as emissive. You will need to manually disable the emission before or after the cycles conversion.
  2. In cycles the emission node does not have a normal input. So if you have the emission enable it will not look right.
Gnates commented 7 years ago

Ah, the emissive node was enabled. Thank you John. I still have a lot to learn, haha. The auto-updater for the addon failed to update. It might be because the new update version number didn't change, v1.7.3. I downloaded/installed the new update from your release page instead. I caught a spelling error in the XPStools menu (T-Menu): Materia Converter Material Converter Thank you for your help and patience. Since I frequently import different XPS models into Blender, is there anything you want me to look out for in the future that can help with XPStools updates? I'm mostly clueless about 3d modeling, shaders, textures, python etc., but I can try providing feedback as much as I can.

johnzero7 commented 6 years ago

I investigated a little more this problem and it seems its a blender issue they just leaned to live with. Implemented a slight improvement that make the transparency work better against opaque materials, but the issue remains against other transparent materials. A downside to this solution is that the transparent material does not highlight the object in the transparent areas when is selected or the active object.

What I did was check the property "Transparency" in the object properties when it has material with transparency ( Object->Display->Transparency )

Other than that you could try playing with User preferences -> System -> OpengGL -> Clip Alpha.