TarVK / pixi-shadows

Adds dynamic shadows to PixiJS
https://tarvk.github.io/pixi-shadows/dist/
MIT License
53 stars 14 forks source link

Feature Request: Colored lights #19

Open scott-cornwell opened 2 years ago

scott-cornwell commented 2 years ago

Hello, really liking pixi-shadows! I had tried to integrate it with pixi-lights but I was not able to get them working together. I decided to give up on that as performance was also not very good with pixi-lights. The good news is I was able to create really good looking colored lights with pixi-shadows by modifying only a few lines of code. I think this would be great for a lot of people who want a more performant solution than pixi-lights and don't require normal mapping. This is what you can achieve with a few small tweaks!

scott-cornwell commented 2 years ago

In ShadowMaskFilter I just changed this line at the end to these two lines and passed in some uniforms for the colors and a fade property :

// gl_FragColor = vec4(vec3(lightIntensity * totalIntensity), 1.0);
float combinedIntensity = lightIntensity * totalIntensity;
gl_FragColor = vec4(lightR * combinedIntensity, lightG * combinedIntensity, lightB * combinedIntensity, fade);
TarVK commented 2 years ago

Looks pretty neat indeed! Feel free to create PR for the future if you like

scott-cornwell commented 2 years ago

Ok I'll try to get a PR together soon here. I realized I actually made a few other small changes to make this happen but it's really not much.

amytimed commented 1 year ago

any update on this?