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

WebGLRenderer: Rename outputEncoding to outputColorSpace. #23936

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/api/en/renderers/WebGLRenderer.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ <h3>[property:Object extensions]</h3>
</ul>
</p>

<h3>[property:number outputEncoding]</h3>
<p>Defines the output encoding of the renderer. Default is [page:Textures THREE.LinearEncoding].</p>
<h3>[property:number outputColorSpace]</h3>
<p>Defines the output colorspace of the renderer. Default is [page:Textures THREE.LinearEncoding].</p>
Mugen87 marked this conversation as resolved.
Show resolved Hide resolved
<p>If a render target has been set using [page:WebGLRenderer.setRenderTarget .setRenderTarget] then renderTarget.texture.encoding will be used instead.</p>
<p>See the [page:Textures texture constants] page for details of other formats.</p>

Expand Down
2 changes: 1 addition & 1 deletion docs/api/zh/renderers/WebGLRenderer.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ <h3>[property:Object extensions]</h3>
</ul>
</p>

<h3>[property:number outputEncoding]</h3>
<h3>[property:number outputColorSpace]</h3>
<p>定义渲染器的输出编码。默认为[page:Textures THREE.LinearEncoding]</p>
<p>如果渲染目标已经使用 [page:WebGLRenderer.setRenderTarget .setRenderTarget]、之后将直接使用renderTarget.texture.encoding</p>
<p>查看[page:Textures texture constants]页面以获取其他格式细节</p>
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/en/loaders/GLTFLoader.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ <h2>Textures</h2>
in linear colorspace, always configure [page:WebGLRenderer] as follows when using glTF:</p>

<code>
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;
</code>

<p>GLTFLoader will automatically configure textures referenced from a .gltf or .glb file correctly, with the
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/zh/loaders/GLTFLoader.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ <h2>纹理</h2>
颜色空间并显示在屏幕上。除非你需要使用线性颜色空间进行后期处理,否则请在使用glTF的时候将[page:WebGLRenderer]进行如下配置:</p>

<code>
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's OK with me to keep this for another PR but I do think it's important that we make sure .outputColorSpace accepts the color space enum values, within the same release as this PR.

Optionally — we could change the values of the encoding enums, such that THREE.sRGBEncoding and THREE.LinearEncoding are interchangeable with their color space equivalents, during the transition.

</code>

<p>假设渲染器的配置如上所示,则GLTFLoader将可以正确地自动配置从.gltf或.glb文件中引用的纹理。
Expand Down
6 changes: 3 additions & 3 deletions docs/manual/en/introduction/Color-management.html
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ <h3>Input color space</h3>
<blockquote>
<p>
⚠️ <i><b>WARNING:</b> [page:Scene.fog], [page:Scene.background], and [page:WebGLRenderer.setClearColor]
are exceptions to the rule. These properties are unaffected by [page:WebGLRenderer.outputEncoding]
are exceptions to the rule. These properties are unaffected by [page:WebGLRenderer.outputColorSpace]
and so must store RGB components in the renderer's <u>output</u> color space.</i>
</p>
</blockquote>
Expand All @@ -219,11 +219,11 @@ <h3>Output color space</h3>
<p>
Output to a display device, image, or video may involve conversion from the open domain
Linear-sRGB working color space to another color space. This conversion may be performed in
the main render pass ([page:WebGLRenderer.outputEncoding]), or during post-processing.
the main render pass ([page:WebGLRenderer.outputColorSpace]), or during post-processing.
</p>

<code>
renderer.outputEncoding = THREE.sRGBEncoding; // optional with post-processing
renderer.outputColorSpace = THREE.sRGBEncoding; // optional with post-processing
</code>

<ul>
Expand Down
2 changes: 1 addition & 1 deletion docs/scenes/material-browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@
const renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;
document.body.appendChild( renderer.domElement );

const pmremGenerator = new THREE.PMREMGenerator( renderer );
Expand Down
2 changes: 1 addition & 1 deletion editor/js/Sidebar.Project.Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function SidebarProjectRenderer( editor ) {
function createRenderer() {

currentRenderer = new THREE.WebGLRenderer( { antialias: antialiasBoolean.getValue() } );
currentRenderer.outputEncoding = THREE.sRGBEncoding;
currentRenderer.outputColorSpace = THREE.sRGBEncoding;
currentRenderer.physicallyCorrectLights = physicallyCorrectLightsBoolean.getValue();
currentRenderer.shadowMap.enabled = shadowsBoolean.getValue();
currentRenderer.shadowMap.type = parseFloat( shadowTypeSelect.getValue() );
Expand Down
2 changes: 1 addition & 1 deletion editor/js/libs/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var APP = {

var renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio ); // TODO: Use player.setPixelRatio()
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;

var loader = new THREE.ObjectLoader();
var camera, scene;
Expand Down
2 changes: 1 addition & 1 deletion editor/js/libs/ui.three.js
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ function renderToCanvas( texture ) {
if ( renderer === undefined ) {

renderer = new THREE.WebGLRenderer();
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;

}

Expand Down
2 changes: 1 addition & 1 deletion examples/games_fps.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.VSMShadowMap;
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
container.appendChild( renderer.domElement );

Expand Down
2 changes: 1 addition & 1 deletion examples/js/objects/Reflector.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
projectionMatrix.elements[ 10 ] = clipPlane.z + 1.0 - clipBias;
projectionMatrix.elements[ 14 ] = clipPlane.w; // Render

renderTarget.texture.encoding = renderer.outputEncoding;
renderTarget.texture.encoding = renderer.outputColorSpace;
scope.visible = false;
const currentRenderTarget = renderer.getRenderTarget();
const currentXrEnabled = renderer.xr.enabled;
Expand Down
2 changes: 1 addition & 1 deletion examples/js/objects/ReflectorForSSRPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
textureMatrix.multiply( virtualCamera.matrixWorldInverse );
textureMatrix.multiply( scope.matrixWorld ); // Render

renderTarget.texture.encoding = renderer.outputEncoding; // scope.visible = false;
renderTarget.texture.encoding = renderer.outputColorSpace; // scope.visible = false;

const currentRenderTarget = renderer.getRenderTarget();
const currentXrEnabled = renderer.xr.enabled;
Expand Down
2 changes: 1 addition & 1 deletion examples/js/objects/Refractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
this.onBeforeRender = function ( renderer, scene, camera ) {

// Render
renderTarget.texture.encoding = renderer.outputEncoding; // ensure refractors are rendered only once per frame
renderTarget.texture.encoding = renderer.outputColorSpace; // ensure refractors are rendered only once per frame

if ( camera.userData.refractor === true ) return; // avoid rendering when the refractor is viewed from behind

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/nodes/materials/NodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class NodeMaterial extends ShaderMaterial {

// ENCODING

outputNode = colorSpace( outputNode, builder.renderer.outputEncoding );
outputNode = colorSpace( outputNode, builder.renderer.outputColorSpace );

// FOG

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/objects/Reflector.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class Reflector extends Mesh {

// Render

renderTarget.texture.encoding = renderer.outputEncoding;
renderTarget.texture.encoding = renderer.outputColorSpace;

scope.visible = false;

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/objects/ReflectorForSSRPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class ReflectorForSSRPass extends Mesh {

// Render

renderTarget.texture.encoding = renderer.outputEncoding;
renderTarget.texture.encoding = renderer.outputColorSpace;

// scope.visible = false;

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/objects/Refractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class Refractor extends Mesh {

// Render

renderTarget.texture.encoding = renderer.outputEncoding;
renderTarget.texture.encoding = renderer.outputColorSpace;

// ensure refractors are rendered only once per frame

Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/renderers/webgpu/WebGPURenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class WebGPURenderer {
this.autoClearDepth = true;
this.autoClearStencil = true;

this.outputEncoding = LinearEncoding;
this.outputColorSpace = LinearEncoding;

this.sortObjects = true;

Expand Down Expand Up @@ -483,7 +483,7 @@ class WebGPURenderer {
getCurrentEncoding() {

const renderTarget = this.getRenderTarget();
return ( renderTarget !== null ) ? renderTarget.texture.encoding : this.outputEncoding;
return ( renderTarget !== null ) ? renderTarget.texture.encoding : this.outputColorSpace;

}

Expand Down
2 changes: 1 addition & 1 deletion examples/misc_controls_arcball.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );

renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;
renderer.toneMapping = THREE.ReinhardToneMapping;
renderer.toneMappingExposure = 3;
renderer.domElement.style.background = 'linear-gradient( 180deg, rgba( 0,0,0,1 ) 0%, rgba( 128,128,255,1 ) 100% )';
Expand Down
2 changes: 1 addition & 1 deletion examples/misc_exporter_collada.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( canvasWidth, canvasHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;
container.appendChild( renderer.domElement );

// EVENTS
Expand Down
2 changes: 1 addition & 1 deletion examples/misc_exporter_obj.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
function init() {

renderer = new THREE.WebGLRenderer();
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
Expand Down
2 changes: 1 addition & 1 deletion examples/misc_exporter_ply.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
//

renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.shadowMap.enabled = true;
Expand Down
2 changes: 1 addition & 1 deletion examples/misc_exporter_usdz.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;
document.body.appendChild( renderer.domElement );

camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 0.25, 20 );
Expand Down
2 changes: 1 addition & 1 deletion examples/physics_ammo_instancing.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.shadowMap.enabled = true;
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;
document.body.appendChild( renderer.domElement );

stats = new Stats();
Expand Down
2 changes: 1 addition & 1 deletion examples/physics_oimo_instancing.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.shadowMap.enabled = true;
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;
document.body.appendChild( renderer.domElement );

stats = new Stats();
Expand Down
2 changes: 1 addition & 1 deletion examples/webaudio_orientation.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;
renderer.shadowMap.enabled = true;
container.appendChild( renderer.domElement );

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_animation_keyframes.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
const renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;
container.appendChild( renderer.domElement );

const pmremGenerator = new THREE.PMREMGenerator( renderer );
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_animation_multiple.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;
renderer.shadowMap.enabled = true;
document.body.appendChild( renderer.domElement );

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_animation_skinning_additive_blending.html
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;
renderer.shadowMap.enabled = true;
container.appendChild( renderer.domElement );

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_animation_skinning_blending.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;
renderer.shadowMap.enabled = true;
container.appendChild( renderer.domElement );

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_animation_skinning_morph.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;
container.appendChild( renderer.domElement );

window.addEventListener( 'resize', onWindowResize );
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_buffergeometry.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;

container.appendChild( renderer.domElement );

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_buffergeometry_drawrange.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;

container.appendChild( renderer.domElement );

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_buffergeometry_lines.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;

container.appendChild( renderer.domElement );

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_buffergeometry_lines_indexed.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;

container.appendChild( renderer.domElement );

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_buffergeometry_uint.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;

container.appendChild( renderer.domElement );

Expand Down
4 changes: 2 additions & 2 deletions examples/webgl_furnace_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
renderer.setPixelRatio( window.devicePixelRatio );
document.body.appendChild( renderer.domElement );

//renderer.outputEncoding = THREE.sRGBEncoding; // optional
//renderer.outputColorSpace = THREE.sRGBEncoding; // optional

window.addEventListener( 'resize', onWindowResize );

Expand Down Expand Up @@ -121,7 +121,7 @@

const envScene = new THREE.Scene();
envScene.background = new THREE.Color( COLOR );
if ( renderer.outputEncoding === THREE.sRGBEncoding ) envScene.background.convertSRGBToLinear();
if ( renderer.outputColorSpace === THREE.sRGBEncoding ) envScene.background.convertSRGBToLinear();

const pmremGenerator = new THREE.PMREMGenerator( renderer );
radianceMap = pmremGenerator.fromScene( envScene ).texture;
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_geometry_teapot.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( canvasWidth, canvasHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;
container.appendChild( renderer.domElement );

// EVENTS
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_instancing_modified.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );

renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;

scene = new THREE.Scene();

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_instancing_performance.html
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( width, height );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.outputColorSpace = THREE.sRGBEncoding;

container = document.getElementById( 'container' );
container.appendChild( renderer.domElement );
Expand Down
Loading