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

MeshInstance.castShadow not updating shadows #5117

Closed
animech-sijo opened this issue Mar 1, 2023 · 1 comment · Fixed by #5130
Closed

MeshInstance.castShadow not updating shadows #5117

animech-sijo opened this issue Mar 1, 2023 · 1 comment · Fixed by #5130
Assignees
Labels
area: graphics Graphics related issue feature request

Comments

@animech-sijo
Copy link

animech-sijo commented Mar 1, 2023

Came accross this bug described in this thread: https://forum.playcanvas.com/t/meshinstance-castshadow-not-working-properly/6887/

If we're disabling shadow casting on MeshInstances:

var meshInstances = this.entity.model.meshInstances;
for (var mi = 0; mi < meshInstances.length; mi++) {
     meshInstances[mi].castShadow = false;
}

The shadow does not disappear unless we disable and enable the entity:

this.entity.model.enabled = false;
this.entity.model.enabled = true;

The expected behavior is that shadows update as soon as MeshInstance.castShadow is updated.

@mvaligursky
Copy link
Contributor

MeshInstance. castShadow is a private flag, not part of public API, so there is no expected behaviour when changing this.
The public API is RenderComponent.castShadows, which I believe behaves correctly.

But in saying that, I think it could be useful to make it to work, similarly to how MeshInstance.visible works, which does not involve the cost of updating the LayerCompositions, but simply skips the mesh during the frustum culling when rendering to shadows.

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

Successfully merging a pull request may close this issue.

3 participants