question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PMREMGenerator.fromScene() alters background color

See original GitHub issue

In PMREMGenerator.fromScene( scene ), scene.background is changed and not restored.

In webgl_materials_car.html, do this:

scene = new THREE.Scene();
scene.background = new THREE.Color( 0x0000ff );

scene.environment = pmremGenerator.fromScene( scene ).texture;
console.log( scene.background ); // null

Also,

renderer.setClearColor( 0x0000ff, 1 );

has different behavior. I would have expected them to be equivalent.

three.js r131

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Mugen87commented, Aug 11, 2021

For simplicity, maybe consider only linear and sRGB,

That sounds like a good start!

1reaction
WestLangleycommented, Aug 11, 2021

@WestLangley said

Renderer clear color is neither tone-mapped nor output-encoded, so it is assumed to be in whatever colorspace the renderer renders to – but that is not necessarily sRGB.

I suggest that PMREMGenerator check renderer.outputEncoding to determine what colorspace the clear color is in – and not assume it is in sRGB. (For simplicity, maybe consider only linear and sRGB, although that would not be completely correct.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Another 10 More Three.JS Tips and a bonus - Nik Lever
You use a PMREMGenerator which has a fromScene method. const envmap = pmremGenerator.fromScene( new RoomEnvironment(), 0.04 ).texture;. HTML; CSS; JS.
Read more >
ThreeJS Selective Bloom Disable Bloom For Scene Background
In the render loop, use scene.background instead of renderer.setClearColor . Define scene backgrounds let scback = { bloomOn: new THREE.
Read more >
PMREMGenerator – three.js docs
PMREMGenerator. This class generates a Prefiltered, Mipmapped Radiance Environment Map (PMREM) from a cubeMap environment texture.
Read more >
Three.js Generate Environment - JSFiddle - Code Playground
Scene(). 7. //scene.background = new THREE.Color('black') ... const pmremGenerator = new THREE.PMREMGenerator(renderer) ... fromScene(scene, 0.01).texture.
Read more >
Creating a game in Three.js - LogRocket Blog
export const scene = new Scene() export const camera = new ... one of the main ones is that our game will pause...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found