pixijs / lights

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

v5 #41

Closed jonlepage closed 2 years ago

jonlepage commented 5 years ago

Any news or plan in the near future to port this with pixiv5 engine ? i just ask

ivanpopelyshev commented 5 years ago

You know for sure that I work in random order. No plans :)

RossKinsella commented 4 years ago

Hi @ivanpopelyshev, is there anything I can do to help with this?

ivanpopelyshev commented 4 years ago

Well, you can do that if you have enough experience :) pixi-layers is on v5, and we made custom batched light rendering much easier: https://www.pixiplayground.com/#/edit/~tlXTadqt1qCEvHf~cMQE

Also, here's how to use shader without batching with pure mesh: https://pixijs.io/examples/#/mesh-and-shaders/triangle-color.js , its also fine in case you dont need to rebind textures.

Its in my list, but its LONG and im doing things randomly, not FIFO.

ivanpopelyshev commented 4 years ago

Are you sure you need normal maps and not some other way to light stuff?

jonlepage commented 4 years ago

@Coding-Kiwi dont Thumbs Down Ivan ! he work hard to shares us free crazy plugins on PIXI engines. What a lack of respect !

Coding-Kiwi commented 4 years ago

@djmisterjon I respect him very much. But if I had a project like this I would be aware of the responsibility that comes with it and come up with a better answer than "No Plans :)". It just came off to me as if he doesn't care about the people that like his work.

jonlepage commented 4 years ago

@Coding-Kiwi You should always encourage developers, we are all confrere. thumbs up and ask to ivan what your need :) he alway help. btw, you can do like me, juste make code yourself , yes is hard, but satisfying !

RossKinsella commented 4 years ago

Thanks for the swift reply @ivanpopelyshev

Are you sure you need normal maps and not some other way to light stuff?

No, i'm not certain. I'm interested in having dynamic lighting in a dynamic scene, which is generated by users via some map building tools

Stuff like if the user places a lamp, the side of a nearby couch is brighter

Well, you can do that if you have enough experience :)

I might be able to put it together! I looked through the source code. It appears that most of the work is done via shaders. Will those require work to migrate to v5?

ivanpopelyshev commented 4 years ago

Part of my slides for HolyJS conference: https://docs.google.com/presentation/d/1wX-sXRh8qkmadwMPb1noFpsVAU5jQyg9DBrwcSOYlXA/edit#slide=id.g70b2e5f95b_1_12

Its on russian, but in screens you can see @dairnon 's work : we can mult by some light layer, then add another light layer. Or overlay on them both. Or hardlight.

This is basic demo: https://pixijs.io/examples/#/plugin-layers/lighting.js

pixi-lights just adds normals to the same principle.

ivanpopelyshev commented 4 years ago

Unfortunately @Dairnon is very busy releasing his game, he'll make tutorials on lights later.

That's how it looks with MANY layers and shaders and filters: https://www.youtube.com/watch?v=8LQL5XznvGI

RossKinsella commented 4 years ago

pixi-lights just adds normals to the same principle.

Aha! Thanks so much for your help @ivanpopelyshev

blurymind commented 4 years ago

Worth noting that potentially one of our current GSOC students will need this to work on pixi5, as Gdevelop has been migrating to it.

Here is the trello ticket for this feature implementation on gdevelop: https://trello.com/c/M4Kwc67v/157-add-support-for-dynamic-lights-shadows-in-gdevelop-5

Do you guys know if somebody is willing to port it over to pixi5 or put a bounty on it? If not - any other libraries or ways of getting this to work in pixi5?

jonlepage commented 4 years ago

@blurymind just in case, i think phaser3 work fine with SpriteIlliminator. You can maybe try leech some code here. https://github.com/photonstorm/phaser/blob/master/src/gameobjects/lights/LightsPlugin.js It look well documented but need deep knowledge with webGl. https://github.com/photonstorm/phaser/blob/d6e860076637c1686adcfcd64afd40c829b5d181/src/renderer/webgl/pipelines/ForwardDiffuseLightPipeline.js#L116 Bounty can be a good idea to make this progress!

Kromahtique commented 4 years ago

To what extent is this plugin incompatible with v5? What is it that is functioning in a way that won't make this plugin effective? I need to use normal mapping for a project at work with Pixi v5 and must choose between this plugin or some custom shader.

ivanpopelyshev commented 4 years ago

Shader plugins / meshes are different in v5, easier to make - that's the problem

Layers already exist in v5.

blurymind commented 4 years ago

That may be the case, but there is not a single example out there of how to do illuminated sprites using a normal map shader in pixi5. This plugin made that possible

the example you link to is super basic https://pixijs.io/examples/#/plugin-layers/lighting.js there is no raycast shadows, there is no normal maps used

So I guess the point is, if we are to deprecate this and not port it over to pixi5 ever - we need an example of how to do it in pixi5 the right way

c-ridgway commented 3 years ago

A graphics platform without a lighting library is going to deter a lot of users from using pixijs.

jonlepage commented 3 years ago

A graphics platform without a lighting library is going to deter a lot of users from using pixijs.

it working but for V4 only. image

bigtimebuddy commented 3 years ago

To clarify, is low priority because other plugins are more popular. We are going in after the more critical plugins first. If someone would like to sponsor a bounty for this plugin to convert to v5/6, that would definitely incentive it happening sooner. Any takers?

jonlepage commented 2 years ago

YEAH , tanks a lot to you both @bigtimebuddy and @ivanpopelyshev , your awesome ! I tested and everything seem ok, am exited to finally migrate from v4 to v6! awfawf

So now all essential plugin for game seem work at first look ! this is crazy !

  "devDependencies": {
    "@types/chrome": "0.0.180",
    "@types/node": "^17.0.21",
    "@types/nw.js": "^0.13.14",
    "@types/three": "^0.138.0",
    "commander": "^9.1.0",
    "nw": "^0.62.0",
    "nw-builder": "^3.5.7",
    "typescript": "^4.6.2",
    "vite": "^2.8.6"
  },
  "dependencies": {
    "@esotericsoftware/spine-canvas": "^4.1.12",
    "@esotericsoftware/spine-core": "^4.1.12",
    "@esotericsoftware/spine-player": "^4.1.12",
    "@esotericsoftware/spine-threejs": "^4.1.12",
    "@esotericsoftware/spine-webgl": "^4.1.12",
    "@pixi/layers": "^1.0.11",
    "gsap": "^3.9.1",
    "lodash": "^4.17.21",
    "pixi-lights": "^3.0.0",
    "pixi-projection": "^0.4.4",
    "pixi-spine": "^3.0.13",
    "pixi.js": "^6.2.2",
  }

I not tested spine yet, with normals , i will in few day :)