Search Unity

  1. Unity 2017.2 beta is now available for download.
    Dismiss Notice
  2. Unity 2017.1 is now released.
    Dismiss Notice
  3. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  4. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  5. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice

VOLUME GRASS - Unlimited Density

Discussion in 'Assets and Asset Store' started by tomaszek, Jul 11, 2014.

  1. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,385
    VGThread_Logo.jpg

    AssetStore - get it on Asset Store

    Image1NoLogo2.jpg
    Above picture produced basing on real screenshot - go for interactive soccer demo.

    As an imposting volumetric solution - put just one triangle and get countless grass billboards !

    Although the package is $75, note, that traditionally (like in case of my other products) update to Volume Grass 2 (and up) will be free.

    This thread has been reconstituted as old VolumeGrass V1.1 you can find here. VG 1.1 is 3 years old now. It is just about time to forget about that solution as we're in 2014 now and so many new things can be done since Unity2.6... :).

    Main advantages of the new version (1.5) that's right around the corner:

    1. Simplier, more intuitive and clean user interface.

    2. Convinient custom material inspector for grass shader. No more "space shuttle cockpit like" look. All features grouped logicaly and to be enabled / disabled dynamically. No more need to configure shaders by hand - it's all available via material properties.

    3. Grass is textured basing on world global coords, you don't need to worry about how to put VG on your own mesh. Although there is handy mesh editor included, there is also dedicated script that will turn any flat model into volume grass, carving sidewalls and managing basic parameters, rest you can do using new material inspector.

    4. Brand new wind handling. You can specify one directional and one spherical wind zone to affect the grass. Look at the new meadow demo for reference. While we're still making billboards, but they are ... special (volumetric), so - it's elastic like real thing...


    5. Grass apperance has been enhanced by much better MIP filtering. No more noisy look - and it's adjustable. Generally grass color and feel is also easily tweakable. Not only color multiplying, volume grass can do more like saturation by a slider. Changing grass apperance from toony green onion to dry ascetic look is matter of seconds.

    6. New editor that makes your life easy when you'd like to customise grass look. You can make grass billboards texture out of source elements (separate grass blades, flowers, leaves and so on).

    7. Global colormap over grass coverage. No more dull 2 colored stiff billboards.

    8. IBL lighting to follow your HDR/LDR skyboxes or automatically synced with Skyshop sky object (cubemaps +rotation)

    ... and last but not least:

    Works with Unity Free !! (DX9, OpenGL tested, while DX11 needs Unity Pro to resolve grass intersections). Note, that I don't claim any mobile friendliness (yet). When I only can get it working on my tablet, I'll surely let you know !



    screen6.jpg


    VolumeGrass1.5 is intermediate solution on the road to VolumeGrass 2. I decided to submit what I've got now due to soccer sale, but that's not the finish. Quick plan for features that are under construction is like this:

    1. We like dynamically place grass on terrain, just painting it - density based on texture not, model based. Massive terrain setups (multiple terrains with seamless grass edges) possible - better to use Pro (using render textures solves many performance glichtes as we can base on GPU).
    2. We like even better lighting (translucency and self shadowing for most demanding users)
    3. Breaking the billboards down to the separate grass blades using dissolve maps. This can reduce patternization (rect cell shaped) look
    4. We like to make everything in world space instead of tangent space. Although this introduces many challenges, it's possible and we can get real silhouettes of grass on hills.
    5. ??? (I'll probably figure something out...)

    Tom
     

    Attached Files:

    Last edited: Jul 14, 2014
  2. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    242
    Can this be used to completely replace unity's foliage system on terrains to lay down different types of grass and even plants, flowers etc. Just anything ground foliage related that would be on a ground in typical terrain OR is this only for single sided grass that works in this system.

    Also typically when creating grass clumps in unity's terrain system I add about 3 or 4 different types of grass to create a more unique look. Can this system do the same or its limited 1or 2 grass textures only.

    Unity's grass system is so costly on draw calls any comparison's to what Unity's Grass system vs Volume Grass system would be great so we can see if its worth it in that aspect as well. Looks great so far tho.

    -Miguel
     
  3. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,385
    Generally Volume Grass is about base and dense grass rendering., but can sweeten it adding Unity details here and there (flowers, larger herbs).

    More variation can be achieved using global colormap and placing separate volume grass objects. When writing into depth buffer you can blend more volume grasses together. In VG2 I'll think how to resolve it some dedicated way maybe. I need to consider volumetric grass is very dense, but is not free - it's GPU fragment shader intensive. So - you can get very high framerates on modern hardware while it's practically impossible (such density) using Unity grass. CPU would be bring down to its knees. Moreover - Unity grass can not bend that nice :).

    Tom
     
  4. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    517
    Looking great. Is there any RTP support available out of the box? Or, if the parts of the terrain system this asset is interacting with are not actually affected by RTP, alternative question is how the terrain support works in general.
     
  5. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    667
    Hi Tomaszek, That looks really nice! Especially the Meadow demo. I have a couple of questions:

    - How would it look like if you have sparse grass on a plane, with some bold spots, rather than a continuous lush volume? Would the grass/ground intersection look nice?

    - How long would it take you to make it so the camera can get lower and you would get to see the grass silhouette?

    - What would be a typical workflow to manually add grass on a ground mesh?

    Thanks! This looks like a very promising asset! :)
     
  6. Becoming

    Becoming

    Joined:
    May 19, 2013
    Posts:
    686
    Wonderfull, never again wasting 1000+ drawcalls on not even halfway decent density with unitys grass! Using it for accents and variety and using volume grass as a base will be soo much better!!
     
  7. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,385
    VG1.5 is kind of static mesh that can be easily "sticked" to underlying terrain (any geometry). Built in editor makes it easy to generate such volumes. you can also use your own meshes. Full support for grass placed on basing on density testures will be available in VG2.

    The more hollow volumetric grass is the more expensive it is. We need to traverse raycasting in fragment program in between grass blades. So - for low end machines anser is - no. VG is meant to be lush. But in VG I made tests with dissolve maps which gives you impression that you actually don't look at billboards at all but separate grass blades. It's matter of right coloring and lighting. I'm still working on this. Anyway - sparse grass at distance won't present much good (they will be cut by texture filter of alpha cutout type).

    Correct silhouettes - I made them and put small mesh shell attached to the camera, so in VG we'll be able to "dive" into the grass, but as it is still billboard system don't expect this will look magnificent. All depends on grass textures used (quality, resolution). Anyway - VG2 will be demanding, but acceptable for modern hardware. I expect times below 3-4ms per frame (full HD) on newest GPUs.

    Workflow - VG1.5 - meshes sticked to the ground here and there. VG2 - grass placement like on terrains (density textures that define coverage). Remind me to post some screenshots of VG2 next week. Today I'm very tired (didn't sleep for 2 days...).

    Tried to be ready with VG1.5 before soccer sale but I didn't make it... Hope AssetStore staff will be mercyfull (I posted this 5 minutes ago) and you'll get it during sale.


    Tom
     
  8. greenmonster

    greenmonster

    Joined:
    Jan 18, 2013
    Posts:
    25
    Hi tomaszek, it looks like you put out some high quality assets and am interested in this one, but I want to check first whether this particular grass shader will look correct in stereoscopic rendering (like in an Oculus Rift). In other words, do the blades of grass billboard toward the camera, or does it all stay put in world space?

    Thanks a ton for your help!
     
  9. KillerKahuna

    KillerKahuna

    Joined:
    Jun 19, 2013
    Posts:
    66
    Aha I see improvements in the meadow demo, the ends of the Volumegrass mesh where the shader ends has been smoothed out, that's very nice to see such a smooth transition to regular material on the terrain! It's a must buy for me now ^_^

    It'd be great if this could be plugged into RTP3 ^_^
    Possibly by selecting which material is grass and making it spread the Volumegrass shader and mesh over that material?

    Would you think something like that would be possible Tomaszek ?
     
  10. CubicleNinjas

    CubicleNinjas

    Joined:
    Apr 5, 2014
    Posts:
    15
    Very cool looking.

    Just seconding the question about Oculus rift support. A definite buy if the grass is in world space, which it looks like in the Soccer demo, but want to be sure. Seeing billboard grass that turns with camera movement in the Rift is kind of terrifying. :)

    Thanks!
     
  11. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    247
    Hi Tom!
    Just bought your grass plugin...but it doesn't work. I am on a macbook pro maverick. (early 2013 version, the fastest at that point)
    I see black, only black.
    This one also doesn't work. The part where the grass should be is black.
    http://www.stobierski.pl/unity/meadow1_5.html

    but this one does...I see nice grass
    http://www.stobierski.pl/unity/soccer1_5.html

    Regards!


    update: just noted that the meadow link partly works on bootcamp windows. Although, it doesn't look nice. The animation really looks like an image distorted by some wave warp. I have seen better demos from this asset. Not sure what happens here. RT
     
    Last edited: Jul 12, 2014
  12. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    6,246
    Is it possible to give more local variety in grass motion, in the medows seems a bit like moving strangly if you look closer. Also can the height be locally varied ? For example have some long and some short grass (like the unity grass)
     
  13. CubicleNinjas

    CubicleNinjas

    Joined:
    Apr 5, 2014
    Posts:
    15
    Hey stationx - I think I've ran into that exact bug before.

    Do you have Advanced Foliage Shader? If so, deleting this will make your foliage normal again. Not sure why, but this asset turns all other foliage black. Wanted to share as something to test out, if possible to remove this from your project.
     
  14. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    247
    Heey not that I am aware of, if that is another asset then no.
     
  15. jquery

    jquery

    Joined:
    Jul 12, 2014
    Posts:
    8
    How i can do smooth on border with texture ? It's looks not pretty on borders
     

    Attached Files:

  16. jquery

    jquery

    Joined:
    Jul 12, 2014
    Posts:
    8
    p.s. and how to fix this artifact when looking on foot ?

    volume grass2.png volume grass2.png
     
  17. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    3,734
    So this will not work with AFS?
     
  18. Becoming

    Becoming

    Joined:
    May 19, 2013
    Posts:
    686
    If it does not i am sure Tom or Lars will make it work, they worked together on quite a few things so i think this wont be an exception...
     
  19. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    3,734
    That was my assumption, too. The direction this asset is taking sounds similar to AFS, and the two products sound like a natural pairing. So I'm not expecting any kind of conflict, but ... is there one?
     
  20. CubicleNinjas

    CubicleNinjas

    Joined:
    Apr 5, 2014
    Posts:
    15
    I should stress that I don't have this asset and this probably works very well with Advanced Foliage Shader.

    Wanted to share a possibly, but sounds like its not the case with stationx's case. Sorry for the confusion!
     
  21. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,385
    The answer is not obvious. I might tell you - yes, it IS fixed in world space, but I'm doing a trick depending on direction of viewing vector from the camera to rendered pixel. When we're pointing down I bend the grass to hide grid structure of how billboards are placed on the ground. This might break stereoscopic impression a bit. I mean "a bit" because I don't touch the grass when we look at this at mid and narrow angles. This bending parameter can be adjusted. You can try to set it on the value which is both - acceptable for stereoscopy and the same time hiding grid structure. The other problem might be wind. Can't exactly tell how it would behave looking from separate oculus camers (for left/right eye). I believe that this IS stationary in world space but I'm not 100% sure. Anyway - making grass waving less will fix eventual problem. And I DO NOT turn the grass towards the camera which kills 3d impression in case of traditional grass system. My billboards are placed firmly on terrain as a XZ planes grid

    Yes, VolumeGrass 2 will allow you to choose one of terrain control splat texture channel as volume grass guide. Simply you can paint grass on the terrain using Unity's texture painting brush. W/o my grass you'll see flat texture (grass). With VG you'll see 3d grass extruded upward.

    I guess black problem sits somewhere in difference between DX9 and open gl. Shaders can behave different in certain situations (for example when normalizing zero vectors, divisions by uncertain values near zero or zero). When soccer works for you I believe situation is not that bad. We'll probably need to work together on finding the reason, because I can't get this behviour on my side in open gl mode on my Win.
    Refering to your impression about wind. I don't see the effect on your machine. I can however imagine that I overused wind distorion under the propeller to present the idea. VG makes wind by locally displacing uv offset. Actual billboards are not displaced. They are purely virtual and we only dynamically change the position from they are rendered (modification of viewDir in tangent space speaking technically). When wind is overused (too large amplitude) this reveals the technique used. Yes, that's about cheating eye, but is effective and visually acceptable. Anyway - it makes the grass much more "elasticly" distorted comparing to animation of two upper vertices of classic billboard grass approach. Grass is rather waving not stifly streching.

    As I said above - you need to tweak wind parameters to the visually acceptable results. When the wind amplitude is not quite big grass is waving w/o any strange results. You need also to consider that grass look depends on the angle we're looking from. At angles perpendicular to the ground grass is bent to hide grid.

    Short and tall grass on the same volume - not possible in current version. I'll add such option (to push down gras areas locally) in VG2. I actually tested this and it looked quite nice. Unfortunately it also affects performance as raycasting takes longer to hit something (ray needs to travel thru large empty spaces within the volume). In current version you can place two volumes on the same place using z write feature. One volume can be higher, the other shorter. I haven't tested this yet (surely will - I'm curious about it), and this should work. Both volumes can blend then.

    The problem is not related to AFS. However I haven't placed AFS on the volume grass, but it will work. I'm sure about it. I intentionally placed some default Unity grass under the tree in the meadow demo to prove that my grass and other objects can blend together. As I'm AFS user I can put some vegetation here and there and make a screenshot for you how it looks like.

    About your screenshot I can't tell too much because I don't see how the mesh is constructed, maybe give me another screenshot with volume mesh wireframe present. I see your grass is high comparing to its horizontal dimention. Volume Grass can render grass with side walls (we simply cut edges vertically) or be gradually pushed down to the ground at borders (possible easily with volume made in my VolumeGrass.cs editor, when using custom mesh you need to paint vertex color to green to push it down). VG2 will make borders looking even better using dissolve mask. About your other problem - that's related to mentioned VG feature that bends viewing vector to hide grid structure. Yes - you can remove this artifact playing with material "settings" section - use "bend" slider to adjust strength of distortion. We need to consider that actually not free 3d grass blades are rendered, but billboards thus looking at them downward reveals the grid structure.

    Tom
     
    Last edited: Jul 13, 2014
  22. Wavinator

    Wavinator

    Joined:
    Dec 24, 2013
    Posts:
    76
    Hi Tom. I'm looking at purchasing but am wondering if it would work with Unity terrains generated procedurally at runtime. If I understand how the product works I'd have to generate the mesh for the grass volume at runtime. Beyond that, are there any issues with Grass and procedural terrain as far as you know (for example, processing delays that one would normally not care about when working in the editor)?
     
  23. KillerKahuna

    KillerKahuna

    Joined:
    Jun 19, 2013
    Posts:
    66
    SOLD!!!! :D
     
  24. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    6,246
    Thanks for the info
     
  25. jquery

    jquery

    Joined:
    Jul 12, 2014
    Posts:
    8
    I not understand what means by "cut edges" and "side walls" how i can do it in VG editor ? Can you give several instructions how to do it.

    Now i have example :

    Not smoothed border when rendering

    volume grass-border1.png

    And how its look like in editor

    volume grass-border1-editor.png



    I try to check option "Fadeout borders" and press button "Rebuild LOD" but in this case grass disappered at all

    volume grass-border1-editor-fade border.png



    Yes it's work, thanks.
     
  26. Jochen-Hanisch

    Jochen-Hanisch

    Joined:
    Oct 7, 2013
    Posts:
    24
    Hello Tom,
    I like your great work. One short question, in the readme file i read:
    "4. To make custom grass billboard textures use a tool (Window/VolumeGrass Tools/Prepare grass texture)"
    Where do I find that tool?

    Tia,
    Jochen
     
  27. Jochen-Hanisch

    Jochen-Hanisch

    Joined:
    Oct 7, 2013
    Posts:
    24
    ... found it ;)
     
  28. Jochen-Hanisch

    Jochen-Hanisch

    Joined:
    Oct 7, 2013
    Posts:
    24
    Hello again,
    about the Silhouettes backcut stuff... It does`t work for me, also the soccer sample don`t cut out. I have the unityPro version ;) Btw, there is a missing texture file for the soccer ball. He is pink.

    Please, can you check the soccer sample scene?

    Tia,
    Jochen
     
  29. Jochen-Hanisch

    Jochen-Hanisch

    Joined:
    Oct 7, 2013
    Posts:
    24
    ... and no cut out from the grass borders, see pic...
     

    Attached Files:

  30. orbobservation

    orbobservation

    Joined:
    Feb 28, 2013
    Posts:
    87
    Works great overall. But it doesn't seem to work with the Alloy shaders and there's a border around the edge of the grass bounding area which shows the Skyshop Skybox, any ideas?
     

    Attached Files:

  31. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    I would like to ask if this could be used in an aircraft sim, would the grass be visible at low altitudes for example? Can you set eh height of the grass and have different types of grass?
     
  32. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,502
    Beautiful grass Tomas!
    One question...the grass is very Uniform. Do you think having some sort of noise based height, even off of a texture, would add to the attractiveness of it?
     
    KillerKahuna likes this.
  33. KillerKahuna

    KillerKahuna

    Joined:
    Jun 19, 2013
    Posts:
    66
    I too think it would add to the realism of things, however I don't feel the need to worry.
    Judging by the amazing work Tomas has made available through RTP3
    I'm sure the additions and changes to VG2 won't be any different :)
    I personally am very excited for the future of Volume Grass.

    It's thanks to developers like Tomas Unity is maintaining its momentum as a great platform to make games on.
     
  34. Marcurios

    Marcurios

    Joined:
    Nov 19, 2012
    Posts:
    77
    I bought this yesterday, i have been up all night trying to get it to work, with no succes.
    The grasshader.shader won't compile, i literally waited for four hours the first try, after that i tried it
    on 2 different pc's, with Unity pro and Free, shader won't compile, whatever i try.

    You have any idea what i can do to get it to compile so it can be used ?
    I have been at it for 12 hours now, i'll try some more tomorrow.

    If i can't get it to work at all, could i get a refund ?
     
  35. BBRome

    BBRome

    Joined:
    Jul 3, 2012
    Posts:
    313
    not works on MAC better indicate on store description
     
  36. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    247
    Hi Tom,
    a small misunderstanding...actually the soccer also doesn't work. The web player version at your first post is working in the web player demo, but I can't get it to work in Unity.
    So every scene open in Unity is black.

    When I open this link: then I get black.
    http://www.stobierski.pl/unity/meadow1_5.html
    When I open the scene in Unity which comes with the asset, it is black too.

    When I open the soccer, I get grass in the web player, but in Unity, this scene also is black.
    http://www.stobierski.pl/unity/soccer1_5.html


    This is my system:
    Processor 2,8 GHz Intel Core i7
    Memory 16 GB 1600 MHz DDR3
    Graphics NVIDIA GeForce GT 650M 1024 MB
    Software OS X 10.9.3

    RT
     
  37. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,385
    If you can make dynamically volume meshes that are placed over your terrain at the grass heihgt distance then it's no problem to make it fully dynamic. To control coverage you can adjust your gtras meshes (painting them on the areas where grass actually occurs) and to make softer transfitions between grass and terrain on the grass borders use vetex green channel (when it's green you're removing the grass for such vertex).

    Cut edges means that we can see properly rendered sidewalls. in your attachment you hadn't it. When using "Write to Z buffer" shader keyword (toggle in VG material property) the result should be seen in editor view. When not writing into Z-buffer you need to use script component on your camera (pro only) and results will be seen in playmode only. Not writing to depth might be faster in certain situations. Check how your sidewalls look like when you watch then from the side of grass volume (that is when you looking at grass border standing outside it). The problem in your case is you need to put VG control points clockwise (you've got it clock counter wise) when building. To use fadeout borders you need to put more tesellation on your resultant mesh. It's not normally a problem when doing grass on wavy ground (additional vertices will be added inside edited bounds). On flat areas you need to add more tesellation points using alt+shift+click inside mesh. Fading roberds means that they are pushed to the grund, but in your case ALL edges are the only one in resultant mesh that's why all vanished on build.

    Look above - you probably got the same issue like jquery has.

    +1 for this, I'm aware, definitely, but you need to wait for such feature in VG2.

    I've replied on AssetStore. I think trying on different Unity will help. I'd recommend Unity 4.5 - compilation time is very small then. In the end I could give you compiled shader. We can try to make it working together when you only tell me more about your computer and Unity version (try U4.5 before). If you still can't get it working (which would be very strange as it works on so many PCs I've tested) refund is no problem for me.

    When webplayer works - VG will work in open gl on Macs, it's only matter of finding the feature which makes it not working. In worst case it won't work in Unity Free for Macs, but I assume it won't be the case. I made much more complex shaders (Relief Terrain Pack) that works on Macs and I see no reason VG might not work.

    I need Mac user to cooperate with... Using open gl mode in my Windows is not enough I see. (it works on my side)
    I see your point clearly, only give me some time rather than posting discouraging reviews on AssetStore as it is not my intention to mislead anybody... Just wasn't aware about Macs.
     
    Last edited: Jul 14, 2014
  38. Jochen-Hanisch

    Jochen-Hanisch

    Joined:
    Oct 7, 2013
    Posts:
    24
    mmmhhh.... the borders work with the "write to z-buffer" toggle-off.

    But look at the attached picture, that's how the soccer example work for me. It doesn't look right, or what you mean?

    greetings,
    Jochen
     

    Attached Files:

  39. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,385
    On which platform exactly you work ? Windows 7, 8, Mac ? Which Unity version it is ? I disabled shader compilation for soccer ball on "d3d11_9x" - WindowsRT. The ball itself is textureless. It's shader can make it w/o texture even if you see empty texture slot for main texture.
     
  40. Jochen-Hanisch

    Jochen-Hanisch

    Joined:
    Oct 7, 2013
    Posts:
    24
    It`s windows 7 64bit and unity3d Pro 4.5.1f3
    and a NVIDIA GTX780
     
    Last edited: Jul 14, 2014
  41. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,385
    Ah, I see now that it is actually buggy when we're in DX11 mode. You can just replace soccer ball.shader contents with this:

    Code (csharp):
    1.  
    2. Shader "Soccer Ball" {
    3.    Properties {
    4.      _Color ("Main Color", Color) = (1,1,1,1)
    5.      _SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1)
    6.      _Shininess ("Shininess", Range (0.03, 1)) = 0.078125
    7.      _BumpMap ("Normalmap", 2D) = "bump" {}  
    8.      _hgt ("Bottom color height", Float) = 0
    9.      _hgt_len ("Bottom color transition length", Float) = 0
    10.      _hgt_color ("Bottom color value (RGB)", Color) = (0,0,0,1)
    11.    }
    12.    SubShader {
    13.      Tags { "RenderType"="Opaque" }
    14.      LOD 400
    15.    
    16.      CGPROGRAM
    17.      #pragma surface surf BlinnPhong vertex:vert
    18.      #pragma exclude_renderers d3d11_9x
    19.    
    20.      sampler2D _BumpMap;
    21.      float4 _Color;
    22.      float _Shininess;
    23.      float _hgt;
    24.      float _hgt_len;
    25.      half4 _hgt_color;
    26.  
    27.      struct Input {
    28.        float2 uv_BumpMap;
    29.        float3 worldPos;
    30.        float3 col;
    31.      };
    32.    
    33.      void vert (inout appdata_full v, out Input o) {
    34.        UNITY_INITIALIZE_OUTPUT(Input,o);
    35.        o.col=v.color.rgb;
    36.      }    
    37.  
    38.      void surf (Input IN, inout SurfaceOutput o) {
    39.        float height_damp=clamp((IN.worldPos.y-_hgt)/_hgt_len,0,1);
    40.        half3 c2=height_damp*(1-_hgt_color.rgb) + _hgt_color.rgb;
    41.        half3 _rgb=1 + _hgt_color.a*(c2.rgb-1);
    42.        float3 vcol=1-clamp(IN.col*10,0,1);
    43.        vcol*=vcol;
    44.        vcol*=vcol;
    45.        vcol=1-vcol;
    46.        vcol+=_SpecColor.a;
    47.        o.Albedo = _rgb * _Color.rgb * vcol;
    48.        o.Gloss = 1;
    49.        o.Alpha = _Color.a;
    50.        o.Specular = _Shininess;
    51.        o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
    52.      }
    53.      ENDCG
    54.    }
    55.    FallBack "Specular"
    56. }
    57.  
    58.  
    As you see the ball itself is color textureless as main Texture wasn't needed at all (it's encoded into my soccer ball mesh). I'll include this shader version in next update.

    Tom
     
  42. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,385
    From your screenshot I can't deduce where is the problem with skybox on borders. The ball on the steep hill is alloy one ? I can't tell what's wrong neighter except for I see you're trying to grass on really steep slopes. It won't work becasue grass will get too distorted. In real grass doesn't grow on such parts, they are rather cliffs. Wroking or not working with Alloy - do you mean you'd like to introduce Alloy shading on Volume Grass ? It's impossible as VG is very special kind of shader. Anyway I can tell you VG can be IBL lit (diffuse and roughly averaged specular).

    Tom
     
  43. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    Probably missed my question by mistake :), I ask again:
    I would like to ask if this could be used in an aircraft sim, would the grass be visible at low/high altitudes for example? Can you set the height of the grass and have different types of grass? At what point does the grass not become visible? Is it similar to the Unity grass viewing distance?
     
  44. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,385
    Here are 2 screenshots of Volume Grass mixed with Advanced Foliage Shaders fern:

    screen7.jpg
    screen8.jpg
    (It was easy to adjust VG colors to fit color of the fern that came from AFS in just a few seconds !)


    Here also an example of two independent Volume Grass objects of different properties mixed together in "Write into Z buffer" mode:
    screen9.jpg
    (I know it's not much pleasant screenshot but shows the overall idea).

    Tom
     
    Last edited: Jul 14, 2014
    jc_lvngstn, KillerKahuna and John-G like this.
  45. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,385
    Ah, yes. I was overwhelmed with amount of questions (probbly due to the sale), so almost whole day answered users... :)

    You define the close/far distance range as Volume Grass material properties. At far distance only flat floor texture colorized with fake AO and optional global colormap is present. If you come very low to the ground (let's say 15 m) with your aircraft grass blades might be distinct, but VG is rather meant to be used on games that presents grass from mid range angles (not looking at grass downside). Different types of grass ? It depends on what you're asking for. VG grass is placed on bliiboards distributed on the grid. Billboard texture consists of several separate grass blades that you can change to your taste using built-in editor. Different types of grass over larger areas - I answered such questions above.
     
  46. orbobservation

    orbobservation

    Joined:
    Feb 28, 2013
    Posts:
    87
    Apologies, I didn't state that the terrain is flat beneath the sphere and on build the grass directly below generates itself to the height of the sphere with the Alloy shader,
     
    Last edited: Jul 14, 2014
  47. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,385
    Ah, but it has nothing to do with Alloy. Put any sphere there and result will be the same. The reason is that you need to use dedicated layer for terrain and choose it in VG Settings foldout - this is dropdown named Ground collision layer mask. Everything that is on this layer - VG will try to wrap the grass mesh around it (to follow its shape). By default all objects (your orb) are placed in layer Unity's "Default" layer. That's why you've got this strange look. Simply make a unity alyer like "terrain" or "ground" - put everything that need to be "floor of grass" there and select this layer as Ground collision layer mask. Sepearate problem might be mentioned Skyshop sky ong rass borders, but I can check it installing Skyshop on test project with VG. Anyway - could you give me a screen shot with the issue focused ?

    Tom
     
  48. Marcurios

    Marcurios

    Joined:
    Nov 19, 2012
    Posts:
    77
    You where right, it compiles OK on 4.5.

    But i always use SSAO, and the edge of the grassmesh has a black edge that spans the height
    of the mesh, so i really can't use it, cause i need SSAO to work ok with my game.

    You have any ideas about this, you think you will be able to adress this in a future update ?

    I'm thinking this is going to be a nasty problem to tackle.

    [​IMG]
     
    Last edited: Jul 14, 2014
  49. MadJohny

    MadJohny

    Joined:
    Mar 8, 2013
    Posts:
    143
    This looks kinda weird for me grass.png
     
  50. Marcurios

    Marcurios

    Joined:
    Nov 19, 2012
    Posts:
    77
    you do not have the see through with deferred rendering, only in forward.