Jump to content

pixi-lights in isometric scenes, sprite Masks


Recommended Posts

Hi, I'm currently making a small isometic demo using pixi-layers and pixi-lights. I got stuck trying to prevent a PointLight from affecting a Sprite if the lights y-coordinate is lower than the Sprites y-coordinate(aka Sprite is "in front" of the light). Linked is a small example of what I'm trying to create. Notice how the pillar goes dark when the character (light source) is behind it.


My initial attempt was to try and recreate the effect by

  1. checking for sprites in the radius of the light and
  2. adding a prerendered inverted mask to the point Light for each sprite in radius that also has higher y-coordinate.

This worked well when testing with Graphics, but I can't get Sprite masks to work on point lights (the entire light disappears after setting the mask).

I guess my questions are if it is possible to make Sprite mask work with point light. Or is there a better way to do this altogether?

PS Code is much to large to post here, but please ask if any snippets would help you understand what I'm trying to do.

Link to comment
Share on other sites

I'm not sure if I need normals, I kind of want to compare results with and without them to find out?. I'll definitely try the black sprite approach this weekend, it sound like it might actually be less work than going with masks. BTW do you maybe know why Sprite masks don't work on lights but stencil masks do?

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...