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

Post process on one one camera effects both cameras #9038

Closed
stefanvanherwijnen opened this issue Sep 26, 2020 · 5 comments
Closed

Post process on one one camera effects both cameras #9038

stefanvanherwijnen opened this issue Sep 26, 2020 · 5 comments
Assignees
Milestone

Comments

@stefanvanherwijnen
Copy link

https://playground.babylonjs.com/#ZDXUBD

In the example above the left camera does not change (because the exposure is 1.0), however the right camera has become much darker and the colors are different.
The same thing happens when other post processing is applied, such as contrast or blur. The post process works, but the unaffected camera is affected by something else.

https://forum.babylonjs.com/t/xr-post-process-on-one-camera-effects-both-cameras/14451

My guess is that some side effect of the post processing effects the parent camera, but I haven't been able to figure out exactly what is happening.

@Popov72 Popov72 closed this as completed Sep 26, 2020
@Popov72 Popov72 reopened this Sep 26, 2020
@deltakosh deltakosh added this to the 4.2 milestone Sep 28, 2020
@RaananW RaananW removed the VR/AR/XR label Sep 29, 2020
@RaananW
Copy link
Member

RaananW commented Sep 29, 2020

This is actually not an XR issue:

https://playground.babylonjs.com/#ZDXUBD#3

This happens whenever you attach a post process to a camera that is currently not active.

@RaananW RaananW changed the title [XR] Post process on one camera effects both cameras Post process on one one camera effects both cameras Sep 29, 2020
@RaananW
Copy link
Member

RaananW commented Sep 29, 2020

So, the issue is the global image processing configuration that we have the affects all cameras. So this is by design. (thanks @sebavan :-) )

To solve this you can do one of the two - either provide a different configuration when constructing the post process - https://playground.babylonjs.com/#ZDXUBD#6 , or apply the post process on both cameras.

I am closing this, please reopen if it still doesn't work after applying the solution.

@RaananW RaananW closed this as completed Sep 29, 2020
@stefanvanherwijnen
Copy link
Author

I did notice that applying it to both cameras worked fine, but the thing is that I only want to effect one camera.
Changing the configuration indeed fixes it:
https://playground.babylonjs.com/#ZDXUBD#7

Thanks for the help and luckily it's just a configuration issue 😄

@RaananW
Copy link
Member

RaananW commented Oct 7, 2020

Reopening issue.

Playground - https://playground.babylonjs.com/#ZDXUBD#18 works well with two cameras in the browser, but fails when used in XR (tested on desktop using an MR device). Reason might be that the effect is not using the camera's outputRenderTarget. Investigating further.

@RaananW RaananW reopened this Oct 7, 2020
@RaananW RaananW added in progress Someone is currently working on this issue VR/AR/XR labels Oct 7, 2020
@RaananW
Copy link
Member

RaananW commented Oct 7, 2020

For logging reasons - the reason this playground didn't render correctly is that the output texture (set when calling _finalizeFrame) was ignoring the renderOutputTexture of the XR camera.

The initial issue was the global image processing configuration, so it wasn't XR related. After further inspection (and thanks @stefanvanherwijnen for being persistent!!) it seems like it is (mainly) an XR issue, as it is related to (sub)cameras with renderoutput texture defined.

After the fix the following playground should be expected to work:

https://playground.babylonjs.com/#ZDXUBD#22

@RaananW RaananW removed the in progress Someone is currently working on this issue label Oct 7, 2020
@RaananW RaananW closed this as completed Oct 7, 2020
lokiiarora added a commit to Scapic/Babylon.js that referenced this issue Oct 8, 2020
* fix linkWithMesh signature to support TransformNode instead og AbstractMesh

* Use the render output target's texture for PostProcess

related to BabylonJS#9038

* the color green to rule them all

* Fix using CSM for shadow mesh receivers using node materials

* Major changes to pointer selection

- Only one controller will have pointer selection enabled per default
- it is possible to enable pointer selection to all attached controllers
- dev can set the preferred handedness for the initial pointer selection controller
- if more than one controller is available, the pointer selection will switch between then when using the main button
- the switch feature can be disabled
- It is now possible to limit the distance of the pointer selection ray

* fix for all cameras with output render target

* Nightly

* Use RGBA format for KTX2 files that are not color data if ASTC/BC7 not available when transcoding an UASTC source picture

* Add a property to the EffectLayer class to render the bounding boxes unaffected by the effect

* Fix bbrender for instances

* Fix lint

* Add gltf playground snippets (BabylonJS#9106)

* Fix ts

* Nightly

* Fix BabylonJS#9115

* Fix BabylonJS#9116

* Nightly

* Replace Array.From, which doesn't exist everywhere, with more rudimentary syntax.

Co-authored-by: marazzig <giuseppe.marazzi@examina.it>
Co-authored-by: Raanan Weber <info@raananweber.com>
Co-authored-by: Popov72 <github@evpopov.com>
Co-authored-by: David Catuhe <david.catuhe@live.fr>
Co-authored-by: Nicholas Barlow <whoisdrigax@gmail.com>
Co-authored-by: syntheticmagus <33846034+syntheticmagus@users.noreply.github.com>
lokiiarora added a commit to Scapic/Babylon.js that referenced this issue Oct 8, 2020
* fix linkWithMesh signature to support TransformNode instead og AbstractMesh

* Use the render output target's texture for PostProcess

related to BabylonJS#9038

* the color green to rule them all

* Fix using CSM for shadow mesh receivers using node materials

* Major changes to pointer selection

- Only one controller will have pointer selection enabled per default
- it is possible to enable pointer selection to all attached controllers
- dev can set the preferred handedness for the initial pointer selection controller
- if more than one controller is available, the pointer selection will switch between then when using the main button
- the switch feature can be disabled
- It is now possible to limit the distance of the pointer selection ray

* fix for all cameras with output render target

* Nightly

* Use RGBA format for KTX2 files that are not color data if ASTC/BC7 not available when transcoding an UASTC source picture

* Add a property to the EffectLayer class to render the bounding boxes unaffected by the effect

* Fix bbrender for instances

* Fix lint

* Add gltf playground snippets (BabylonJS#9106)

* Fix ts

* Nightly

* Fix BabylonJS#9115

* Fix BabylonJS#9116

* Nightly

* Replace Array.From, which doesn't exist everywhere, with more rudimentary syntax.

Co-authored-by: marazzig <giuseppe.marazzi@examina.it>
Co-authored-by: Raanan Weber <info@raananweber.com>
Co-authored-by: Popov72 <github@evpopov.com>
Co-authored-by: David Catuhe <david.catuhe@live.fr>
Co-authored-by: Nicholas Barlow <whoisdrigax@gmail.com>
Co-authored-by: syntheticmagus <33846034+syntheticmagus@users.noreply.github.com>
aWeirdo added a commit to aWeirdo/Babylon.js that referenced this issue Oct 12, 2020
* nuwatz

* Nightly + Fix BabylonJS#9047

* fix BabylonJS#9048

* Nightly

* Fixed TriPlanarMappingMaterial to compute the right world normal.

* Nightly

* Added support of .waveCount to WaterMaterial to control overall wave count on grounds the material is applied on.

* Fix tiny nme crash when a node was not part of the graph

* Mouse wheel for FreeCamera: Switched off by default.

* Nightly

* Fix close ESM shadows not being set correctly in some cases

* Allow to change the size of the shadow map size

* Nightly

* Fix crash when picksprite is called with no sprite manager

* Nightly

* adding copy to gradiant in NME

* switching order

* 4.2.0-beta.7

* 4.2.0-beta.9

* disable gizmo rotation when in billboard mode

* Cross Eye support for 180 and fixing wrong offset in 180 mode
Closing BabylonJS#8897

* make our status green again!

* generate mipMaps and default behavior

* fix

* warning when using rotation gizmo with transforms in billboard mode

* nightly

* fixing bug in color4

* Fix BabylonJS#9067

* Exclude gltf clearcoat unit test from automatic testing

* Nightly

* Nightly

* Nightly

* missing semicolon

* Associated with BabylonJS#9072

* Nightly

* Nightly

* adding copy gradient step to inspector view

* cleaning up code

* Mouse wheel for FreeCamera: Add Babylon Observables.

* moving icons

* Update BaseCameraMouseWheelInput.ts

Lint: Trailing whitespace.

* Fix flash at start when using filtering methods making use of preprocesses

* freeCameraTouchInput bug.

* Fix alphatest transparency so it no-longer requires a diffuse/albedo texture if an opacityTexture is present

* Local Dev Should not touch dist

* adding a tracking-state observable for the XR camera

fixing BabylonJS#9076

* They know what is what, but they don't know what is what

* doc and a small change in setter

* material is not readonly public

* contact point in registerOnPhysicsCollide callback

* linting

* what's new

* added project to ref

* stay defensive, stay safe

* Project controller position to screen space

Fullscreen GUI in AR will work as expected.

* grün grün grün sind alle meine Tickets

* use the main camera and not the rig camera

* Fix miter issue with text outline

* Nightly

* nit

* Add more declarations to typescript playground

* Fix BabylonJS#9069 + nightly

* Fix for issue with skeleton viewer lighting. Changed skeleton viewer initialization to use utility layer for mesh creation. Added utility layer lighting creation, adjusted light intensity to show surface detail

* what's new

* fix typedoc check

* Fix default sphere layout for back compat.

* remove explicit mesh light specification

* Nightly

* Fix same submesh being rendered multiple times in the shadow map

* Fix incorrect shadows on the master mesh when using a lod mesh

* fixing compound scaling issue

* new is the new old

* cannon fix for sub-rotations

* position fix for cannon (getting position relative to parent)

* Make sure the inspector loads even without the loaders package

* Prevent exception when path has only one object

* Nightly

* Fix Inspector Texture SamplingMode and CoordMode

* Fix keyboard attachment when there is multiple canvases

* fixing has alpha

* Nightly

* remove extra line

* 4.2.0-beta.10

* Nightly

* Multiple fixes and adds to the KTX2 loader

* nit

* nit2

* MouseWheel for freeCamera: Resonse to revew comment: Type lint fix.

* MouseWheel for freeCamera: Resonse to revew comment: Fix typo in previous submission.

* Nightly

* fix linkWithMesh signature to support TransformNode instead og AbstractMesh

* Use the render output target's texture for PostProcess

related to BabylonJS#9038

* the color green to rule them all

* Fix using CSM for shadow mesh receivers using node materials

* Major changes to pointer selection

- Only one controller will have pointer selection enabled per default
- it is possible to enable pointer selection to all attached controllers
- dev can set the preferred handedness for the initial pointer selection controller
- if more than one controller is available, the pointer selection will switch between then when using the main button
- the switch feature can be disabled
- It is now possible to limit the distance of the pointer selection ray

* fix for all cameras with output render target

* Nightly

* Use RGBA format for KTX2 files that are not color data if ASTC/BC7 not available when transcoding an UASTC source picture

* Add a property to the EffectLayer class to render the bounding boxes unaffected by the effect

* Fix bbrender for instances

* Fix lint

* Add gltf playground snippets (BabylonJS#9106)

* Fix ts

* Nightly

* Fix BabylonJS#9115

* Fix BabylonJS#9116

* Nightly

* Update local sandbox to point to local files

* Clean up formatting of sandbox html

* Update wasm Draco files to 1.3.6

* Replace Array.From, which doesn't exist everywhere, with more rudimentary syntax.

* Use faster functions for loading draco data

* Fix by the comments

* remove Array.from usage from Core

* gotta love absolute positioning

* Fix IE11 shader crash

* added optional selected to options line component

* add a select tag for target bone name

* soylent green are people!

* Avoid GC when calling intersects

geometry._positions resets every frame (when bounding box updates) and recreates when mesh.intesects is called.
With large meshes this can be very costly, as vectors are constantly created and GCed (on each frame).
This keeps a cache of the positions, while keeping the current state as it is. _positions is still null or full, _positionsCache is updated when needed, reusing the vectors if possible

* green again (naturally)

* Update existing wasm modules / add new ones for RGBA

* Add new UASTC to RGBA universal transcoder support

* optimizations

* Nightly

* Nightly

* nightly

* adding manual input for gradient number value

* cleaning code

* Mouse wheel for FreeCamera: Responses to review comments.

* Mouse wheel for FreeCamera: Arg. Lint.

* Mouse wheel for FreeCamera: More responses to review comments. Enum to select camera property.

* first gamepad if no XBOX found

* green is the word

* Fix input of decimal digits that are fixed at 2

* Allow any type of inputs for smoothstep

* Don't push two times the same sampler name

* Allow reusing the CurrentScreenBlock + texture sampling in the fragment shader

* Fix validation test failing

* Allow multiple ParticleTextureBlock blocks

* get next path step point for an agent

* Move isNotColorData property to ITextureInfo

* fix documentation

* Possibility to add a comment to a NME material

* Nightly

* 4.2.0-beta.11

* Handle comments

* Fix zip download

* Handle more comments

* nit

* Fix thin instance intersection check with bounding info

* Add override for XMLHttpRequest for Babylon Native

* Update boundingBoxRenderer.ts

* Update what's new.md (#13)

* Helper function for off mesh link

* WebXR declaration update

* build adjustments

* further adjustments

* event type

* further changes

* avoid var declaration

* correct var def

* adjust canvas

* adjustment to idl

* some docs

* Adjusting to the commited typedef

* adjusting events

* correct callback

* Nightly

Co-authored-by: Raanan Weber <info@raananweber.com>
Co-authored-by: David Catuhe <david.catuhe@live.fr>
Co-authored-by: sebavan <vandenberghe.sebastien@gmail.com>
Co-authored-by: Julien MOREAU-MATHIS <moreau-mathis@intechinfo.fr>
Co-authored-by: duncan law <mrdunk@gmail.com>
Co-authored-by: Popov72 <github@evpopov.com>
Co-authored-by: Pamela Wolf <pamela.wolf@digipen.edu>
Co-authored-by: Cedric Guillemet <cedric.guillemet@gmail.com>
Co-authored-by: Pamela W <67929198+msDestiny14@users.noreply.github.com>
Co-authored-by: metaobjects <github@metaobjects.org>
Co-authored-by: Gary Hsu <bghgary@users.noreply.github.com>
Co-authored-by: Nicholas Barlow <nickmaxx@gmail.com>
Co-authored-by: marazzig <giuseppe.marazzi@examina.it>
Co-authored-by: Nicholas Barlow <whoisdrigax@gmail.com>
Co-authored-by: syntheticmagus <33846034+syntheticmagus@users.noreply.github.com>
Co-authored-by: Ryan Tremblay <ryan.tremblay@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants