Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Runtime/MonoBehaviours/CachedShadowMapReceiverCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,11 @@ void BuildSpotLightBuffer(CommandBuffer lighting_buffer,

// Only draw transformed pyramid to avoid activating fragments outside spotlight cone.
lighting_buffer.SetGlobalFloat(nameID : _m_light_as_quad_prop_id, 0);

Matrix4x4 localToWorldTransform = Matrix4x4.TRS(a_light.CachedTransform.position, a_light.CachedTransform.rotation, Vector3.one);

lighting_buffer.DrawMesh(mesh : this._spot_light_mesh,
matrix : a_light.CachedTransform.localToWorldMatrix
matrix : localToWorldTransform
* Matrix4x4.Scale(vector : new Vector3(x : spot_width,
y : spot_width,
z : a_light
Expand Down Expand Up @@ -390,10 +393,12 @@ void BuildPointLightBuffer(CommandBuffer lighting_buffer,

var pass = intersects_near ? _near_pass_idx : _non_near_pass_idx;

Matrix4x4 localToWorldTransform = Matrix4x4.TRS(a_light.CachedTransform.position, a_light.CachedTransform.rotation, Vector3.one);

// Only draw transformed sphere to avoid activating fragments outside point light sphere.
lighting_buffer.SetGlobalFloat(nameID : _m_light_as_quad_prop_id, 0);
lighting_buffer.DrawMesh(mesh : this._point_light_mesh,
matrix : a_light.CachedTransform.localToWorldMatrix
matrix : localToWorldTransform
* Matrix4x4.Scale(vector : new Vector3(x : 2.0f * light_range,
y : 2.0f * light_range,
z : 2.0f * light_range)),
Expand Down