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

How to render the optical flow information of the background? #1146

Open
jingziyou opened this issue Aug 16, 2024 · 1 comment
Open

How to render the optical flow information of the background? #1146

jingziyou opened this issue Aug 16, 2024 · 1 comment
Labels
first answer provided question Question, not yet a bug ;)

Comments

@jingziyou
Copy link

Describe the issue

key step1: load background image from haven_hdri, code as follows:
haven_hdri_path = bproc.loader.get_random_world_background_hdr_img_path_from_haven(path_dict['haven'])
haven_hdri_path = osp.join(assert_root,"HDRI_haven/hdris/altanka/altanka_2k.hdr")
print(f'Scene background file path is : {haven_hdri_path}')
bproc.world.set_world_background_hdr_img(haven_hdri_path, strength=0.3, rotation_euler=(0,0,0))
key step 2: render flow info, code as follows
data = bproc.renderer.render()
data.update(bproc.renderer.render_optical_flow(get_backward_flow=True, get_forward_flow=True, blender_image_coordinate_style=False))

The optical flow information in the background region is 0,What went wrong and what Settings should be added to render background optical flow?
0_colors_animation
0_forward_flow_animation

Minimal code example

haven_hdri_path = bproc.loader.get_random_world_background_hdr_img_path_from_haven(path_dict['haven'])
  haven_hdri_path = osp.join(assert_root,"HDRI_haven/hdris/altanka/altanka_2k.hdr")
  print(f'Scene background file path is : {haven_hdri_path}')
  bproc.world.set_world_background_hdr_img(haven_hdri_path, strength=0.3, rotation_euler=(0,0,0)) 

  data = bproc.renderer.render()  
  data.update(bproc.renderer.render_optical_flow(get_backward_flow=True, get_forward_flow=True, blender_image_coordinate_style=False))

Files required to run the code

No response

Expected behavior

The optical flow information in the background region is 0,What went wrong and what Settings should be added to render background optical flow?

BlenderProc version

v2.5.1

@jingziyou jingziyou added the question Question, not yet a bug ;) label Aug 16, 2024
@cornerfarmer
Copy link
Member

Hey @jingziyou,

blender does not support rendering the optical flow of the background. One thing you could do is calculate it by yourself: The background is basically on a sphere with infinite radius, so it should be possible to calculate the optical flow based on the camera poses.
Alternatively, you could try to add the hdri to an actual sphere object surrounding the object (see e.g. https://blender.stackexchange.com/questions/207023/how-add-hdri-image-on-sphere). In that way it should occur in the optical flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
first answer provided question Question, not yet a bug ;)
Projects
None yet
Development

No branches or pull requests

2 participants