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

Albedo Pass Not Correct #31

Open
bikemurt opened this issue Aug 12, 2023 · 3 comments
Open

Albedo Pass Not Correct #31

bikemurt opened this issue Aug 12, 2023 · 3 comments

Comments

@bikemurt
Copy link

bikemurt commented Aug 12, 2023

When trying to bake out Albedo, Metallic (custom pass), Roughness and Normal, the Albedo won't appear correct.
image

See the albedo image with the red box is "washed out" or not as bright. That's what BakeLab2 produces compared to a manual bake I did (on top).

This is a known bug in Blender and happens when manually baking as well. The workaround is to temporarily set Metallic to zero on the Principled BSDF.

Would it be possible to temporarily set the metal channel to 0 while baking the Albedo with this tool?

It's simple and would be exactly what I need except for this issue. I may try to fix it myself and if so will put in a PR, or at least post a comment here with my change.

Edit: Also tried the Diffuse channel and a custom channel with "Color,Base Color,Albedo,Paint Color" selected. No change

@bikemurt
Copy link
Author

bikemurt commented Aug 12, 2023

Since the workflow seems to be:
Iterate through all selected objects -> Select obj -> Reserve Materials (copy material slots) -> Prepare Materials -> Bake -> add bake map -> restore materials,

I think a change would be needed on the Prepare Materials, to somehow set the metallic to zero only during the Albedo pass:

    def PrepareMaterials(self, context, dst_obj, src_obj_list, map, bake_image):
        active_obj = context.active_object
        selected_objects = context.selected_objects
        
        for obj in src_obj_list:
            SelectObject(obj)
            if len(obj.material_slots) == 0:
                bpy.ops.object.material_slot_add()
            for slot in obj.material_slots:
                if slot.material is None:
                    slot.material = self.GetEmptyMaterial()
                mat = slot.material
                mat.use_nodes = True
                
                if map.type == 'CustomPass':
                    if map.deep_search:
                        self.ungroup_nodes(mat.node_tree)
                    self.passes_to_emit_node(mat, map.pass_name)
                if map.type == 'Albedo':

## Set Metallic of this material slot to zero ##

                    self.ungroup_nodes(mat.node_tree)
                    self.passes_to_emit_node(mat, 'Albedo,Color,Base Color,Col,Paint Color')
                if map.type == 'Displacement':
                    self.displacement_to_color(mat)

@bikemurt
Copy link
Author

If anyone with some Blender/python/node knowledge knows how to do this that would be wonderful

@bikemurt
Copy link
Author

See PR
#32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant