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

Is there any tutorial about the foreground blender rendering #32

Open
TurtleZhong opened this issue Jun 17, 2024 · 5 comments
Open

Is there any tutorial about the foreground blender rendering #32

TurtleZhong opened this issue Jun 17, 2024 · 5 comments

Comments

@TurtleZhong
Copy link

Hi, Thanks for the amazing work!
I am very curious about foreground rendering. I would like to ask if there are more materials and tutorials about blender rendering, or a standalone foreground rendering pipeline.
Thanks in advance!

@yifanlu0227
Copy link
Owner

yifanlu0227 commented Jun 17, 2024

Hi!

You can use the foreground rendering independently and we have updated some README of it. Please cd chatsim/foreground/Blender/utils and check chatsim/foreground/Blender/utils/README.md. The installation is no longer needed if you have installed ChatSim.

@yifanlu0227
Copy link
Owner

yifanlu0227 commented Jun 17, 2024

As far as I know, there is no systematic tutorial for blender with python, but the official API document We've also been implementing this part step by step to make it work. A good practice is to have a PC with display, and run the command without -b. This will reproduce everything with a blender GUI.

You can refer to official blender documentation, the blender community, StackOverflow and ChatGPT for help, and we'd be happy to answer any questions you might have when running our code.

@TurtleZhong
Copy link
Author

Hi!

You can use the foreground rendering independently and we have updated some README of it. Please cd chatsim/foreground/Blender/utils and check chatsim/foreground/Blender/utils/README.md. The installation is no longer needed if you have installed ChatSim.

Hi, follow the latest README in chatsim/foreground/Blender/utils/README.md, I can use blender --python blender_utils/main_multicar.py -- config/Wide_angle_test/ -- 0 -- 1 to open the blender UI, and I change the position of one car, rendering and I got 2 pictures like:
Image0001
vehicle_and_shadow_over_background0001

@TurtleZhong
Copy link
Author

Hi I have a new question about the blender rendering progress. I found the depth data is also needed in chatsim since I found the code here, also in your readme file depth: The depth of background. np.ndarray with dtype=float32, shape=[H, W]. Can be rendered results from NeRF. so I would like to know if depth information is necessary and what role it plays in the rendering process of blender?( may be depth check, Occlusion Detection). If there is no depth information, can the rendering process proceed normally?

@yifanlu0227
Copy link
Owner

Hi, there are two depth in our framework. one is background depth, and another is foreground depth.

foreground depth is a product of blender rendering. When you set depth_and_occlusion to true in the yaml, blender will generate the depth of the 3d assets in the current viewport. More specifically, they are the output of z-pass. They are stored like depth/vehicle_and_plane0001.exr, you can read .exr files with tev.

background depth are what we suppose users provide to realize occlusion-aware composition. If it's accurate enough and depth_and_occlusion is true, we do a depth test with the foreground depth, realizing the rendering effect of having the 3d assets occluded by something in the background. See the code here. If depth_and_occlusion is false, we simply paste the rendered foreground object on the background image. We also simplify this process by setting the background depth to infinity (e.g. scene_file: assets/scene-demo-1137/0.npz contains very large depth). After all, it is challenging to get an accurate background depth.

Come back to your question:

  1. Depth information is not necessary if you don't need occlusion. You can set depth_and_occlusion to false, or provide an infinite depth, both of which make the foreground always above the background.
  2. Depth information are used for occlusion-aware composition
  3. If no depth information is provided, you can still render normally.

See more discussion in issue27 and issue13.

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

2 participants