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

Output encoding #8232

Merged
merged 10 commits into from
Feb 27, 2016
Merged

Output encoding #8232

merged 10 commits into from
Feb 27, 2016

Conversation

bhouston
Copy link
Contributor

This PR replaces the previous linear_to_gamma_fragment approach to output encoding with a more flexible system based on texture.encoding with backwards compatibility for WebGLRenderer.gammaOutput = true.

Similar to the previous PR #8117, this PR adds a new injected glsl function linearToOutputTexel that encodes output texels based on the encoding specified on the current WebGLRenderTarget, if there is one. This means that this PR supports any of the following output encodings:

  • Linear (non)
  • Gamma (using GAMMA_FACTOR)
  • sRGB
  • LogLuv
  • RGBE
  • RGBM7
  • RGBM16
  • RGBD

There is no additional render cost to this PR over the previous approach and it uses no uniforms.

Because background/fog colors in Three.JS currently are not gamma corrected, I have kept this behavior with complex encodings as well. Thus the encoding is applied prior to the fog interpolation, as it was before. This will screw up complex encodings like LovLuv, RGBE, RGBM and RGBD. Maybe I could have a warning in these cases that one shouldn't use fog in those cases. The future solution would be to eventually bring both the background color and fog colors into the encoding, so they are properly encoded like everything else.

@mrdoob
Copy link
Owner

mrdoob commented Feb 27, 2016

Looks good!

mrdoob added a commit that referenced this pull request Feb 27, 2016
@mrdoob mrdoob merged commit 5062677 into mrdoob:dev Feb 27, 2016
@mrdoob
Copy link
Owner

mrdoob commented Feb 27, 2016

Thanks!

@bhouston bhouston deleted the output_encoding branch March 14, 2016 13:45
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

Successfully merging this pull request may close these issues.

2 participants