Jump to content

Shadow not showing with DirectionalLight


pichou
 Share

Recommended Posts

Hey everyone,

I am trying to add a basic shadow in scene with directionnalLight but it doesn't seem to work after all kind of tests.

I tried to get inspiration from other playgrounds : 
https://www.babylonjs-playground.com/#1KF7V1
https://www.babylonjs-playground.com/#IIZ9UU

And I even went in the source code of this great example : 
https://www.babylonjs.com/demos/advancedshadows/

I create one that is not working and where I can't see the difference with other scenes : https://playground.babylonjs.com/#TWANP3 

It seems very basic but I just can't see the problem.

Thanks, Pichou

Link to comment
Share on other sites

Hey Deltakosh,

OK very basic indeed!

I have another question still linked to shadows. I have tested the worldmonger project to show a degraded ground but I can't manage to make the shadows working on this ground contrary to normal groundMaterial.
I saw that the worldmonger ground material use material effects and matrix to build the ground. Do you know if there is a way to had shadows to this system?

Thanks.

 

Link to comment
Share on other sites

You mean that I will have to manually update the shaders?

What I want exatly is the ground to receiveShadows like with a normal BABYLON.StandardMaterial but using the WORLDMONGER.GroundMaterial ! ;) 
 

I have read some of the effect doc used by worldmonger (https://doc.babylonjs.com/classes/3.0/effect), but if you know a simpler way, it would be awesome.

Bye, Pichou

Link to comment
Share on other sites

OK,

The exact property was particle.renderingGroupId. 

By setting to 1, now the particles are in front of every other mesh, which I don't want, I want the particles to be in front of shadows only. Can I rendered shadow just before particles?

I tried different number of  renderingGroupId for both particles and shadowOnly to do that but it didn't work because it creates rendering conflicts with the other meshes.

Link to comment
Share on other sites

Hello again,

I tried to do that deltakosh but it didn't work. I think I a m stuck! :/
Let me explain, I have 4 layers : ground, shadow, mesh and particles. I need my particles to be behind everything except the shadow.

Let's assume these rendering number for these 3 layers : ground:1, shadow:2, particle:3
Then the shadow is in front of the ground and the particles in the front of the shadow : good. But the particles are also in front of the ground and are still shown even when they are under the ground which I don't want.

So I try these rendering number for each layer : ground:1, shadow:2, particle:1
Now the particles disappear behing the ground again. But as the shadow is rendering after, the particles are hidden from the shadow when I want them to be in front the shadow.

With every configuration I have an issue. I have made a playground to make the test easyer : https://playground.babylonjs.com/#WEQHTG
The renderingGroupId are at the end of the code.

Let me know if any of you have come up with something! ;)
 

Link to comment
Share on other sites

The reason is I am working with WORLDMONGER.GroundMaterial : https://github.com/BabylonJS/Website/blob/master/Scenes/WorldMonger/Shaders/Ground/groundMaterial.js

It allows me to build the ground as I want with multimaterial but this ground doesn't receive Shadow. So I have to use the shadowOnly extension as suggested by deltakosh.

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

Hey everybody,

I have the exact same problem with a material which use FresnelParameters. The mesh's material goes in front of particles when the mesh is actually behind it.

Maybe both shadowOnly and this problem are linked?

Here is a playground : https://playground.babylonjs.com/#WEQHTG#5

Would be awesome to have a solution!!!!

 

Link to comment
Share on other sites

OK I would rather say even with the classic shadowGenerator we have the same problem! ;)

See without the fresnelParameter we have the expected behavior : https://playground.babylonjs.com/#WEQHTG#8
Particles are in front of the ground but are not visible when they get behind the groud : logic!

But in your playground the particles are always visible even when they get behind the ground : https://playground.babylonjs.com/#WEQHTG#7
And you can play with the renderingGrounpId but you won't get the expected behavior like in the first playground above.

Same issue I had with shadowOnly.

So I am not saying the problem comes from shadowOnly but as the problem also appear with fresnelParameter, maybe there is a link that could help you resolve this!

Cheers, Pichou

Link to comment
Share on other sites

I did it once with worlmonger so he could receive light, fog, ambiant color and shadows and others. what i had done was to merge the worldmongerMaterial with the standardMaterial and merge the worldmonger shader and standardMateriel shader.

It was a lot of work, but I ended up succeeding. but with the babylon changes that ended up no longer working because the architecture of the shaders has changed a lot, so i stop using worldmonder and is creating my terrain editor using customMateriel. 

My terrain editor can receive mountain, slope/ramps, hole ... and up to Paint 8 different textures (more than worlmonger :D)

See : https://bitbucket.org/JSbabylon/terraineditor

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...