pixijs / lights

Adds dynamic lighting via deferred shading to PixiJS
https://pixijs.io/lights/docs/index.html
MIT License
203 stars 29 forks source link

Is there an easy-ish way to mark a sprite as self-illuminating? #5

Closed mreinstein closed 9 years ago

mreinstein commented 9 years ago

What I'd like to do is take a sprite or graphics object, mark it as self illuminating and give it a bloom effect filter. The idea being that a light source visually represented in the scene wouldn't be affected by lights/normals. kind of like this:

self_illum_comparison

englercj commented 9 years ago

Have you tried not setting the normal texture? Have you tried attaching a light to the object itself?

mreinstein commented 9 years ago

I tried disabling the normal texture yes. I also added a bloom filter to the object. I hadn't tried attaching a light to the object itself, which I'll do now.

englercj commented 9 years ago

There isn't a straight forward way in this lib to say "exclude this object from lighting effects". In fact, I'm not sure there is one at all.

mreinstein commented 9 years ago

I'm not sure there is a way in this lib to say "exclude this object from lighting effects".

yeah that's exactly what I'm after. That's too bad. Thanks for the heads up anyway.

By the way this prototype is effin cool! Great work so far. :)

mreinstein commented 9 years ago

I just thought of a workaround, figured I'd get your 2 cents; would it be feasible to declare a standard pixi renderer, use that for rendering just the self illuminated stuff, and draw it on top of the deferred render?

englercj commented 9 years ago

If you have a separate renderer then that is a separate canvas, IIRC. I'm not sure if that would work.

Likely this lib would have to have a post-render step that renders all the non-illuminated objects.

mreinstein commented 9 years ago

https://www.bountysource.com/issues/23334687-is-there-an-easy-ish-way-to-mark-a-sprite-as-self-illuminating

englercj commented 9 years ago

Ok, so I added an "unlit" render pass for after the scene is drawn. Any sprites without a normal texture assigned will act like an unlit sprite and be drawn on top of the lit scene.

I added an example of this in the index.html file. You can view it by cloning the repo, running npm i, then npm start. Let me know if this direction works for you.

mreinstein commented 9 years ago

I've tried it out, works great! This panda test object which is unlit by the lighting engine, will it accept shader(s)?

mreinstein commented 9 years ago

Sorry, I didn't read the source carefully enough; I see now that you're actually already applying a filter to the panda image. Great work!