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

Render Color Equation #143

Open
saptarshi1234 opened this issue Apr 17, 2023 · 1 comment
Open

Render Color Equation #143

saptarshi1234 opened this issue Apr 17, 2023 · 1 comment
Labels
invalid This doesn't seem right
Milestone

Comments

@saptarshi1234
Copy link

# Populate the background
if bg_color == 'white':
color = (1.0-alpha) + ray_colors
else:
color = alpha * ray_colors
rgb[ridx_hit] = color

I have a doubt in this section of the code.
When the background is white what is the interpretation of adding "ray_colors" to "(1-alpha)"?
Will this not make the value of "color" to more than 1?

@orperel
Copy link
Collaborator

orperel commented Apr 20, 2023

White background assumes the image was created with premultiplied alphas:
https://microsoft.github.io/Win2D/WinUI3/html/PremultipliedAlpha.htm

Specifically:
result = source.RGB + (dest.RGB * (1 - source.A))
but here dest.RGB is simply 1.0 due to white background.

This is only true if the data is compatible, and indeed the NeRFSyntheticDataset applies this fix, see here:
https://github.com/NVIDIAGameWorks/kaolin-wisp/blob/main/wisp/datasets/formats/nerf_standard_dataset.py#L426-L428

Are you seeing any bug here?
Thinking out loud here - maybe it makes sense to separate this param to actual "bg color" and "is_premultiplied_alphas"

@orperel orperel added the invalid This doesn't seem right label Apr 20, 2023
@orperel orperel added this to the Wisp 0.1.3 milestone May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants