Hello, can you turn off the shadows of a specific object in QuickLook? I have a transparent object, but it is casting a shadow.
Hi Tomislav,
To disable shadows for that specific transparent object you can disable its shadow‐casting (and optionally shadow‐receiving) properties in your custom Needle Engine component. In three.js (and thus in Needle Engine) the shadows are determined by each Mesh’s castShadow and receiveShadow flags. By traversing your object’s scene graph and setting those flags to false, you can prevent it from producing shadows in QuickLook.
Below is an example component written in TypeScript that does exactly that:
import { Behaviour, serializable } from "@needle-tools/engine";
import { Object3D, Mesh } from "three";
export class DisableObjectShadows extends Behaviour {
@serializable(Object3D)
targetObject?: Object3D;
onEnable() {
if (!this.targetObject) return;
// Traverse the object and disable shadow casting and receiving on all meshes.
this.targetObject.traverse(child => {
if ((child as Mesh).isMesh) {
(child as Mesh).castShadow = false;
(child as Mesh).receiveShadow = false;
}
});
}
}
Attach this component to a GameObject (or add it in Unity/your editor) and reference your transparent object via the inspector. With this component active, your object will no longer cast (or receive) shadows, even in QuickLook mode.
This approach leverages the underlying three.js shadow handling as seen in the Needle Engine API (see details in the Renderer settings at Renderer.d.ts.md and attribute docs (docs/needle-engine-attributes.html)) to address your specific case.
Hope this helps! Let me know if you have further questions.
4 replies left
thread_NYGYao7D20H53D4KSnnrfPFx
Reply to this post directly if you need further help (bottom right button)
Contact shadows in QiockLook are still present.