Pixi.js: [Share] My extension of PIXI for Lighting.

Created on 25 Nov 2016  路  15Comments  路  Source: pixijs/pixi.js

My extension is inspired by https://github.com/pixijs/pixi-lights.
But it's not simple port of old pixi-lights, it's re-designed.

The differences :

  • Better performance (just a bit little)
  • A new renderer named LightSpriteRenderer, don't change WebGLRenderer & SpriteRenderer
  • Light is not the subclass of DisplayObject, it's just a normal Class.
  • attribute lights on sprite, don't need to add a light object to the stage/container. Now, you could set different lights on different sprites in the same stage.
  • AmbientLight is not necessary, you could use ambientColor and ambientLight on PointLight and DirectionalLight. But just use on the first light of lights please.
  • support non-light-sprites in correct rendering order. (the old pixi-lights always render non-light sprite on the top).
  • use pluginName for using LightSpriteRenderer ( see #3330 )
  • add an important feature of pixi-gl-core ( see https://github.com/pixijs/pixi-gl-core/pull/18 )
  • DO NOT support Container . Please use LightSpriteRenderer on standalone Sprite with normalTexture.
  • ... others...

My english is very poor , so , the example is better than my words :
http://fattyboy.cn/pixi-lights-v4/

the key files of this feature in my fork version at :
https://github.com/finscn/pixi.js/tree/master/src/extension/light~~
[update: new url] : https://github.com/finscn/pixi.js/tree/master/src/extensions/renderers/light

Why don't use Deferred Lightning ?

I found that Deferred Lightning in 2D game with WebGL won鈥檛 help for performance in most cases.

BTW,
I've stopped to develop Light Filter.
If want to implement it 锛孖 have to create a new subclass of Sprite for render normalTexture. That's so complex.

馃檹 Feature Request

Most helpful comment

pixi-layers is an amazing feature , I couldn鈥檛 wait for it.

All 15 comments

Looks impressive @finscn, I look forward to @englercj's response on this.

Indeed, so very impressive, looking forward to using it :)

Interesting! Looking forward to play with your plugin.

I'm following this with interest and noticed some tickets resolved and a pr for gl-core pending https://github.com/pixijs/pixi-gl-core/pull/22
I was wondering @finscn if you closed this issue, because you're planning to make a pr or if you just don't have the time to do it ? (Because in case 2 I may have some time off to help for this)

@yhwh , I think this feature is not a core function of PIXI.js , so I closed it.

I hope pixijs team could create a new repo ( e.g. named pixi-extensions) for developers to commit various filters , renderers etc. ( cc @GoodBoyDigital @bigtimebuddy @staff0rd )

This is really cool, I'm going to integrate this into my project and contribute if I can 馃憤

Hi guys , now support deferred-lighting .
When pixi supports gl.bindAttribLocation , I will open a PR for this feature.

@GoodBoyDigital , when will pixi support gl.bindAttribLocation ?

P.S. : I've open a PR #3682 for gl.bindAttribLocation. Review please, thank you.

Im gonna race you with my pixi-layers :)

pixi-layers is an amazing feature , I couldn鈥檛 wait for it.

I really want to use this project, but neither of your links for the source work.
I found the minimized version of the code through your demo, but would like to try and tweak some things, as I have some issues. Is there any place I can still find the code?

@TarVK the source code in My fork version https://github.com/finscn/pixi.js

I'm not being able to find it on that link you provide... What file is it exactly? And how could we use it as in your example?

@finscn @prachtan Its done. http://pixijs.io/examples/#/layers/normals.js

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sntiagomoreno picture sntiagomoreno  路  3Comments

Makio64 picture Makio64  路  3Comments

zcr1 picture zcr1  路  3Comments

madroneropaulo picture madroneropaulo  路  3Comments

lucap86 picture lucap86  路  3Comments