I have a camera which shows a "bird's eye view" of a procedurally generated mesh like so:

camera looking down on mesh

Currently in the editor view (right), the terrain looks exactly as I would like it to. However, in game (left) I haven't been able to get it to appear as I would like:

game view next to scene view

I was using a directional light above, which was causing the effect where the centre of the mesh appears "shiny". So I looked around at some forum posts and questions on here and decided to try using ambient lighting instead by altering the settings in Window>Rendering>Light Settings, but this is the result:

ambient lighting, mesh looks dark

This is the material I'm using (EDIT: I'm using a particle shader as the colouration of my mesh is based on altering Mesh.colors. ):

material settings

I have tried fiddling around with different material types but I couldn't get better results. My question is: how do I set up my game to use the same lighting that's being used in the editor?

Thanks in advance

EDIT: Camera settings at runtime as requested:

camera settings

EDIT 2: Just to update; I have still not managed to fully solve this problem. I ended up using some different colours for my heightmap and tweaking the Metallic and Smoothness properties of the material, and the shininess and non-even lighting is somewhat diminished, but it does still exist.

If you watch at about 20 seconds into this video, when the mesh is dully coloured, the "circular" lighting effect is still present, which shadows being cast from the centre outwards, and the middle appearing almost blurred and the edges sharp.

Later in the video you can see a colourful version of the mesh, where these undesirable lighting effects are barely noticeable (note that I don't always want it to be be in bright colours, hence this is still an issue).

I feel like there should be a very simple solution to this. Why can I not get the lighting conditions that I see in the editor in the game view?

I am very happy to keep updating here with further progress/clarifications, and would love to hear any suggestions anyone has.

  • \$\begingroup\$ What you are after is an "unlit" material and/or shader. (it's also kind of odd to use a particle shader for terrain, but you could approach something similar by setting 'metallic' and 'smoothness' both to zero using your current shader). \$\endgroup\$ – Timothy Groote Feb 15 '19 at 12:14
  • \$\begingroup\$ The mesh is a heightmap, and its colouration is set by modifying the Mesh.colors array. This only seems to work properly when using a particle shader for some reason. Is there no way to set up the game to use the same lighting as in the editor? Edit: I have also just had a go at setting the material to all the variations of "Unlit", however this just makes the whole mesh one colour, and I lose my heightmap colouration. \$\endgroup\$ – Patrick Thorpe Feb 15 '19 at 12:19
  • \$\begingroup\$ Can you show us your camera settings? \$\endgroup\$ – DMGregory Feb 15 '19 at 12:46
  • \$\begingroup\$ Sure, I'll add them in an edit. \$\endgroup\$ – Patrick Thorpe Feb 15 '19 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.