-
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
Ogre Next (aka v2) JSON material support #178
Conversation
- Added ogre.materialsv2json module with dot_materialsv2json() with same usage as ogre.material.dot_materials() - Added config option MATERIALS_V2JSON to switch to v2 materials - Support for a metallic workflow only via PrincipledBSDFWrapper - Sets the diffuse, emissive, metalness, roughness, specular, transparency, alpha_test, two_sided and workflow as required - Leaves default the blendblock, macroblock, sampler, shadow_const_bias, brdf, detail_diffuse[x], detail_normal[x], detail_weight[x], fresnel, receive_shadows, reflection - Uses material.gather_metallic_roughness_texture() - Implements channel separation in util.image_magick()
831dad0
to
1d96662
Compare
How does this work? From what I have seen it seems that you check the option "MATERIALS_V2JSON" and now blender2ogre exports the OgreV2 material .json as well as a OgreV1 material definition. @paroj do you think that perhaps it would be better if it was a combo list selection? Something like material_output: ogrev1 / ogrev2json? Because it seems to me that if you are using Ogrev2 you're not using v1 and vice versa. |
The config variable stops the v1 generation at scene.py:196. If I defer to you two about whether it should be a picklist or not, I have no preference and would be willing to write the change. I also see the CI is failing. I have only tested this with Blender 3.5. It looks like Is there a desire to ensure compatibility with a specific version of Blender? If so is there a preferred way of handling features not usable in older versions? |
I don't know what is the official support list, but I think that at least the following versions should be supported:
So, there should be a check to see if I also think that the config variable to export the material version should be a picker. Let's see what @paroj thinks of this... |
CI must not fail. Therefore blender 2.82 must work for now.
Not use the feature - otherwise it is untested which equals to broken after some time |
Per review: - Check detect_converter_type() instead of config param - Remove MATERIALS_V2JSON config param - Remove emission_strength_texture support (Blender 2.9+ only) - Update README and MaterialsJSON.md to reflect changes
Updated branch as per review, using |
thanks |
Basic support for a metallic workflow producing OGRE Next JSON materials. Closes issue #148
Changes and dependencies outside of the new materialsv2json module:
material.gather_metallic_roughness_texture()
from PR Export Metal-Roughness maps #172, any change to that function will need to test JSON material export.util.image_magick()
. Done with a kwarg, so should have no impact.MATERIALS_V2JSON
and checks it insidescene.dot_scene()
.JSON Materials features:
See the notes in MaterialsJSON.md for the rational.
Metalness texture fetching expects a single image with the metal texture in the Blue channel and the roughness texture in the Green channel. The channels are expected to have been split via a 'Separate RGB' node before passing to the Principled BSDF. This is in line with the glTF standard setup. Doing something else will have sub-par results or simply fail. It can't handle more complicated node setups.
This code will always attempt an export but it will have poor results if given a specular workflow material.