Search Unity

Advanced Shaders for realtime lighted terrains [update_04]

Discussion in 'Made With Unity' started by larsbertram1, Mar 2, 2010.

  1. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    i will have to make some changes to my dropbox.
    meanwhile you can just download the shaders (from the link above).
    read the documentation on page 2 or 3 of this thread in order to learn how to apply and tweak them.

    lars
     
  2. Tom163

    Tom163

    Joined:
    Nov 30, 2007
    Posts:
    1,290
    hm, doesn't work anymore in Unity 3 - here are the errors:

    Code (csharp):
    1.  
    2. Shader error in 'Hidden/TerrainEngine/Splatmap/Lightmap-FirstPass': GLSL vertex shader: ERROR: 0:290: 'glstate' : undeclared identifier  at line 22
    3.  
    4. Shader error in 'Hidden/TerrainEngine/Splatmap/Lightmap-FirstPass': Shader program had errors at line 23
    5.  
    6. Shader warning in 'Hidden/TerrainEngine/Splatmap/Lightmap-FirstPass': Upgrade NOTE: SubShader commented out because of manual shader assembly at line 35
    7.  
    8. Shader error in 'Hidden/TerrainEngine/Splatmap/Lightmap-AddPass': GLSL vertex shader: ERROR: 0:290: 'glstate' : undeclared identifier  at line 26
    9.  
    10. Shader error in 'Hidden/TerrainEngine/Splatmap/Lightmap-AddPass': Shader program had errors at line 27
    11.  
    12. Shader warning in 'Hidden/TerrainEngine/Splatmap/Lightmap-AddPass': Upgrade NOTE: SubShader commented out because of manual shader assembly at line 39
    13.  
    14. Shader warning in 'Hidden/TerrainEngine/Splatmap/Realtime-AddPass': No subshaders can run on this graphics card
    15.  
    16. Shader warning in 'Hidden/TerrainEngine/Splatmap/Realtime-AddPass': Upgrade NOTE: SubShader commented out; uses Unity 2.x style fixed function per-pixel lighting. Per-pixel lighting is not supported without shaders anymore. at line 11
    17.  
    18.  
     
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    i am working on it…
     
  4. Ricks

    Ricks

    Joined:
    Jun 17, 2010
    Posts:
    650
    Please keep up the good work on the terrain shaders. Normal mapped terrain makes visual quality so much better and in addition to that almost any today's game uses terrain shaders (starting from old Doom3(yes it had small terrain parts), C&C3 etc.). It's almost a shame that this is not implemented by Unity themselves therefore terrains look cheap and low quality :( This feature is long overdue...
     
  5. spcbeck

    spcbeck

    Joined:
    Sep 3, 2010
    Posts:
    17
    Hey man, incredible work. I'm having a few issues though:

    1)fixed

    2)The package doesn't seem to want to import into Unity. Not sure if this is related to your package - I could just be dumb.

    Hoping to get this working soon!
     
  6. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,821
    Lars, you are T3h 1337 H4X0RZZzz! ;)

    Seriously, this is awesome work, Unity needs to update Indie with some of these shaders - not that the normal ones are bad or anything. These are just better.
     
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    you won’t benefit much from those shaders using unity indy as most of them just add real time shadows to the original shaders. sorry about that.
     
  8. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Good work, :)
    Are theses shaders, compatible with Unity3?
     
  9. gokhanertem

    gokhanertem

    Joined:
    Aug 31, 2009
    Posts:
    95
    there is flickering when glow is off?
     
  10. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    unfortunately they are not.
    but i have spent some time to port them to unity 3. have a look at
    http://forum.unity3d.com/viewtopic.php?p=377501

    lars
     
  11. spcbeck

    spcbeck

    Joined:
    Sep 3, 2010
    Posts:
    17
    I really wish I could get this to import. It gets stuck on coyote@gallop.ma, and I'm not sure what to do about it.

    Any clues?
     
  12. Slem

    Slem

    Joined:
    Jan 28, 2009
    Posts:
    191
    You need Maya to import .ma. I'm not sure if there's a workaround.
     
  13. spcbeck

    spcbeck

    Joined:
    Sep 3, 2010
    Posts:
    17
    I have maya, but I don't know why I would need it for importing a unity package into a new unity project.
     
  14. Slem

    Slem

    Joined:
    Jan 28, 2009
    Posts:
    191
    Hmm. I had the same problem when I used the Maya 2011 Fbx plugin with Unity 2.6.1. Unity 2.x is only compatible with the 2010 plugin (or older i suspect). But Unity 3.0 should be compatible with Maya 2011. Any experts have an idea?
     
  15. spcbeck

    spcbeck

    Joined:
    Sep 3, 2010
    Posts:
    17
    Edit: Can you provide any documentation as to how you recreated this? The only part I'm getting lost at is how you calculated your lightmaps.
     
  16. spcbeck

    spcbeck

    Joined:
    Sep 3, 2010
    Posts:
    17
    Just to provide a little more info, if you can let me know how you got this working as far as the transition from pixel lit to lightmap then I was planning on writing a new shader which will have slightly different functionality.

    Basically, there will be 4 textures. The first three will be the RGBA of your textures that you want to use on the terrain. The last texture will be another 32 bit RGBA with the RGB as a 24 bit bit bump map for the grass, or whatever your texture is used the most. Then, I will take the alpha channel from the first three textures, read them in as seperate 8 bit channels representing R, G, and B, to get another fully formed bump map. Finally, the last alpha on the other 24 bit bump will be used with your basic idea of the 8 bit faked bump map to give the last texture a simple 8 bit bump.

    So basically, three textures, two full 24 bit bump maps, and one 8 bit bump for the simplest texture.

    So if you can provide anymore info on your exact steps as far as making the lightmap, I would really appreciate it. If you used the CustomLightMapper that's included in your project then it looks like I'm going to have to go find a mac, or write my own in CG.
     
  17. loock_

    loock_

    Joined:
    Aug 4, 2010
    Posts:
    18
    Hello,
    I've got 2 questions:

    1. How did you manage to create your custom terrain lightmap including tree shadows? I saw the popular LightmapWizard script in your files but it seems not to work anymore in 2.6. It throws me several error including "VertexLit-BaseMap: no subshaders can run on this graphics card" and "Material doesn't have a texture property _BaseMap".

    2. Apparently, you managed to solve grass lighting problem (in another thread I guess) using custom shader, however when I turn off the main light and set ambient light to pitch black, grass is still lit.
    How can I make the grass working in day/night cycle, so that I can see grass as black at night (now it's not affected by light at all)? Your shader from here: http://forum.unity3d.com/viewtopic.php?t=28053 doesn't do the job..
     
  18. Gian-Reto

    Gian-Reto

    Joined:
    Nov 19, 2010
    Posts:
    26
    Sorry for Threadomany, but I've got a question:

    - I would like to add realtime shadows to my Gras.... which Part in the VertexLit Shader is responsible for that? What part do I need to add to the Gras Shader?

    - Any chance that I can hack the terrain scripts somehow, so I can "send" bump maps to the Gras shader (by editing the Unity GUI component of the terrain script)?

    No idea if hacking the gras that way is a good Idea, but I would like to give it a try.....
     
  19. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    591
    can somebody upload the package again pretty plz :(
     
  20. Gaski

    Gaski

    Joined:
    Jul 25, 2011
    Posts:
    84
    I downloaded the ATS v2 and everything works okay accept I just can not seem to get Bump Maps working on the trees that I place with the terrain system. I have assigned the new bark shader and assigned it a normal map but I am getting nothing?
     
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    @gaski: you will need the tree bark shader from ats v1! as ats v2 does not ship with this shader.
    and you might have to restart unity after importing in order to make the shader work.

    lars