Import occlusion map
See original GitHub issue@julienduroure I’m curious if you would be willing to modify the importer to preserve an occlusion map using an empty custom node. For example, when occlusion is combined with metal/rough, perhaps the importer could produce something similar to this:
I think I’ve worked out the code for creating and using a node group like this. This is what I have so far:
# Put this definition somewhere common, it will likely change to "glTF Settings" or similar.
gltf_node_group_name = 'glTF Metallic Roughness'
# The following code runs per-material for materials with occlusion.
# Check if the custom node group already exists
if gltf_node_group_name in bpy.data.node_groups:
gltf_node_group = bpy.data.node_groups[gltf_node_group_name]
else:
# Create a new node grouping
gltf_node_group = bpy.data.node_groups.new(gltf_node_group_name, 'ShaderNodeTree')
gltf_node_group.inputs.new("NodeSocketFloat", "Occlusion")
gltf_node_group.nodes.new('NodeGroupOutput')
gltf_group_input = gltf_node_group.nodes.new('NodeGroupInput')
gltf_group_input.location = -200, 0
# Place a new node grouping in the current material
gltf_settings_node = bpy.data.materials[material_idx].node_tree.nodes.new('ShaderNodeGroup')
# Set the newly placed node grouping to be the glTF grouping
gltf_settings_node.node_tree = gltf_node_group
gltf_settings_node.width = 220
From there you would connect the R
channel of the occlusion image texture to the one socket on the new custom node.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Occlusion Map - Unity - Manual
An occlusion map is a greyscale image, with white indicating areas that should receive full indirect lighting, and black indicating no indirect lighting....
Read more >Can't import occlusion map in Mixer 2021 - Quixel
Can't import occlusion map in Mixer 2021. Completed. Follow. Johan M. 2 years ago. The option used to be there but with the...
Read more >unity - How to import a texture to be used as occlusion map?
I've been searching around in the manual and the web but still not sure if AO maps should be imported as Lightmaps. texture...
Read more >How to import texture to be used as Occlusion map?
The same way normal maps need to be imported as "Normal map" in the import settings, how should I setup an Ambient Occlusion...
Read more >Ambient Occlusion Painting | Substance 3D Painter
The result of this computation is stored in a bitmap named the "Ambient Occlusion" map. This map can be baked in the application...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
+1 for renaming this node to
glTF Settings
orglTF Export
.@emackey @donmccurdy I made a first draft on branch import_ao_node