Shader Material - Shadow Effect on Cube

Hey guys,

I’m trying to achieve this output using Babylon Shader Material:

The goal is having soft shading on the corners of the box. The intended result should resemble an “inner shadow” on each face of the mesh.

I read documentations about ShaderMaterial but it was little bit confusing for me since I have no experience about it.

Hi @meloturkmen - Invoking shadow expert @Evgeni_Popov

Maybe you can try to reuse the code from @Pryme8 that renders edges with thickness (Trying to get my Barycentric Shader working as a custom material? - #2 by Evgeni_Popov):

Hi @Evgeni_Popov

It looks really good, can’t we get same result with ShaderMaterial? Or is there a specific reason you did not choose to do it with ShaderMaterial.

Using CustomMaterial allows you to use all the features of the StandardMaterial class (diffuse, bump, emissive, … textures, lighting, etc). You can of course do the same thing with ShaderMaterial, but then you won’t have any of the facilities from StandardMaterial available.

1 Like