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

[BUG]: wrong backward optical flow when set output_format to OPEN_EXR #684

Closed
eugenelyj opened this issue Sep 5, 2022 · 4 comments · Fixed by #963
Closed

[BUG]: wrong backward optical flow when set output_format to OPEN_EXR #684

eugenelyj opened this issue Sep 5, 2022 · 4 comments · Fixed by #963
Assignees
Labels
bug Something isn't working

Comments

@eugenelyj
Copy link

General Information

  1. Which BlenderProc version are you using?
    Blender 3.1.0

  2. On which operating system are you?
    Ubuntu 18.04

To Reproduce

Add one line code in "examples/advanced/optical_flow/main.py", before "bproc.renderer.render_optical_flow"

bproc.renderer.set_output_format("OPEN_EXR", 16)

Correct:
Screenshot from 2022-09-05 20-53-56

Wrong:
Screenshot from 2022-09-05 20-54-32

Guess for the Reason
Screenshot from 2022-09-05 20-46-22

I observed that the logs show bwd_flow twice even under normal conditions. And in a wrong condiction (that is, set output format to OPEN_EXR), the second one will override the first one, which i guess is the reason why the bwd_flow gets wrong.

Screenshot from 2022-09-05 20-46-00

@eugenelyj eugenelyj added the bug Something isn't working label Sep 5, 2022
@themasterlink themasterlink self-assigned this Sep 5, 2022
@themasterlink
Copy link
Contributor

themasterlink commented Sep 5, 2022

Hey,

thanks for this bug report. What an interesting bug. The reason is really weird, so if we check out the compositor settings right before the optical flow is rendered, we can see the forward and the backward settings and an additional node at the top. This node at the top is weird it shouldn't be there, as we are not interested in the colors in this particular render call.

Bildschirmfoto von 2022-09-05 15-30-02

So, if I add some code to remove it:

class _FlowRendererUtility():

    @staticmethod
    def output_vector_field(forward_flow: bool, backward_flow: bool, output_dir: str):
        """...."""
        tree = bpy.context.scene.node_tree
        links = tree.links

        # remove the output composite node
        output_node = tree.nodes.get("Composite")
        if output_node:
            tree.nodes.remove(output_node)

The node vanishes, but blender still rendered this color image. I have no clue why. I assume that blender has to render this data to disc, and we can not turn it off. The best fix is to name this file something different so that there is no overwriting happening even if someone changes the output format.

RendererUtility.render(temp_dir, "bwd_flow_", None, load_keys=set())

This needs to be replaced with: (I have no clue why it even says here "bwd_flow_")

        # this image is only rendered as blender provides no option to turn this off
        temp_flow_name = "img_flow_temp_ignore_me_"
        RendererUtility.render(temp_dir, temp_flow_name, None, load_keys=set())

@cornerfarmer Do you have an idea how to turn this off?

Best,
Max

@themasterlink
Copy link
Contributor

This was fixed.

@eugenelyj
Copy link
Author

@themasterlink Hi, I have pulled the latest code but found that the backward flow is still wrong using the above code.

@cornerfarmer
Copy link
Member

You are right, somehow this was missed. Now it should be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants