Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

VOLUME GRASS - Unlimited Density

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

  1. Tom_Withers

    Tom_Withers

    Joined:
    Aug 19, 2014
    Posts:
    4
    As far as my experience has gone with VG in U5, I found it worked fine all the way up to RC1. Then the grass shader just stopped working in RC2, I'm not certain what changed between the release candidates for the problem to occur. Has this been the case with anyone else?
     
  2. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,842
    I'm still fighting with RTP, but I'll look at this later...
     
  3. Tom_Withers

    Tom_Withers

    Joined:
    Aug 19, 2014
    Posts:
    4
    Thanks Tom.

    Any idea what this is about?

    upload_2015-2-17_15-22-49.png

    My sidewalls are not sillhouetted and I suspect it must be related to that error message.

    upload_2015-2-17_15-27-23.png
     
  4. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,842
    Could you specify my me your setup ? Platform (DX11?) Lighting path, Unity version. Do you use z-write checkbox or dedicated script that renders objects into temp depth texture (Pro only) ?

    Tom
     
  5. guyal

    guyal

    Joined:
    Feb 25, 2011
    Posts:
    17
    I found the same issue as Tom_Withers - VG works well in 5.0.0f1, but not at all in 5.0.0f2.

    In 5.0.0f2, in the default, freshly installed meadow and soccer scenes, grass is the standard bright pink "something is wrong with the material" color in both Scene and Game views.

    I tried building with DX11 on/off, 32/64 bit, forward/deferred lighting, same result.
     
  6. guyal

    guyal

    Joined:
    Feb 25, 2011
    Posts:
    17
    Inspector for GrassShader in f1 shows 1 upgrade warning, but no errors:

    (forum comment editor doesn't seem to like imgur URLs, but the links below work)
    http://imgur.com/bsen0S2

    while in f2 there are various errors, and warnings, as well as the 1 upgrade warning above:

    http://imgur.com/JJM0bwb

    The scroll in the Editor doesn't let me display the full list of shader compile errors from f2 on my monitor screen at once for screencap, but you get the idea...
     
    Last edited: Feb 24, 2015
  7. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,842
    I've just submitted RTP3.2c for approval, so I hope I'll take time to look into VG at last. As I've learned a lot about differenctes between Unity5 releases and the tech behind it I hope this won't take that long to update VG.

    Tom
     
    FriendlyHo, guyal and hopeful like this.
  8. FriendlyHo

    FriendlyHo

    Joined:
    Aug 18, 2014
    Posts:
    23
    Hey any chance for a unity 5 upgrade? I know you're aware, but is there a quick fix I can apply? It stopped working since 4.6 for me... Just a pink material :(
     
  9. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,842
    It's high on my to do list :).
     
    FriendlyHo likes this.
  10. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    9,381
    Great, cant wait to restore the water shader in my levels. It looks so cool :)

    I will try to fix the errors if i have time and post the changes here if i do manage it, to help speed up the process.

    EDIT: Wrong thread :), this was meant for the RTP one :)
     
    Last edited: Mar 4, 2015
  11. loisharris

    loisharris

    Joined:
    May 6, 2014
    Posts:
    4
    I know your working on updating the this but it was working in the Unity5 betas and with the RC and current one there are issues with the shader:

    Shader error in 'Grass Shader': 'LightingLambert': cannot implicitly convert from 'half3' to 'struct UnityGI' at line 258 (on d3d11)
    Compiling Vertex program with DIRECTIONAL SHADOWS_OFF LIGHTMAP_OFF DIRLIGHTMAP_OFF DYNAMICLIGHTMAP_OFF IBL_DIFFUSE IBL_SPEC WIND WRITE_INTO_DEPTH GLOBAL_COLORING

    and

    Shader error in 'Terrain FirstPass example': Too many texture interpolators would be used for ForwardBase pass (11 out of max 10) at line 27 (on )

    Do you have an estimate on when this will be updated? I'm on a deadline and would like to use VolumeGrass.

    Thanks!
     
  12. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,842
    I'll do my best to sort things ASAP. Will be _probably_ ready next week (if the problem is lighting functions in U5 final - I'm aware about this problem).

    Tom
     
  13. loisharris

    loisharris

    Joined:
    May 6, 2014
    Posts:
    4
    Thank you so much! I'm so excited to be using it again!!
     
  14. addammsuarez

    addammsuarez

    Joined:
    Mar 2, 2015
    Posts:
    3
    Hello. I dont see "grass depth" in the drop down menu.......when making oobjects IN the grass...help explain more about who to do it..
     
  15. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,842
    You need to add this layer and it doesn't matter how it's named. If you're on Unity Free or you want to have simple setup - select "Write to Z Buffer" in grass material properties. This is done like this in example scene. If you'd like to use depth buffer you need Unity Pro license (Unity4, VG is not yet available for Unity5 - will be soon). Then selected layer (it's named "grass depth" in my case) you put there objects that should sink into the grass and you use VolumeGrass camera script and select the same layer the way my plugin knows which layer should be rendered into custom depth buffer). This is described in current version of my documentation.

    Tom
     
    addammsuarez likes this.
  16. addammsuarez

    addammsuarez

    Joined:
    Mar 2, 2015
    Posts:
    3
    Ok, thanks, i will try it
     
  17. addammsuarez

    addammsuarez

    Joined:
    Mar 2, 2015
    Posts:
    3
    Hello friend, i try but it did not work, works in unity 4.6.3, you can make a small video from scratch or tell me that how can I reach you faster, have skype, greetings.
    Error: Grass does not appear above the sphere.
     
    Last edited: Mar 8, 2015
  18. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,842
    I'll try to reproduce your issue, but give me your setup. What platform do you use. Is it DX11 (z-depth buffer doesn't work then) ? Give me steps you take so I can follow them and tell you what you're missing in your workflow.

    Tom
     
  19. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,842
    So, I've managed VG1.5 for Unity5.

    Side notes:

    1. We don't use Z-WRITE setup now. We need to use dedicated depth texture to cut silhouettes, but it doesn't matter as render textures are now available on U5 personal edition and example setup is present on example scenes

    2. In DX9 we can modify dynamically "Max raytrace steps" - it's hardcoded to 100,b ecause HLSL compiler for DX9 in Unity5 can't compile it otherwise.

    Here is a working demo exported from Unity5. I put there red boxes to present realtime dynamic GI working (ball has bright point light attached, so when you kick it against the red wall you'll see bounced light on the grass).

    http://www.stobierski.pl/unity/_VG15_U5.html

    So - as I said - the project is _not_ abandoned. But I need more time to manage it better. I'll try to make an quick update soon with dynamic grass placement (for terrains where grass will be visible from texture coverage - you just paint grass as you do it with Unity's grass).



    I'll submit this VG1.5 for Unity5 package version ASAP (tomorrow).

    ATB, Tom

    EDIT: actually I don't know why "Development build" is seen on webplayer while I haven't checked this option - baked lightmaps also doesn't work while above screenshot is taken from editor. I'll look into this tomorrow.
     
    Last edited: Mar 11, 2015
    John-G, gurayg and hopeful like this.
  20. MIK3K

    MIK3K

    Joined:
    Sep 10, 2014
    Posts:
    144
    Nice work Tom. This is GREAT news! Volume grass is amazing and can't wait to see it in Unity 5.
     
  21. SuperNewbee

    SuperNewbee

    Joined:
    Jun 2, 2012
    Posts:
    189
    I will now sit here and excitedly refresh my asset store page. :)
     
  22. FriendlyHo

    FriendlyHo

    Joined:
    Aug 18, 2014
    Posts:
    23
    I made a macro to refresh the page every 4 seconds Here's a link : www.macroforvolumegrassohyeah.com
     
    John-G likes this.
  23. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,842
    Submitted, now this is Unity turn :).
     
    John-G likes this.
  24. loisharris

    loisharris

    Joined:
    May 6, 2014
    Posts:
    4
    Thank you! I'm so excited to use this again! I appreciate your work and timeliness!
     
  25. Merire

    Merire

    Joined:
    Jul 29, 2013
    Posts:
    6
    Hello,
    I may buy this asset as it looks great in the demos, just waiting the fix for Unity 5.

    I have a question though, do you have any idea of if it'll render nicely in an Oculus rift, with stereoscopic rendering ? Billboards may look ok on a monitor, but in the rift it's awful. 3D grass meshes are ok, but what about this volumetric solution ?

    Thanks
     
  26. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,842
    Both eyes get view from separate cameras and this is reflected in VG, so I assume this will work for you (no scary camera facing issues). Although grass bending at angles close to perpendicular to the surface might cause some distorions in perspective reception, so you might need to reduce this effect (it's controllable in VolumeGrass material inspector). To know what I'm talking about look at the grass downward (it's limited in demo so you can't look straight down).

    But you should be aware that some script tweaking is needed for oculus. VG uses rendertexture that stores screen depth of intersected objects. Now it's one camera thus it's one texture. For 2 camreas you'll generate 2 separate depth textures (from 2 scripts attached to cameras) that shader for left and right eye should get separate, too. I don't know oculus (haven't played with this yet). But I assume you can hook somewhere in script before left eye is rendered and right one - separately. In these 2 places you should provide VG material with dedicated 2 textures.

    Tom
     
  27. twiggyash

    twiggyash

    Joined:
    Nov 7, 2013
    Posts:
    45
    Hi Tom, thank you very much for your work!! Love your asset :) but I have a question.. is mobile support still on the road? I'm trying to use Volume Grass on a Tegra 4 but I always get black texture.
    Is there a way to make it works?

    Thank you very mcuh again!!!
     
  28. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,842
    Resources used are too high for mobile (number of interpolators or texutres). I guess it theoretically can work on fast mobile, but it's not on the roadmap for near future. I'd rahter add complexity there (to increase usability on terrains) rther than fight with mobiles...

    Tom
     
  29. MIK3K

    MIK3K

    Joined:
    Sep 10, 2014
    Posts:
    144
    Update is live - GO, GO GO!!!
     
    loisharris and John-G like this.
  30. Cubic_Creo

    Cubic_Creo

    Joined:
    Oct 13, 2014
    Posts:
    47
    Hey Tom. Is there still an "alt" shader for Mac? It crashes Unity on my Mac, and I don't see the alt shader for Mac that is referenced in the documentation PDF.
     
  31. Axiomatic

    Axiomatic

    Joined:
    Feb 7, 2014
    Posts:
    30
    Hi Tom, Would it be possible to use the volume grass shader in conjunction with rtp? Like instead of the grass map?
     
  32. jason-fisher

    jason-fisher

    Joined:
    Mar 19, 2014
    Posts:
    133
    Is it possible to supply the average normal for use with patches/chunks of a spherical planet?
     
  33. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    Same question here. Is this OSX compatible at all...? TIA!
     
  34. DirtyHippy

    DirtyHippy

    Joined:
    Jul 17, 2012
    Posts:
    212
    I bought this tonight to play with it in U5p2. I am having all kinds of trouble getting the grass to build correctly. If I add any kind of small hill, and hit rebuild, the grass seems to understand that the hill is there, but the grass tesselation appears elsewhere for that hill (so the grass is built at height 0 where the hill is, and some random spot elsewhere the grass will slope up in the hill's shape.. To repro: Import the asset into a new project, bring up the meadow demo, and add a little hill. Hit rebuild. The grass builds the hill shape in the wrong position). Am I doing something wrong?

    I also see all kinds of weird graphic artifacts occuring at random times in the scene view, etc etc.

    Also, this workflow is really only useful for fairly simple use cases (e.g. large fields). I see you mention a texture based workflow. This would be significantly more ideal. It would also be great if the grass could silhouette at angles - it looks wrong in certain cases.

    Edit: just wanted to mention that it does look great.
     
    Last edited: Mar 22, 2015
  35. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,842
    Is it U5.0.0f4 with newest VG1.5c form AssetStore ? There is not separate version anymore for Mac. It worked on OSX with Unity4 version. On Unity5 the only thing I can do is to run VG on my Win using "-force-opengl" mode but it works and give me no error. Will try on another machine (laptop with different openGL drivers on intel HD3000 GPU). Maybe this will throw any errors. Could you try opening VG_Base.cging file and uncomment these 2 lines:

    Code (csharp):
    1.  
    2. //#define DONT_USE_SPHERICAL_WIND
    3. //#define DONT_USE_MAIN_WIND
    4.  
    It was causin problems on VG1.5, but I believe I fixed this. On OSX - you could also select GrassSurfaceShader(no zwrtie).shader and use compile and show code. Maybe you'll have errors reported that might be helpful for me to fix any issue.

    I don't get the idea of average normal. VG uses mesh normals - "top surface" of lawn as normal reference.

    Small hill - I'm able to reproduce it and will investigate the issue. The weird thing is that w/o any small hill it works and "sticks" properly to the current terrain when we hit "rebuild LOD".

    For all kind of weird artifacts. Could you provide me with screenshot ? I don't get anything suspicious on my achine on the example scenes.

    Grass coverage based on texture is on the roadmap.

    Tom
     
  36. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,842
    In regards to small "hill problem". I found some glitches in VG anyway, but this one is not related. It seems that Unity has some bug in terrain heightmap caching. If you paint small hill, then Save scene and then use rebuild LOD button - things work for me.

    Better silhouettes - it's raytraced in tangent space so shader doesn't have any info about mesh curvature. That's the issue related to VG fundamentals that can't be resolved easily. So - grass will work fine, but not on "small, curved hills".

    Tom
     
  37. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,322
    any hopes of getting an APK so we can test it on a mobile?
     
  38. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,842
    It doesn't work on mobile (currently too expensive). I'll check eventual chances for hi-end mobiles later.

    ATB, Tom
     
  39. DirtyHippy

    DirtyHippy

    Joined:
    Jul 17, 2012
    Posts:
    212
    Thanks. This resolved the issue.

    One thing that I am noticing is odd behaviour when I duplicate a patch. Since i am covering a large area, I am creating multiple patches that roughly conform to my chunking granularity so I my own internal framework can handle them. When I duplicate a grass patch, for some reason it looks like I need to rebuild both the new patch and the original one. Are they sharing some data somewhere? This is a minor inconvenience for something that looks so awesome.
     
  40. jason-fisher

    jason-fisher

    Joined:
    Mar 19, 2014
    Posts:
    133
    If I apply grass to a sphere with normals, the grass will always 'grow' outward from the sphere (like a fuzz ball) instead of towards +y? (grass growing towards the 'sun' in a flat world)
     
  41. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,842
    It's possible that grass material on renderer makes it necessary to rebuild.

    Nope, The way I'm texturing grass model is top planar - so grass grows upward.

    Tom
     
  42. DirtyHippy

    DirtyHippy

    Joined:
    Jul 17, 2012
    Posts:
    212
    In U5p2 I don't see any side walls for any patches I create. The mesh is generating properly. However, looking further, it appears the sidewalls are visible, but they are facing inside rather than outside. So they look correct, but they are just facing the wrong way.

    Any ideas?

    Edit:

    Further testing reveals that if you drop the control points in a clockwise fashion the sidewalls show correctly from the outside. Counterclockwise, and they do not.
     
    Last edited: Mar 27, 2015
  43. GenOli

    GenOli

    Joined:
    Apr 21, 2013
    Posts:
    139
    Has anyone actually tested this on mobile?
     
  44. Denis-Valjean

    Denis-Valjean

    Joined:
    Mar 25, 2015
    Posts:
    39
    Hi, just bought your asset, but as noticed reading some posts, its not working in unity 5, despites saying it was unity 5 ready. Maybe Iam doing something wrong, but I read the manuals, and when click to build the grass, this is what I got:

    upload_2015-3-29_23-21-42.png

    Is this a commom problem? Using GTX 970, DX11, Unit 5. Thanks

    Edit: Got this error message when openning your soccer scene:


    MissingComponentException: There is no 'Renderer' attached to the "sidewalls" game object, but a script is trying to access it.
    You probably need to add a Renderer to the game object "sidewalls". Or your script needs to check if the component is attached before using it.
    VolumeGrass.BuildMesh () (at Assets/VolumeGrass/_Scripts/VolumeGrass.cs:801)
    VolumeGrassEditor.OnInspectorGUI () (at Assets/VolumeGrass/_Internal/Editor/VolumeGrassEditor.cs:78)
    UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean forceDirty, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect, Boolean eyeDropperDirty) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1150)
    UnityEditor.DockArea:OnGUI()
     
  45. DirtyHippy

    DirtyHippy

    Joined:
    Jul 17, 2012
    Posts:
    212
    It strikes me a as a bug, but all you have to do is to assign the "grass surface shader (no zwrite)" to the volume grass shader (it is set to none), and then build the patch.
     
  46. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,788
  47. Denis-Valjean

    Denis-Valjean

    Joined:
    Mar 25, 2015
    Posts:
    39
    You were right!!! Thanks a lot!
     
  48. Denis-Valjean

    Denis-Valjean

    Joined:
    Mar 25, 2015
    Posts:
    39
    One more thing. I saw in the video that you use a Grass Depth Layer to give more realism to placed objects. I am new to unity.. I discovered how create a layer, but what to do next? Do I have to import an existent layer created by author or write a code? I am confused...
     
  49. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,842
    Yes, that's a bug. Thank for posting the quick solution. I'll fix it in next release.

    Follow my example scenes where it's setup properly. Simply add a layer where you'll pace objetcs that are meant to intersect the grass correctly. You can also leave it "Default", but the same time grass object should _not_ be "Default" either (move it to transparentFX or anything else). Then the script attached to the camera will render objects that intersect grass from the specified layers only.

    Tom

    EDIT: grass layer should not be the included for camera depth texture layer mask (grass shouldn't intersect "itself")
     
    Last edited: Mar 31, 2015
  50. Denis-Valjean

    Denis-Valjean

    Joined:
    Mar 25, 2015
    Posts:
    39
    Thanks man! Worked !! Grats for excelent work!
     
unityunity