Not default IBL shadows?

Playing around getting a scene from another engine running in babylon , I am shocked to see your IBL solution using HDRI’s do not just generate shadows as they should, with expected controls to modulate the strength.

Instead it seems you have to create your own light in the scene ,separate and in addition to the HDRI usined for ambient lighting and then create a ShadowGenerator class passing in this light and then also have to manually stipulate the catcher and receiver objects . This seems a bit crazy!

Please tell me im thinking about it the wrong way and that IBL via HDRI generates shadows automatically and then all I have to do is user some scalar to modulate the strength.

There must be a win / win solution here right?

How shadows are setup in this other engine? In Babylon you indicate that a light should generate shadows (by creating a shadow generator for it), then you flag the meshes as either shadow generator (you push the mesh to the list of the shadow casters of the shadow generator) / receiver (you set mesh.receiveShadows = true) or both.

It seems to me to be quite normal steps. Notably, you would not want that Babylon automatically sets all meshes as shadow caster/receiver, you generally want a finer control over that. And would you want that, just do something like:

scene.meshes.forEach((m) => {
    shadowGenerator.addShadowCaster(m);
    m.receiveShadows = true;
});

Only 4 lines of code. Add one line to create the shadow generator and you have the basic setup of shadows in 5 lines of code. Not so bad I would say.

Note: you are speaking of IBL shadows, I don’t really know what you mean. Shadows are setup as described above. If you are speaking about baked shadows, it’s something to handle in an external tool that will generate light maps ready to be used.

1 Like

well comparing it to the sketchfab viewer , they have 3 possible scene lights , which you can enable shadows or not. But if none of those lights are enabled, you still have the IBL from the HDRI. In addition to this somehow they have a light that generates shadows as if from the HDRI. You can modulate its strength and also turn it off if required. Im sure it is an internal directional scene light which is programmed to act as coming from the HDRI.

I do agree having finer control is actually better as you have it., when you want that control - but I Just
think the simplicity of also just having an “auto” directional light lined up with the HDRI and enabling all mesh as castors for this auto light would be nice as well.

@Evgeni_Popov here I made a quick 2 minute video showing this faked hdri shadow feature in sketchfab.

Again this is not optimal and your per mesh control is more feature rich for sure , just a quick and dirty solution like this is also a nice to have :wink:

Shocked huh? hahah XD…

After watching your video it looks like all they are doing is projecting the depth pass of the bike onto the ground from a set position in relation to your environment, that should not be too hard to do. Why would a normal shadow projection not work for your setup?

yes shocked lol :wink:

I just enabled the ground shadow catcher in the video to make it obvious the light is attached to the HDRI orientation. I think focusing on that made it not obvious that all mesh objects are shadow casters and catchers, not just this ground plane.

The thing im pointing out here is ease of use , dont overlook that this lights direction is synced with the HDRI orientation and also set to be the angle from the brightest spot in the HDRI and that is all automatically calculated by the engine + all objects are shadow casters and catchers and it can be enabled and disabled with the flick of one boolean :wink:

Babylon is great in having finer controls , more controls , more features and yes you can code anything you like but it can learn a thing or two about providing dumbed down ease of use scene setups. Why not be good at two things

I personally could use something like that, just imagine :

HDRIShadowsEnabled = true /false ( yes we know it fake , we dont care )
HDRIShadowsStrength = 0-1 ( or whatever )
HDRIShadowsBias = 0-1 ( or whatever )

Yeah that makes me sad as well :slight_smile:

happy ok, i cant escape this one , It was late at light , i had my pills and coffee , i was was on top of the world. we have all been there before , you know , when rainbows shine out your … hehe

Sorry for being so dramatic, it is funny and you may laugh for sure…even im laughting… BUT I will be back and stronger next time… probably not so late at night or on a medicine head buzz again haha

1 Like

haha ok sounds good ;D