wizgrav / aframe-effects

A VR Ready Post processing framework for Three.js and/or A-Frame
https://wizgrav.github.io/aframe-effects
MIT License
206 stars 29 forks source link

Component does not clean up correctly when A-Frame inspector loads #4

Open UXVirtual opened 7 years ago

UXVirtual commented 7 years ago

I've found that when opening the inspector, the effects layer doesn't seem to be removed from the scene, preventing interaction with entities in the inspector viewport. See the official demo here for an example of this: https://wizgrav.github.io/aframe-effects/index.html

In the demo, unchecking 'Toggle Effects' before opening the inspector allows the inspector viewport to function as expected.

The big problem here is that the inspector has no way of adding some kind of pre-launch hook so code can be run beforehand, so components must take this into account during their component specific render loops so they're aware of the inspected open / close states.

wizgrav commented 7 years ago

I've debugged a bit and It seems strange, even if I start the inspector without post processing and then do eg. a scene.setAttribute("effects", "bloom, fxaa") the post processing will take effect only after you revert to the non inspector scene.

My guess is that another scene is created and all components are serialized to it for the inspector. The effects attribute updates the system though. I'll need to consult @fernandojsg on this

wizgrav commented 7 years ago

Ok I think I'm getting somewhere, scene.isPlaying is false in the inspector(scene is paused) so tick and tocks are not getting called it's not a new scene it's just that the scene is set up by the effects system to render on scene.renderTarget (when set rendering will happen to that instead of directly on the canvas). I need to find a way to get notified when play state changes to disable effects.

This means that post proc won't work in the inspector which is kindof a shame since the inspector would be great for tuning the effects. I'll bring it up in slack for discussion

diegodorado commented 6 years ago

Any update o workaround on this issue?

wizgrav commented 6 years ago

Yeah this needs some update, I was planning to do it along with the ssao effect which also is almost done but then life and changing countries and jobs put it on halt. I'll try to at least fix this and some more minor issues this w/e