swemaniac Posted January 25, 2016 Share Posted January 25, 2016 Hi everyone, I'm doing some lightmapping and deferred lighting with a shader and a render texture on the whole screen to produce ambient light and illuminating with selected light sources. I apply the lightmap filter to the whole world like so: this.game.world.filters = [lightmap]; This makes everything affected by the lightmap including the UI texts and stuff (obviously, since they attach to the stage like everything else I guess). My question is simply, is there a separate layer or such that I can use for UI stuff to exclude those things from the filter? My solution for this right now I think would be: Render the UI component to a separate render texture Render the whole stage to a separate render texture Apply the lightmap filter to the render texture with the stage components in it Clear the stage and render both textures back to it Would that be a viable solution? Or would it be a significant performance hit, rendering the stage multiple times... Link to comment Share on other sites More sharing options...
drhayes Posted January 25, 2016 Share Posted January 25, 2016 I can think of a couple of solutions: add anything you don't want filtered to the stage directly (via game.stage) and then remember to manage it on state transition since it won't be cleared like the world will. Or, you could create two top-level groups in the world: one which gets filtered and one which doesn't, and add children to the groups as you need. Groups can have filters as well. Link to comment Share on other sites More sharing options...
swemaniac Posted January 25, 2016 Author Share Posted January 25, 2016 That's really interesting, for whatever reason I never thought a group could have a filter, but why not indeed. Sounds like a good idea actually. I just need to pass the groups around and remember to add components there instead of to the stage..... Thanks for the input! Link to comment Share on other sites More sharing options...
Recommended Posts