Roomy Posted March 15, 2021 Share Posted March 15, 2021 (edited) Hey, so, I have a relatively simple problem: I want to cut the solid parts of a lightmap out of a darkness layer, usually one solid color. This can't be done without alpha compositing unless you use custom filters, so I decided to give it a crack. I got a version working in 3.0.0 PIXI (based off of an old lightmap filter), but when transitioning to 5.2.2, I'm experiencing all kinds of problems, namely that the lightmap, despite logging/extracting/etc. as the expected picture, seems to be treated as pure white by the filter. You can find my demonstration here: https://codepen.io/roomyrooms/pen/mdOQggP?editors=0010 As you can see, setting the alpha of the darkness layer to the lightmap's alpha per-frag makes it invisible, completely. It doesn't seem to be interpreting the lightmap at all. Any help? Apologies, I'm a newbie to shaders/webgl/pixi/everything! For those curious, here's a working version in 3.0.8: https://codepen.io/roomyrooms/pen/NWbmKLj?editors=0010 Edited March 15, 2021 by Roomy ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Roomy Posted March 15, 2021 Author Share Posted March 15, 2021 I managed to get it working!!!https://jsfiddle.net/roomyrooms/z7n3fuqt/49/ It takes a lightmap, a tilemap (just the background) and a darkmap (a sheet of a single color) and renders the lightmap's black values as transparency in the darkmap, effectively punching holes in it just the way I wanted. Woohoo! ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 16, 2021 Share Posted March 16, 2021 My big example of how to make lights by modyfing filters and using pixi-layers: https://codesandbox.io/s/tender-franklin-iycmu Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.