Hello, is there any way to have more quality shadows on the shadow catcher plane? Now I can see the shadow pixel moving along the animated part of the shadows of the object’s straight edges.
Hi Tomislav,
Step-by-step plan in pseudocode:
- Investigate how shadows and shadow catchers are configured in Needle Engine.
- Identify which factors/settings influence shadow quality (resolution, filtering, light settings).
- Suggest improvements, such as increasing shadow map resolution or applying softer shadow filters.
- Show how to set these properties on relevant Needle/Three.js components.
- Recommend workflow steps for best shadow quality (e.g., light types, renderer settings).
Implementation in TypeScript for a custom Needle Engine Behaviour:
import { Behaviour, serializable } from "@needle-tools/engine";
import { DirectionalLight, PCFSoftShadowMap, WebGLRenderer } from "three";
export class ImproveShadowQuality extends Behaviour {
@serializable(DirectionalLight)
light?: DirectionalLight;
awake() {
// 1. Set high resolution for shadow maps
if (this.light) {
this.light.castShadow = true;
this.light.shadow.mapSize.width = 4096;
this.light.shadow.mapSize.height = 4096;
// Optional: Increase shadow bias to reduce shadow acne
this.light.shadow.bias = -0.0005;
}
// 2. Change renderer to use better shadow filtering
const renderer = this.context.renderer as WebGLRenderer;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = PCFSoftShadowMap; // softer shadows
}
}
Tips:
- For sharp straight shadow edges, increase shadow map size.
- For soft edges, use
PCFSoftShadowMap
. - Avoid too high resolution for performance reasons.
- Fine-tune plane and receiver material for correct catching/blending.
- Ensure your receiving plane’s material is properly set up for shadow catching.
Links:
Follow-up questions:
- Which light type are you using (directional, spot, point)?
- What is your current shadow map size and shadow catcher material setup?
This helps tailor the best solution for your scene!
4 replies left
thread_KJ6ECFrjyt3pzReXVXdsZ3tG
Reply to this post directly if you need further help (bottom right button)
Hmm, I have tried the script above and didn’t see any change.
Thank you, Tomislav. Let’s clarify to help you further:
Could you please answer these:
- Which light type are you using (directional, spot, or point)?
- Are you using the standard Needle Engine shadow catcher setup or a custom material?
- What export workflow are you using (Unity, Blender, direct Three.js/Needle code)?
Possible issues if the script didn’t change anything:
- The
ImproveShadowQuality
component must be attached to a GameObject in your scene. - The
light
field in the component must reference your actual light object. - The renderer settings may get overridden elsewhere or after the script runs.
Tips to ask good questions:
- Share error logs if available.
- Specific details about your workflow help zero in on issues faster.
- Copy project info from Unity/Blender if using Needle’s pipeline.
Ready for concrete debugging once you provide those details!
4 replies left
thread_KJ6ECFrjyt3pzReXVXdsZ3tG
Reply to this post directly if you need further help (bottom right button)
I am using Directional light
Using standard shadow catcher setup
I am Using Unity
Hi, without writing code I think all you need to do is to add the AdditionalShadowData component in Unity (see button at the bottom of the Light component)
Then modify/increase the ShadowResolution.
Can I modify shadow strength? Not only dropping on the Shadowcatcher but also on the object itself.
I would also like to know how I reference my DirectionalLight so I can change its properties.