Three.js: PMREMGenerator.fromScene does not render Scene Background correctly

Created on 17 Apr 2020  路  6Comments  路  Source: mrdoob/three.js

Description of the problem

Hi there,

Currently when using an image background (in this case generated with PMREMGenerator) it seems that producing a PMREM using PREMGenerator's fromScene will result in a mirroring of the scene's background in the resulting Envmap.

It's easier to show than explain, so here's an example:
https://jsfiddle.net/BruOps/e9obh3np/9/

Click the "Update PMREM" button so see what I mean. You'll see the sky flip on the models.

Three.js version
  • [x] Dev
  • [x] r115
  • Since r112?? That's what I suspect at least.
Browser
  • [x] All of them
  • [ ] Chrome
  • [ ] Firefox
  • [ ] Internet Explorer
OS
  • [x] All of them
  • [ ] Windows
  • [ ] macOS
  • [ ] Linux
  • [ ] Android
  • [ ] iOS
Hardware Requirements (graphics card, VR Device, ...)

N/A

Bug

Most helpful comment

Just to confirm: https://jsfiddle.net/rvbwna14/ 馃槃

All 6 comments

I can confirm the issue.

@elalish Maybe a problem in _sceneToCubeUV()?

I think this has to do with the fact that scene.scale.z *= - 1 doesn't affect the way the background is rendered, so the expected behavior fails. The objects in the scene are rendered correctly, but not the scene background.

Any reason why we're using a left-handed coordinate system @elalish ? Wouldn't it be easier if we kept things consistent with three.js coordinate system?

@sciecode Well, I wouldn't say it's intentionally left-handed, though I'll say I was a tad confused as to whether we were thinking in terms of PNG pixel ordering or OpenGL (flipY). That scale.z *= -1 was definitely a dirty hack to get it work. I imagine this is also related to @WestLangley 's comment.

All this to say, I'd be all for making it work better and more consistently. I don't have the bandwidth for it right now, but I'd be happy to review a PR. I consider the format of cubeUV to be an implementation detail, so I think it's fine to change as long as the output works.

I see what you mean, I'll try to give it a closer look and see if we can do something about that. But I imagine it might be necessary to make changes to the cubeUV format implementation.

I believe @WestLangley had a few ideas regarding the orientation and indexing of each face, perhaps he might give us some ideas as to how we may approach this.

Just to confirm: https://jsfiddle.net/rvbwna14/ 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Bandit picture Bandit  路  3Comments

fuzihaofzh picture fuzihaofzh  路  3Comments

makc picture makc  路  3Comments

zsitro picture zsitro  路  3Comments

akshaysrin picture akshaysrin  路  3Comments