Hi
I was trying to apply shadow to my model, but after using all the methods no shadow got rendered. I tried with a simple isosphere and was able to render its shadow but using the same code, my model was not able to generate the shadow
Please help me with the solution
render() {
let baseUrl = "http://localhost:3001/assets/";
var modelScale = 1;
var modelPosition = new Vector3(0, 0, 0);
var modelScaling = new Vector3(modelScale, modelScale, modelScale);
var modelRotation = new Vector3(0, -15, 0);
return (
<div style={{ height: '100%', width: '100%' }}>
<Engine antialias adaptToDeviceRatio canvasId='babylonJS' style={{ height: '100%', width: '100%' }} >
<Scene canvasId="scene_1" style={{ height: '100%', width: '100%' }} >
<ArcRotateCamera name="arc" target={new Vector3(0, 1, 0)} minZ={0.001} alpha={(-Math.PI / 2) + 0.5} beta={(0.5 + (Math.PI / 4))} radius={10} lowerBetaLimit={(Math.PI / 2) - 1.5} upperBetaLimit={(Math.PI / 2)}
lowerRadiusLimit={5} upperRadiusLimit={15} />
<HemisphericLight name='hemi' direction={new Vector3(0, -1, 0)} intensity={0.8} />
<DirectionalLight name="dl" direction={new Vector3(0, -0.5, 0.5)} position={new Vector3(0, 7, 0.5)}>
<ShadowGenerator mapSize={1024} useBlurExponentialShadowMap={true} blurKernel={32} shadowCasters={["Bike","counterClockwise"]}/>
</DirectionalLight>
<Model
rotation={modelRotation} position={modelPosition}
rootUrl={`${baseUrl}bike/`} sceneFilename="Bike.glb" onModelError={this.onModelError_}
onModelLoaded={this.onModelLoaded_} onLoadProgress={this.onLoadProgress_} onCreated={this.onCreated_}
scaling={modelScaling} />
<IcoSphere name="counterClockwise" position={new Vector3(-0.5, 1, 0)} radius={2} flat={true} subdivisions={1}>
<StandardMaterial
diffuseColor={Color3.Yellow()}
specularColor={Color3.Black()}
/>
</IcoSphere>
<EnvironmentHelper options={{ enableGroundShadow: true, groundYBias: 1 }} mainColor={Color3.FromHexString("#74b9ff")} />
</Scene>
</Engine>
</div>
);
}
}