Search Unity

Glowing Bricks/Blocks

Discussion in 'General Graphics' started by kingbaggot, Jun 28, 2018.

  1. kingbaggot

    kingbaggot

    Joined:
    Jun 6, 2013
    Posts:
    51
    Hi - I'm trying to make blocks that I can light up and colour - when they're activated in-game.

    Currently I've got this - where I'm just re-setting the material colour.

    unityLightBlock0.jpg

    But I'm aiming for something closer to this

    unityLightBlock1.jpg

    I can't find a good shader/material to ape this look, and haven't managed to write one myself.
    Could someone point me in the right direction ? Cheers :)
     
  2. GreenWizard33

    GreenWizard33

    Joined:
    Dec 30, 2015
    Posts:
    3
    Hi Kingbaggot,
    You will have to change the emission variable of the material to create a glow effect. If you have the post processing stack (search on asset store) in your project you can use bloom to get a really nice effect.

    Here is an example code to change emission:
    Code (CSharp):
    1.  Material mymat = GetComponent<Renderer>().material;
    2.          mymat.SetColor("_EmissionColor", Color.red);
    Change 'Color.red' to the colour that you wish.

    Hopes this helps!
     
    kingbaggot likes this.
  3. kingbaggot

    kingbaggot

    Joined:
    Jun 6, 2013
    Posts:
    51
    Thanks for that ! I'm already setting my _EmissionColor - what I'm trying to get now is that effect in the mario pic where the centre of the block glows brighter than the edges.

    With emission it's lighting up the whole mesh full-tilt. I'll go check out the post processing stack you mentioned as I've not used that much up till now :)
     
  4. kingbaggot

    kingbaggot

    Joined:
    Jun 6, 2013
    Posts:
    51
    Have got it to this by smoothing out the block and mucking about with a directional light. Still not fancy enough though - am going to start mucking about with the shader I reckon.

    unityLightBlock2.jpg
     
  5. AkiraWong89

    AkiraWong89

    Joined:
    Oct 30, 2015
    Posts:
    662
    @kingbaggot
    If you want to achieve that, you need to learn some basic modeling and texturing skill. Obviously it's a primitive chamfer box + High glossiness value + Hand painted gradient emissive map and can achieving by using soft brush in PS or SP with just one click.
     
    kingbaggot likes this.