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 change background color of the pytorch3d rendering results? #1841

Open
yejr0229 opened this issue Jul 24, 2024 · 4 comments
Open

How to change background color of the pytorch3d rendering results? #1841

yejr0229 opened this issue Jul 24, 2024 · 4 comments

Comments

@yejr0229
Copy link

yejr0229 commented Jul 24, 2024

I want to change the background color of the rendering image form image1 to image2:
image
image

and I try to modify th parameters here:
image

But the results looks wrong:
image
How to do it correctly?

@bottler
Copy link
Contributor

bottler commented Jul 24, 2024

You need to find in the code where you construct a BlendParams instance, and set the value you want there. It may be explicit, or it may be defaulted somewhere. Can you paste the code where you call the renderer?

@yejr0229
Copy link
Author

image
and the BlendParams:
image

@bottler
Copy link
Contributor

bottler commented Jul 24, 2024

To avoid modifying pytorch3d but change the background color, you can change the blend_params=BlendParams() in your code to blend_params=BlendParams(background_color=(0.4,0.5,0.6)) or whatever.

EDIT: This isn't the real question.

@bottler bottler closed this as completed Jul 24, 2024
@bottler bottler reopened this Jul 24, 2024
@bottler
Copy link
Contributor

bottler commented Jul 24, 2024

The image that looks "wrong" seems to have the background color applied to the foreground. I wonder if there's a problem with the znear or zfar values: you want the object to be between them. You can add znear and zfar as float inputs to the shader, or use ones in the camera.

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