Skip to content
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

Improve our attempt at exporting SpatialMaterials. #341

Merged
merged 5 commits into from
Jun 5, 2020

Conversation

rcorre
Copy link
Contributor

@rcorre rcorre commented May 17, 2020

It still leaves a lot to be desired, but implements more than our current
approach.

What works:

  • Principled albedo, alpha, transparency metallic, roughness, anisotropy,
    emission, and clearcoat. Principled does not have emission strength, so we
    just assume 1.
  • Emission strength and color
  • Diffuse color and roughness.

Fixes #332.

I'm not sure how to set up the test to use the "Export as Spatial" option.
I thought in the past that the export settings were saved in the file,
but it keeps resetting for me now.

Ryan Roden-Corrent added 2 commits May 16, 2020 22:10
This improves our attempt at converting several material types
(Principled, Diffuse, and Emission) to SpatialMaterials. It still leaves
a lot to be desired, but implements more than our current approach.

What works:

- Principled albedo, metallic, roughness, anisotropy, emission, and
  clearcoat. Principled does not have emission strength, so we just
  assume 1.
- Emission strength and color
- Diffuse color and roughness.

Fixes godotengine#332.
Everywhere we currently export a color we use mathutils.Color, which
doesn't support alpha. This adds an RGBA type we can use to export
colors with alpha.

Maybe we could use this in other places, but I'm not sure the
implications right now.
@rcorre
Copy link
Contributor Author

rcorre commented May 17, 2020

Relates to godotengine/godot#34281. Currently ShaderMaterials don't create illumination in GIProbes, but SpatialMaterials do, so this is the only way to export scenes that use emissive materials for lighting.

@sdfgeoff
Copy link
Collaborator

sdfgeoff commented Jun 2, 2020

I'm not sure how to set up the test to use the "Export as Spatial" option.

If you create a file config.json it can override a specific exporter options for a folder. There's an example here: https://github.com/godotengine/godot-blender-exporter/tree/master/tests/test_scenes/scene_animation
(I'm sure at one point there was a way to do per-file rather than per-folder configuration, but that may have been something I implemented elsewhere)

@sdfgeoff
Copy link
Collaborator

sdfgeoff commented Jun 2, 2020

Probablyl better for @Jason0214 to review this, but nominally it looks good to me.

@@ -57,8 +57,57 @@ def export_material(escn_file, export_settings, bl_object, material):

def export_as_spatial_material(material_rsc_name, material):
"""Export a Blender Material as Godot Spatial Material"""
out = material.node_tree.get_output_node("ALL")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a check for node_tree, it can be None sometimes.
Other changes looks very good. Thank you very much!.

@Jason0214
Copy link
Collaborator

Thank you very much! I will fix the regression.

@Jason0214 Jason0214 merged commit 274f668 into godotengine:master Jun 5, 2020
@rcorre rcorre deleted the principled-to-spatial branch June 5, 2020 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SpatialMaterial exporter doesn't export any PBR channels
4 participants