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

Forward Renderer error when using first layer #2518

Closed
LeXXik opened this issue Nov 2, 2020 · 2 comments · Fixed by #2936
Closed

Forward Renderer error when using first layer #2518

LeXXik opened this issue Nov 2, 2020 · 2 comments · Fixed by #2936
Assignees
Labels
area: graphics Graphics related issue bug

Comments

@LeXXik
Copy link
Contributor

LeXXik commented Nov 2, 2020

Steps to reproduce:

  1. Add an opaque layer to the very top of the layers list (before World) and give it a name, e.g. "Custom"
  2. Use script that adds a camera with this layer:
    var layer = this.app.scene.layers.getLayerByName('Custom');
    var cameraEntity = new pc.Entity();
    cameraEntity.addComponent('camera', {
        clearColor: new pc.Color(0.0, 0.0, 0.0, 0.0),
        layers: [layer.id],
    });    
    this.app.root.addChild(cameraEntity);

Forward Renderer throws an error:
image
image
cameraPass is 0 in this case, resulting in settings being undefined.

@mvaligursky
Copy link
Contributor

This is on my radar to fix already, but I don't have a fix yet.
It's related to a layer which uses shadow map from directional light used before the shadow map is rendered for that frame.

@mvaligursky mvaligursky self-assigned this Nov 2, 2020
@mvaligursky mvaligursky added area: graphics Graphics related issue bug labels Nov 2, 2020
@devcem
Copy link

devcem commented Nov 6, 2020

I came here to raise a bug ticket for that issue. Adding Custom layer on directional light solves issue, ALSO on engine code checking "settings" variable on that line and if it's not exist setting the "pass" variable to 0 solves issue.

Here is the line :

settings = light._visibleCameraSettings[cameraPass];

Here is the screenshot for change :
Screen Shot 2020-11-06 at 18 04 03

@mvaligursky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants