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

Set correct alpha values for Renderer exported frames #857

Conversation

MathiasPaulin
Copy link
Contributor

  • Please check if the PR fulfills these requirements
  • The commit message follows our guidelines

Be aware that the PR request cannot be accepted if it doesn't pass the Continuous Integration tests.

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    When exporting an image captured from the Renderer, the alpha channel depends on the exported AOV and do not allow proper displaying of the picture due to alpha blending problems when some transparent objects were drawn.

This PR fix this by

  • modifying ForwardRenderer AOV initialization (Color::Alpha, e.g. {0, 0, 0, 0} instead of Color::Black, e.g. {0, 0, 0, 1}) so that there is no background in the AOV exported picture,
  • modifying the alpha-channel of an exported frame so that any alpha value greater than 0 is set to 1 while any 0 alpha value is preserved.

These two modifications allow to export png images with no background but solid color, even for transparent objects

  • What is the current behavior? (You can also link to an open issue here)

Exported frame has an alpha channel that depends on drawn objects

  • What is the new behavior (if this is a feature change)?

Exported frame has alpha value of 0 in the background but 1 for all drawn pixels.

  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

no

  • Other information:

@MathiasPaulin MathiasPaulin added enhancement Type of issue/PR: enhancement Engine Related to Ra::Engine Ready to review labels Jan 19, 2022
@MathiasPaulin MathiasPaulin linked an issue Jan 19, 2022 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Jan 19, 2022

Codecov Report

Merging #857 (37a568b) into release-candidate (3f98598) will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@                Coverage Diff                 @@
##           release-candidate     #857   +/-   ##
==================================================
  Coverage              27.30%   27.30%           
==================================================
  Files                    326      326           
  Lines                  21888    21888           
==================================================
  Hits                    5976     5976           
  Misses                 15912    15912           
Impacted Files Coverage Δ
src/Engine/Rendering/ForwardRenderer.cpp 0.00% <0.00%> (ø)
src/Engine/Rendering/Renderer.cpp 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a0b81a...37a568b. Read the comment docs.

@dlyr
Copy link
Contributor

dlyr commented Jan 19, 2022

I understand the problem, but I'm not fine with the solution of discarding alpha when writing file.
We should compute final alpha correctly, what is shown in the issue is that the lines' alpha are set as final value instead of blending with background alpha. As shown in the issue "expected" results, there are black borders around silhouettes wireframe lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Engine Related to Ra::Engine enhancement Type of issue/PR: enhancement Ready to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong alpha channel on exported frames from renderer
2 participants