Lights from blender while export

HI,

I m exporting glb from blender for my work, The lights as shown in the below image are ok before export.

and when i load in bablonjs file it looks like below, is anything wrong am i doing, i m new to blender.

1 Like

Pinging @PirateJC

Hey @amark, judging by the images alone, I’m questioning whether the lights were exported from Blender at all? Can you see the lights in the inspector?

On that note, can you provide a playground so we can help troubleshoot?

It would also be helpful to know how you’re exporting from Blender. Are you using the built in .gltf/.glb exporter?

It’s GLB file exporting from blender, now I can inspect lights but area lights are not working after export, instead of area light now i m using point light, as well how to shadows while export. shadows not appearing on the scene. and another I need how to get lights from the exported file as we get mesh id by scene.getMeshByID(“Mesh09”), but in lights class name is TransformNode.

1 Like

@amark

  1. Hello)
  2. As far i know you can`t export shadows via glb files, but you can use Shadows | Babylon.js Documentation
  3. If glb was exported from blender you shoud check the Punctual Lights checkbox to export lights.
    In this case, the structure for each light will look like this:
    LightName(transformNode)->LightName+Orientation(TransformNode)->Light(Light)
    image

Maybe it can help you)

lights i can see. Now i m trying to generate shadows from the exported lights

the next below line trying to get light but getting error.

var PointL = scene.getTransformNodeByID('Point);

recv_sd.forEach(sdm => {
sdm.receiveShadows = true;
});

var sG = new BABYLON.ShadowGenerator(1024, PointL);
var sgSP = new BABYLON.ShadowGenerator(512, PointL);
sgSP.usePoissonSampling = true;
sG.useBlurExponentialShadowMap = true;

           sd_under_Light.forEach(sdm => {
                    sG.getShadowMap().renderList.push(sdm);
                });

As I see in your code you try to create ShadowGenerator but you can not send TransformNode to ShadowGenerator constructor. If you use: var PointL = scene.getLightByID(“Point”) It should work for you

1 Like

Thank you its working, and max lights on mesh not to material like mesh.material.maxSimultaneousLights = 10;

1 Like