Search Unity

Lighting without Lights: Shader to "light" different sides of a cube with different intensities

Discussion in 'Shaders' started by jochou, Apr 26, 2017.

  1. jochou

    jochou

    Joined:
    Jun 21, 2016
    Posts:
    16
    Hi everyone,

    I'm looking to write a shader that simply shades each side of an object, instead of having lighting in a scene. Every object in the scene would use the same standard, with lighting on the top being one intensity, lighting on the left side being another, lighting on the right side being another, etc. Right now I can achieve a similar / the same effect with 3 directional lights, each pointed at certain sides, with different intensities. But that can be a bit costly.

    My gut says to work with a standard Unlit shader, but I'm still trying to work out where/how exactly I can add an "intensity" based on a certain direction in the Unity worldspace.

    For all intents and purposes, everything is a cube.
    simplecube.png
    I basically want to achieve the same effect as the above image, but without any lighting.

    tldr; How do I write a shader that lights each side of an object differently without Unity lighting?
     

    Attached Files: