Search Unity

Adding lightmap to a "vertexblend" shader

Discussion in 'Shaders' started by kondrup, Jun 4, 2013.

  1. kondrup

    kondrup

    Joined:
    Apr 23, 2009
    Posts:
    205
    Hi guys,

    I recently stumpled upon this fantastic shader that blends between two textures using vertexpainting.
    I want to add a lightmap to this shader (this way I can bake lightmaps in an external application).

    Here is a video of the vertex-blending shader:
    http://www.youtube.com/watch?v=HDXwSEUYrbI

    Here is the shader code:
    https://dl.dropboxusercontent.com/u/700791/Vertex Material/VertexBlend.shader

    Here is a 2 minutes video showing what I am after (takes a few seconds to start): http://coindrop.dk/unityforum/shader_problem.mp4

    $duck_vertexpaint.jpg

    Hope someone's got a minute to help a graphic guy in deep water :)
     
    Last edited: Jun 4, 2013
  2. Annihlator

    Annihlator

    Joined:
    Oct 15, 2012
    Posts:
    378
    I think one of the following two thread has your solution;

    http://forum.unity3d.com/threads/92258-Custom-lightmap-Surface-Shader
    ^ In case you want to use the normal material UV for your lightmap

    http://forum.unity3d.com/threads/76298-Custom-lightmapping-shader
    ^ In case you want to use the UV2 for lightmapping.

    I have tried using neither, just remembered having read these topic before when i wanted to figure out how lightmap behaviour is (first link mainly) and how to implement it with beast compatibility (second link)

    Hope it helps you out a bit!
     
  3. kondrup

    kondrup

    Joined:
    Apr 23, 2009
    Posts:
    205
    Hi Annihilator thanks for your reply. I will take a look at it later today - although I fear that I will run into a dead end again since my programming skills are somewhat limited ;)