decentraland / unity-renderer

Unity implementation of Decentraland Client
https://play.decentraland.org
Apache License 2.0
136 stars 93 forks source link

Disabled shadows get re-enabled by the culling controller #3533

Closed Kinerius closed 1 year ago

Kinerius commented 1 year ago

Example SDK code

const cube = new Entity()
cube.addComponent(new Transform({
    position: new Vector3(8, 0, 8),
    scale: new Vector3(1, 3, 1)
}))
const shape = new BoxShape()
cube.addComponent(shape)
const material = new Material()
material.albedoColor = new Color4(1, 0, 0, 0.3)
material.castShadows = false
cube.addComponent(material)
engine.addEntity(cube)

Expected Behaviour

Shadows are turned off for that entity

Problem

https://github.com/decentraland/unity-renderer/blob/dev/unity-renderer/Assets/Rendering/Culling/CullingControllerUtils.cs#L60 This code doesn't know that some renderers may have their shadows disabled and will override any setting of the entity's material

PalauiDCL commented 1 year ago

On it

0xD-Fabio commented 1 year ago

This is the same issue I'm starting tackling for the SDK team: https://github.com/decentraland/sdk/issues/513

0xD-Fabio commented 1 year ago

This seemed to be the same issue as SDK #513, but it wasn't. Fixing SDK #513 issue we noticed that SDK7 rendereables are not being culled.