Error with light in terrain

Hello everyone, I have a problem regarding the lighting of a terrain that I generated using a Perlin Noise, specifically in the lighting of the material.
-This is what it looks like when there are no lights, I added the cube so that the error can be better observed, as you can see, the terrain and the cube have their respective materials and do not have lighting.


-When I add a light, the cube lights up, but the terrain remains unlit.

-Now if I activate “Cast Shadows” on the light entity, it turns completely black.

-These are the properties of light

-The PerlinNoise script creates the texture and the material that is added to the terrain.


It seems strange to me that it does not light up because a few days ago its lighting was correct, I hope you can help me, thank you.

SCENE: PlayCanvas | HTML5 Game Engine

Hi @ignacio_padilla,

I think your mesh is missing normals. In your PerlinNoise.js script you are passing an empty array in the createMesh method.

Try calculating them like this and pass it to the method instead:

var normals = pc.calculateNormals(positions, indices);
1 Like

Thank you very much Leonidas, if I deleted that line by mistake and I wasn’t even aware of it, you are a master :grin:

1 Like