-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved Alpha channel and Transparency for exporting JSON material #185
Conversation
_Images plugged into "Principled BSDF" 's Alpha will combine with Images at BaseColor as the alpha channel (Since Ogre use 1 image for both color and alpha). _More options for texture's BlendBlock, controlled by Blender's 3 Blend modes: * Alpha clip = just Blend Type: REPLACE * Alpha Blend = a BlendBlock with custom setting, very transparent * Alpha Hashed = a BlendBlock with custom setting but less transparent than Alpha Blend _There was plan for supporting other texture nodes aside from image, but I couldn't find a way to get the node's color matrices
Users now have another option to plug metalness and roughness textures into the corresponding channels, aside from using the same texture and separate RGB
this does not make sense. Alpha clip should map to alpha_rejection or whatever it is called in ogre next. Alpha Hashed must be equal to Alpha Blend. |
Yes, I think it is "alpha_test" in Ogre-next. About Alpha Hashed, I also thought its basically the same as Alpha Blend, so I made it have a different Blend type to make use of this slot. I can change it back to be the same as Alpha Blend tho. |
…AQUE _BLEND and HASHED generate the ssame settings now _CLIP only enable "alpha_test" _OPAQUE doesn't have alpha_test or transparency
…alue _If you plugged in an Alpha texture, but Principled BSDF's "Base Color" is not plugged in, a new diffuse image will be exported, with color channels from "Base color" values and Alpha channel from the alpha texture. _The new image will only have as many details as your Alpha texture, so it should be used on stuff with detailed Alphas but simple color channels - like hair cards _Quick fix: change the condition of combining diffuse texture and alpha texture (from different file names to different paths)
I also added in a feature that can combine alpha texture with "base color" value if there's no diffuse texture, so a setup like this: will give you this: The combined texture can be detailed (depends on the Alpha texture) but didn't look very good, so I combined the effects from metallic, roughness and normals. Here's what it looks like without these effects: This is a convenient way to create assets for users since all you really need is an image to use as Alpha texture, which doesn't even need the alpha channel since black/white image can use the color channel instead. So all the user need is 1 image, like so: |
sorry for not being clear previously: I think that we explicitly should not handle the cases that you are currently implementing, particularly:
and
this complicates code that needs to be maintained moving forward and is only specific to one usecase. This should rather be offloaded to the user before the exporter is run. Also note, that imagick presence is optional so you cannot rely on being able to use it for fixing things. The export should succeed even without imagick. |
OK, so only remove the alpha texture code right? |
The remaining utils are: _Blendblocks types support _Standalone metallic and roughness texture support
Changes were applied, please check to see if I missed anything. |
_Images plugged into "Principled BSDF" 's Alpha will combine with Images at BaseColor as the alpha channel (Since Ogre use 1 image for both color and alpha).
_More options for texture's BlendBlock, controlled by Blender's 3 Blend modes:
_There was also plan for supporting other texture nodes aside from image, but I couldn't find a way to get the node's color matrices
Edit: The image texture needs to be plugged in the "Value" input a "map range" node and then connect "Result" to the Alpha channel (like how metallic and roughness texture is plugged in through a "separate colore" node).
This is so that "Map range" 's "To Max" value can be used to modify the Transparency strength, which is determined by ["Transparency"]["value"] in the .material.json file.
Here's what my setup look like for combining Base Color texture and Alpha texture:
And here are the results for the 3 Blend mode setting:
*Alpha Clip
*Alpha Blend
*Alpha Hashed
Alpha Blend is very hard to see, but is definitely there