-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
SVGLoader Example: Use srgb output in the svg example #23280
Conversation
As you proposed in #23272, I think it makes more sense to add the color conversion in the loader directly (inside |
It seems it is indeed sRGB: The specification we've been following is SVG 2: Which points to the CSS3 specification of color:
So I agree it must be done in the loader. My only reason for not doing that is SVG can be used for not rendering purposes. For example it is not uncommon to code the strength of a laser cut path into the color, when using the SVG in a CNC laser cutting machine. |
What could go wrong... 😁 |
I guess it can be re-converted to sRGB in that case. |
Is it possible to do this generally? It looks like the const fillColor = path.userData.style.fill;
// ...
const strokeColor = path.userData.style.stroke; Certainly we can convert |
Yeah, I can see that. I guess the SVGLoader it's a bit of an exception yes... Okay, I'll merge as it is. |
Thanks! |
Related issue: #23272
Description
Converts the SVGLoader example page to use sRGB output rather than Linear. I'll note that given that MeshBasicMaterials and therefore no lighting is being used it could be considered more optimal to leave the demo as-is but for the sake of encouraging users to generally use the correct workflow this seems like a good change?
https://raw.githack.com/gkjohnson/three.js/linear-svg-colors/examples/webgl_loader_svg.html
I was taking a look at ColladaLoader and OBJLoader, as well. It doesn't look like there's very explicit documentation on color spaces for these formats and they're more specification by convention. Given that our demos don't adjust the default output color space for the renderer it seems like the assumption is that the textures and colors are sRGB. Is there any evidence or example models that show this isn't always the right thing to do?
cc @donmccurdy @WestLangley @Mugen87