Skip to content

Commit f75cbd1

Browse files
authored
Adjust OBJExporter to convert Linear colors to sRGB (#23374)
1 parent a2cc7c1 commit f75cbd1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

examples/jsm/exporters/OBJExporter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ class OBJExporter {
251251

252252
if ( colors !== undefined ) {
253253

254-
color.fromBufferAttribute( colors, i );
254+
color.fromBufferAttribute( colors, i ).convertLinearToSRGB();
255255

256256
output += ' ' + color.r + ' ' + color.g + ' ' + color.b;
257257

examples/misc_exporter_obj.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
} else if ( type === 6 ) {
131131

132132
const points = [ 0, 0, 0, 100, 0, 0, 100, 100, 0, 0, 100, 0 ];
133-
const colors = [ 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0 ];
133+
const colors = [ 0.5, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0.5, 0 ];
134134

135135
const geometry = new THREE.BufferGeometry();
136136
geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( points, 3 ) );
@@ -149,6 +149,7 @@
149149
function init() {
150150

151151
renderer = new THREE.WebGLRenderer();
152+
renderer.outputEncoding = THREE.sRGBEncoding;
152153
renderer.setPixelRatio( window.devicePixelRatio );
153154
renderer.setSize( window.innerWidth, window.innerHeight );
154155
document.body.appendChild( renderer.domElement );

0 commit comments

Comments
 (0)