Home Technical Talk

Unity iphone shader with vertex blending and lightmaps?

ngon master
Online / Send Message
ZacD ngon master
I don't know anything about making shaders, and was wondering if anyone can help me with this.

Replies

  • osman
    Options
    Offline / Send Message
    osman polycounter lvl 18
    I think if you have the Unity iPhone, you get some that already do that ;). If you're like me, and first develop most of your stuff on a pc, using Unity Basic, then what you can do is, download a trial of Unity iPhone, and snatch the shaders from there. And once you're ready to publish your game you'll have to buy Unity Iphone anyways.
    Hope that helps.
  • ZacD
    Options
    Online / Send Message
    ZacD ngon master
    I couldn't find any finished shaders doing what I wanted, I think I figured out everything but how to do the actual blending.

    I think I figured out how to get everything set up and loaded, now I just need to figure out set up the actual blending, if anyone has any ideas.

    [code]Shader "1UV lightmap with vertex blending" {
  • ZacD
    Options
    Online / Send Message
    ZacD ngon master
    I think I realized my problem, The vertex colors wont export. What format should I work with? I'm using XSI.
  • ZacD
    Options
    Online / Send Message
    ZacD ngon master
    Finally got the colored vertexes to work, now I gotta figure out how to blend it properly.
  • ZacD
    Options
    Online / Send Message
    ZacD ngon master
    hM4qD.png


    Yay for more issues, vertex colors with no shading. :(
  • rube
    Options
    Offline / Send Message
    rube polycounter lvl 17
    check the #unity irc channel on irc.freenode.net (same network as #model_design). There's a few iphone devs there that may know the answer.
  • ZacD
    Options
    Online / Send Message
    ZacD ngon master
    Got it working properly, finally.

    m2aD5.png
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    post at least some nugget or directions on how you did it or what the issue was, otherwise its a useless post for anyone else,
    thx
  • ZacD
    Options
    Online / Send Message
    ZacD ngon master
    There's not many XSI users here, but I'll throw together a quick tutorial.

    Here the shader.
    Shader "Blend + Lightmap" {
    
    Properties
    {
       _MainTex ("Texture 1  (vertex A  = white)", 2D) = ""
       _Texture2 ("Texture 2  (vertex A = black)", 2D) = ""
       _LightMap ("Lightmap (RGB)", 2D) = "" { LightmapMode } 
    }
    
    SubShader
    {
       BindChannels
       {
          Bind "vertex", vertex
          Bind "color", color
          Bind "texcoord", texcoord
       }
       
       Pass
       {
          SetTexture [_MainTex]
          SetTexture [_Texture2] {combine previous lerp(primary) texture}
          SetTexture [_LightMap] {combine texture * previous} 
        }
    }
    
     
    }
    


    In xsi set up the lighting for the scene, make sure everything has unique UV's, and create a render map.

    shift+w brings up vertex color mode.
    ctrl+w brings up the options.

    It has to be in alpha mode, and in order for the alpha colors to show up in the view port, go to display options > Vertex color > show alpha.

    I exported as a fbx, I dunno if it works with the other formats.

    If you have the weird vertex issue that I had above, just select the geometry under polygon selection and extract polygons and delete, my issue may of happened because I tried to merge floaters/seperate pieces of geometry.
  • sama.van
    Options
    Offline / Send Message
    sama.van polycounter lvl 14
Sign In or Register to comment.