Search Unity

New relief mapping techniques (fast)

Discussion in 'Made With Unity' started by tomaszek, Sep 26, 2012.

?

Relief shader pack distribution question

  1. Do you like idea of spliting product into 2 (terrain + general POM shaders) ?

    33.3%
  2. If you'd like split option, would you accept $30+$30 price ?

    24.2%
  3. If you'd like split option, would you accept $40+$40 price ?

    21.2%
  4. If you'd like split option, would you accept $50+$30 price ?

    3.0%
  5. If you would like to have it as a bundle, would you accept $40 price ?

    33.3%
  6. If you would like to have it as a bundle, would you accept $50 price ?

    24.2%
  7. If you would like to have it as a bundle, would you accept $70 price ?

    21.2%
  8. Do you feel additional feature - placing details by steep/height would be important in the package ?

    33.3%
  9. Do you need applying such terrain shader on your own meshes ?

    63.6%
  10. Do you accept a bit of performance drop, but have features like volumetric grass integrated ?

    45.5%
Multiple votes are allowed.
  1. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    I'm still working on it. Esp. need terrain replacement shader to be as fast and robust as possible. Stay tuned. I guess it will be somewhere around end of this week or next week (I hope :) ). Meantime I'll aklso have to test it on Unity4 and add multiterrain handling (as it's possible in U4).

    Tom
     
  2. John.T

    John.T

    Joined:
    Nov 15, 2012
    Posts:
    7
    Amazing work, really impressive! :)
     
  3. LukaKotar

    LukaKotar

    Joined:
    Sep 25, 2011
    Posts:
    394
    WOW, looks supper nice! I am wondering though, is it restricted to the terrain (seen in the latest demo), or can it be used across other meshes as well? :) Also, if it will be for sale, will it be on the Unity Asset Store? It's a must-buy for me! ;)

    Running the Unity Web Player version 4.0.0f7 on Mac and got between 59 and 60 FPS, with no problems, if that helps ;)

    EDIT:

    I should have read the previous posts. Sorry about that.
     
    Last edited: Nov 16, 2012
  4. LukaKotar

    LukaKotar

    Joined:
    Sep 25, 2011
    Posts:
    394
    I think I might have spotted a bug. At some light angles/positions, some white lines appear over the terrain.


     
  5. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    I've noticed it in forced opengl mode too. I know the reason, although making the shader for OpenGL is much harder than expected. Simply it gets very complex conditionally and Cg->GLSL generates freaky inefficient GLSL code (Aras probably never expected that somebody would like to write that insane shaders to be GLSL optimized by his converter...). In worst case I'll be forced to implement GLSL version "by hand" which I would like to avoid... (I'm not familiar with GLSL semantics). D3D9 version is almost ready. A few tweaks for sorting out conditional branching good way is needed now.

    Meantime I'd like to know from developer/artist point of view - how would you like the global color map to work ? Now I've implemented it this way (by intuition of what could be handy). I sample colormap and blend it in 3 ways depending on distance (smoothly interpolating):

    1. very close - user can specify how much color of colormap will be applied to fianl color (mixed with near distance POM+normal shading)
    2. mid range - separate blend value. At this distance we don't see POM effects nor normal mapping, only splat maps + global color blended (depending on distances set we could see global normalmap added for adding ligthing detail)
    3. mid range - far range. In this range pixel colors are set like in (2), but at far distance we see fully global bumpmap

    There is no "basemap" used at all (user can set it's resloution to small value to save resources) as it would not blend well with global colormap/global normalmap.

    Is this OK for you ? For people familiar with Lars ats system I'd like to make it similar way (or the same handy way), because I believe his solutions are quite well resolved in terms of usability (my terrain shader is my first terrain replacement work so many things might be just wrong).
     
  6. Knightmore

    Knightmore

    Joined:
    May 11, 2012
    Posts:
    227
    The most annoying thing with all those better terrainshaders is, that you can't deactivate the color map and only use an external splat, detail with normal and a normal map for the whole terrain. Even if I leave the colormap empty, I get some graphical issues with my terrain. So a version without colormap would be great.
     
  7. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    It will be optional (as simple as switching off COLOR_MAP define in shader code). Also - it will be a little bit faster (don't expect performance boost as it's only one texture fetch among maaany other in fragment program).
     
  8. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Hi guys (girls ?),

    I hope you didn't forget my shader :) Here is the newest version for testing:

    http://www.stobierski.pl/unity/Terrain_WebPlayer_beta/WebPlayer.html

    Some limitations have been removed, so now it's like this:

    1. one terrain (in Unity3, in U4 - doesn't matter)
    2. 8 splats with my shader + more splats - blended classic way (I didn't tested it yet, but should work as I haven't touched AddPass shader, and if you'll really need it I could look into issue because global colormap may interfere).
    3. Uniform (the same) tiling for every splat

    As I compacted it into one pass (yes, it's possible by atlasing detail color mapsinto 2 atlases) good, hard borders between any splat is now properly handled ! However beware - large areas where splat groups are blended (for example splat 0 from group 0-3 and splat 7 from group 4-7) are the most expensive as I have to blend together up to 8 materials (with borders, POM, shadows, etc.). It's recommended to keep "cross splat groups" blending areas as small as possible. In the example we've got such situation where sand is touching yellow rocks/dry ground around the isle (hide water to see it).

    And the most important - performance boost - just go and compare original version with beta version (I hope final). Massive optimization work has been done. More - the shader is fully backward compatible - up to SM2.0 cards - by consequtive fallback subshader versions. I've implemented:

    1. Full POM (as an adaptation of steep parallax algorithm) with self-shadowing

    2. PM (regular parallax mapping). Ground looks quite good in this mode and it's recommended to use this as it gives the best quality against performance, but hey - full POM is also reasonably fast on mid-hi hardware. Just check end-user machine and turn on POM when needed (with one line of code - setting maximumLOD of the shader to 700).

    3. "Simple Mode" - as the sahder would be still slow on low-end machines we can remove bumpmapping but still hold well defined, hard borders between materials

    4. "Classic Mode" - the simpliest version - just classic way to handle the terrain - regular blending between splats 0-7. This versions works on old GPUs with SM2.0.

    Currently I don't handle situations where less than 5 splats are used (should I ?). Such version could be also possible and shader code would smaller (not faster because it's optimized for such case).

    One of user asked me if it's possible to use it on arbitrary mesh - no problem. You'll just switch on one define in shader code so that we don't recalculate tangents inside vertex program (Unity terrain doesn't have it by default as in Unity3). I'll probably prepare such version in the package.

    And the last concern - OpenGL (Mac) users. I hope the shader just will work now on every configuration as it's done in one pass... Please let me know.

    Tom
     
  9. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    When I enable Antialias in the web player my macbook pro with ati video card will crash, I can still move the mouse but the screen is frozen.
    I don't know the reason, just state what I see.

    15-inch, Early 2011
    8 GB 1333 MHz DDR3
    2.2 GHz Intel Core i7
    AMD Radeon HD 6750M 1024 MB
    Mac OS X Lion 10.7.5
    Safari Version 5.1.7
     
    Last edited: Nov 19, 2012
  10. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Oops, seems like Unity doesn't like terrain replacement shader together with fullscreen FXes (or only Antialias FX makes trouble). ImaginaryHuman also had such problems. I guess I can't help this moment, but maybe in Unity4 (or future Unity3 updates) the problem will be solved.
     
  11. LukaKotar

    LukaKotar

    Joined:
    Sep 25, 2011
    Posts:
    394
    Hmm... It works perfectly fine on my MacBook... I did full-screen, disabled forward rendering and enabled shadows, and checked all other checkboxes. Tried out all the available mapping techniques also. All that with no problems! (Also the "white line bug" seems to be gone.) :)
     
  12. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Hooray, but ... I'll get my champaigne as soon as Wolfos acknowledges that terrain displays fine (he has problems with various terrain replacement shaders realized in 2 passes).
     
  13. sipon

    sipon

    Joined:
    Feb 8, 2009
    Posts:
    143
    Impressive shaders !
    Run very fast ! ( 220 fps, on gtx570 at 2560*1600 for the first demo )
    have you got a release date ? price ?
     
  14. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    590
    Running this on a MacBook Retina : OSX 10.8.2, NVIDIA GeForce GT 650M 1024 MB, 2.6 GhZ i7, 16GB 1600MHz DDR3 RAM

    The speed is identical, regardless of settings, about 59-60 fps. Even with POM and all options on. I couldn't see any artifacts. Looks nice!
     
  15. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Please, look at my poll.

    Meantime I'm working on geometry blending tool (yes - fully integrated vertex painter that will allow users to blend their geometry against terrain) + Unity4 compatibility issues. I believe AssetStore release time is coming close.

    ATB, Tom
     
  16. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I really liked those options, one thing i considered was that while i wouldnt buy the bundle as im mainly interested in the terrain, i would expect the bundle to be priced with the terrain being the main contributor, so i should happily pay 40 for the terrain system on its own. The last 3 options are great ideas but i would hope they dont work you harder than you already have at this stage, especially without renumeration.. maybe you could have 'premium' version or whatever for terrain with all the tricks. With the mesh blending tool being done too, this is a formidable package and your prospective pricing is generous, i was worrying i wouldn't be able to afford something i particularly wanted again. I'm actually quite excited about this and hope to get my hands on it before my unity 4 pro trial does expire so i can set about doing a fancy tech demo with everything all singing and dancing, as i've something in mind and my main model for it's nearly finished so yes, im hoping to make a very pretty thing!
     
  17. Knightmore

    Knightmore

    Joined:
    May 11, 2012
    Posts:
    227
    I really like the idea of combining this shader with a geometry blending tool and volumetric grass. This would produce stunning environments together with a good sculpting application. Can't wait to buy it!
     
  18. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Hi,

    Geometry blending is ready - way to put anything on the ground+cavern is clear ! It's tough to realise it working well in every situation, so I'm posting kind of stress test here:

    www.stobierski.pl/unity/Terrain_WebPlayer_beta2/WebPlayer.html



    There is no practical way to make shader which would blend well parallax materials, so in blend areas it has to be flat. I control it by terrain global colormap alpha channel (1 means POM height=0). In addition it must be 2 passes shader as terrain shader is pushed to the limits in terms of resources available. I optimized it this way that first pass (mimic terrain) shows in areas where blend is not zero, this way it costs more only where you mix. On places where we see only geometry material it's free (fragment shader doesn't compute anything).

    What you see in the demo is geometry blend material with my full POM/self shadow/detail. Hard to say, but it costs too much work to master shader, blending tool, etc. so that I guess I can't put it into terrain package @ requested $40 (by most poll voters). Geometry blend shader will be only bumped specular, but user will be able to put his own geometry surface shader into my code so it can be custom. I think $40 for terrain shaders + geometry blending is good enough for that price. Better geometry blending shader (like in example) will be available as a part of POM shaders.

    I've got the dilema - give you more for less and count on higher sales or offer it @ $40 (terrain) +$30 (all POM shaders). Anyway I could work much harder on the theme (grass, more cool stuff to compose control maps depending on steepness), better geometry blend shaders, additional goodies, etc. IF I only know it will sell good. As I see only 14 voters gave their feedback. I must admit my feelings are that in pesimistic case I'll sell my product like my grass which barely compensated my work after 1,5 year of selling.

    So many ideas for shaders but so little to hit larger audience, so by now I just can't spend more time on it. I don't know how would you all feel about it, so don't understand me wrong, but would it be good idea to ask users for promoting my product among friends ? In reward, as I'll see it just sells, I could constantly add new features on the same product - I mean no new product, but free updates for existing users. Staying humble, but I really feel this product has big potential. BTW - it's pity AssetStore doesn't give upgrade functionality.

    ATB, Tom

    P.S. If you really fell anxious about performance - relax, just render most of your stuff _before_ most expensive shaders (terrain, POM). I just render additional geometry objects in queue "geometry-101" so it's done before terrain. This way terrain under blended geometry is almost free (precisely its fragment shader due to z-test GPU optimization). If you make scene with lots of plants, trees, cheaper (only bumped) rocks - everything could work actually _faster_, not slower compering to my stress demo, because bottleneck is POM on terrain...
     
    Last edited: Nov 27, 2012
  19. LilWiebe

    LilWiebe

    Joined:
    Sep 25, 2012
    Posts:
    69
    I wouldn't worry about how this sells compared to your grass, this is WAY better and I think you will be blown away by the sales you get on your parallax stuff.
     
  20. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    very well done!

    lars
     
  21. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    I know of one asset that has been a victim of scope creep, imo. It's still got issues, and has a lot of potential, but misc features have somewhat cluttered up the main beauty of the product.

    Just my $0.02 ...I think you should go ahead and put the terrain and mesh POM shaders on the store. They are awesome, and I think will appeal to a much wider audience than the volumentric grass product. I do think they should be two different products.

    Maybe you could put the enhancements on the asset store also, with instructions on how to get those enhancements working with the previous shaders. I don't know if that would be practical or not, but it would allow people to pick and choose smaller features to add to the main ones.
     
  22. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    There are (almost) all shaders that will be relelased in Relief Shaders Ultra (separate from Relief Terrain Ultra):

    http://www.stobierski.pl/unity/ReliefShaders_WebPlayer/WebPlayer.html



    + space station shader (variation of distance map extrusion)
    + POM shader that will allow to represent objects with REAL depth (mesh volume dont have to be flat anymore).
    Some idea of how does it work you can see at extrude shaders (disks hollowed with deco). Extrusion is realised via script in direction of normals, so we can imagine any flat mesh could be extruded. Look at example - two disks are flat, but other two are curved. Shader can correctly interpret such mesh so that extruded object constitutes real volume (disks have depth).
    + POM that can be injected into "Terrain Relief Ultra" geometry blend (instead of simple bumped specular).

    I'll try to put such POM "real volume" shader tomorrow (I have to model or get hi-poly detail, make low-poly mesh volume for it + height map). This way we'll be able to enrich scenes with "hi-poly" like details (architectural decos, small environment elements, whatever).

    Of course everything self-shadowed + many other options are standard.
    The most visually advanced is probably POM with real sihouettes (I mean - real real ones - full implementation of Policarpo's idea as I bake curvature via tool script into mesh colors - we can achieve per-vertex curvature, not only static/constant curvature like in, for example, original Apple Motion implementation).

    Of course there are also issues - esp. in forward rendering/directional light. We can not see shadows of object itself thru holes (in deferred it's OK). More - holes cut in such (POM) shaders where we implement silhouettes are screwed when you (simultaneously):
    1. use forward
    2. use shadows
    3. use postFX
    4. don't use MSAA (any - I use 2x antialias in the example to hide this mess).

    One can look at the end of my thread about VolumeGrass - there is in-depth explanation and possible workarounds. Don't blame me, I hope Unity will fix it ASAP and I believe this is problem of every such alpha cutout shader available now. To solve it best way we could... (OK, I won't tell you now, it's reserved for updates of my products :) ).

    I think I'll also publish some kind of free teaser as very narrowed list of shaders with smaller features (yet usable) for users to get taste of full product.
     
    Last edited: Nov 28, 2012
  23. Venged

    Venged

    Joined:
    Oct 24, 2010
    Posts:
    500
    I have a GTX 560 Video card. Will it work with this asset? This really looks great and I would like to use it in my RPG.

    Thanks

    Robert
     
  24. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    GTX560 ? Don't have access to this GPU myself, but should fly as most shaders here needs muuuuuuch slower hardware to run reasonably fast :)

    BTW, package has been released, let's move there:

    forum.unity3d.com/threads/161412-RSP-Relief-Shaders-Pack-on-Asset-Store
     
  25. Pulov

    Pulov

    Joined:
    Feb 20, 2010
    Posts:
    824
    aaaaaaaamazing. Tested your demos, all work great and smooth, 50FPS. They feel absolutely awesome. I'll consider this package.
     
  26. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862