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

OBJExporter: Convert Linear vertex colors to sRGB #23374

Merged
merged 1 commit into from
Jan 31, 2022

Conversation

gkjohnson
Copy link
Collaborator

@gkjohnson gkjohnson commented Jan 29, 2022

Related issue: #23283

Description

Convert colors to sRGB before OBJ Export. It looks like OBJExporter was only including colors for points instead of triangles.

https://raw.githack.com/gkjohnson/three.js/obj-export-color/examples/misc_exporter_obj.html

Note that because colors are converted now it's possible that the final color value is formed from a long decimal value:

v 0 0 0 0.7353606352856507 0 0
v 100 0 0 0.7353606352856507 0 0
v 100 100 0 0 0.7353606352856507 0
v 0 100 0 0 0.7353606352856507 0

Is there a quick way to truncate that to 4 or 5 decimal places? I only know of parseFloat( color.r.toFixed( 4 ) ) which works but seems a bit roundabout. Or do we need to do that? It looks like the positions are not truncated in any way.

@gkjohnson gkjohnson changed the title OBJExporter: Convert Linear colors to sRGB OBJExporter: Convert Linear vertex colors to sRGB Jan 29, 2022
@Mugen87 Mugen87 added this to the r138 milestone Jan 31, 2022
@mrdoob
Copy link
Owner

mrdoob commented Jan 31, 2022

Is there a quick way to truncate that to 4 or 5 decimal places? I only know of parseFloat( color.r.toFixed( 4 ) ) which works but seems a bit roundabout. Or do we need to do that?

I don't think we need to truncate them no...

@mrdoob mrdoob merged commit f75cbd1 into mrdoob:dev Jan 31, 2022
@mrdoob
Copy link
Owner

mrdoob commented Jan 31, 2022

Thanks!

@gkjohnson gkjohnson deleted the obj-export-color branch January 31, 2022 19:20
donmccurdy pushed a commit to donmccurdy/three.js that referenced this pull request Mar 10, 2022
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.

3 participants