Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static container as a background. #31

Closed
Fire7 opened this issue Jun 17, 2018 · 3 comments
Closed

Static container as a background. #31

Fire7 opened this issue Jun 17, 2018 · 3 comments

Comments

@Fire7
Copy link

Fire7 commented Jun 17, 2018

Hello, first of all thanks for awesome work with layers and lighting.

I'm trying to migrate my project on a new version of pixi-layers and pixi-lighting and got some issue.

My application consists of several parts:

  1. rootStage (PIXI.display.Stage) - just a rootContainer.
  2. bgStage (PIXI.Container) - container with a background and some sprites on it without any effects.
  3. mainStage (PIXI.display.Stage) - this one is using Pixi-lights.

So, i've got some issue with mainStage opacity, I can't understand why is this happening and tried to use layers, groups, change bgStage type to layer or stage, nothing fix it.

Can you help me?

Here is example:
https://codepen.io/Fire7/pen/zaPKNQ
So, background and bunny should not be visible

@ivanpopelyshev
Copy link
Collaborator

ivanpopelyshev commented Jun 17, 2018

Hello! Thank you!

Yep, that issue is known, that is how lights actually work, they are transparent, applied on black background! If you look at math formulas, its all there.

You have to put black (tint=0) version of diffuse layer, like here: https://pixijs.io/examples/#/layers/normals-drag.js

Put it before normals.

var diffuseBlackSprite = new PIXI.Sprite(diffuseLayer.getRenderTexture());
diffuseBlackSprite.tint = 0;
// without the black sprite, lighted elements will be transparent to background. Try remove that line
stage.addChild(diffuseBlackSprite);

@ivanpopelyshev
Copy link
Collaborator

However, to see that you'll have to remove lighted background (bg_diffuse, bg_normal), otherwise it will totally cover whole tilingsprite background.

@Fire7
Copy link
Author

Fire7 commented Jun 18, 2018

Thanks for fast response, black sprite have fixed issue.

@Fire7 Fire7 closed this as completed Jun 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants