Skip to content

Conversation

@dli7319
Copy link

@dli7319 dli7319 commented Oct 30, 2025

When a render target is set, threejs automatically change their shaders to output in Linear color space using linearToOutputTexel: https://github.com/mrdoob/three.js/blob/e04b9f7bd7f5b17103339d343168bfab2d6e0ace/src/renderers/WebGLRenderer.js#L2198

However, with Sparkjs, we need to manually set encodeLinear or else we get a washed out image like this:
image

With this option, we now have the option of setting sparkRenderer.defaultView.useLinearToOutputTexel = true; and the Spark fragment shader will automatically output in the correct color space the same way that three.js's built-in shaders do.

@dli7319
Copy link
Author

dli7319 commented Oct 30, 2025

@mrxz
Copy link
Collaborator

mrxz commented Oct 31, 2025

Changes seem correct, but I'm not too fond of introducing a new property. And there's something wasteful about converting the colour from sRGB to linear just to convert it back.

How about automatically setting the encodeLinear uniform in SparkRenderer based on the currentRenderTarget? That's what I did in #196, see Splat.ts#L311-L319.

@dli7319
Copy link
Author

dli7319 commented Oct 31, 2025

I see your PR has it covered. Thanks.

@dli7319 dli7319 closed this Oct 31, 2025
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