Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

VOLUME GRASS - Unlimited Density

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

  1. Venryx

    Venryx

    Joined:
    Sep 25, 2012
    Posts:
    442
    It took a couple hours, but I figured out how to make it work again.

    Just replace this line:
    Code (cginc):
    1. sceneDepth = 1.0 / ( (_VGZBufferParamA * tex2Dproj(_GrassDepthTex,UNITY_PROJ_COORD(IN.screenPos)).r) + _VGZBufferParamB );
    With this:
    Code (cginc):
    1. sceneDepth = LinearEyeDepth(tex2Dproj(_GrassDepthTex, UNITY_PROJ_COORD(IN.screenPos)).r);
    From what I understood from a quick search, the original code is supposed to improve the curve/distribution of the depth-buffer's z-values, so it works better for close grass blades.

    However, after making the change above, I compared before and after screenshots, and it doesn't seem to be any worse. Did Unity perhaps implement better depth-buffer distribution themselves?


    I know that in the changelog here [https://unity3d.com/unity/whats-new/unity-5.5.0], they do mention: "Graphics: Improve shadows precision for large game worlds. Use reverse-float depth buffer for improved depth buffer precision on modern GPUs. Particularly improves directional light shadowing for large view distances.". However, that seems different than what your "custom LinearEyeDepth() parametrization" code does.

    Anyway, I'm certainly not a shader/rendering-pipeline expert, so the above is just a guess. But the fix does seem to restore at least the main functionality of the plugin, until an official patch is made.
     
    tomaszek likes this.
  2. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,720
    I've just submitted version from U5.5.0p3. Should be available within a few days. Above fix would work if depth catching camera would have exactly the same distances (which is not the case - by default I set it to 40). So - it works "at first glance", but it's better to use my formula. The only issue is that in U5.5 we've got reversed floating point depth buffer. We need to check it with #if defined(UNITY_REVERSED_Z) and use 1-tex fetch.

    ATB, Tom
     
    Venryx likes this.
  3. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,720
    Just before Unity forum problems that happened April 30th I had here user request about performance of VG.

    To answer missing question - I've just installed U5.6 on my laptop with 960m nVidia GPU and have around 170fps in fullscreen MSAAx2 - both meadow and soccer scene. We need to remember that VolueGrass is pixel intensive shader, so we ndefinitely need to reduce number of passes needed to solve this object - in forward with many pixel lights object needs to be redrawn multiple times which affects performance.

    Tom
     
  4. MotionTracker

    MotionTracker

    Joined:
    Jan 10, 2017
    Posts:
    22
    Hi. A got the errors

    Trying to create a material from string - this is no longer supported.
    UnityEngine.Material:.ctor(String)

    Shader error in 'Grass Shader ALT': 'vert': output parameter 'o' not completely initialized at line 813 (on d3d11)
     
  5. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,720
    Unity version agains VG version please.

    Tom
     
  6. MotionTracker

    MotionTracker

    Joined:
    Jan 10, 2017
    Posts:
    22
    5.5.3 f1 what the vg version?
     
  7. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    677
    Volume Grass version of course ;):)
     
  8. indie6

    indie6

    Joined:
    Dec 15, 2012
    Posts:
    46
    Is the mobile version included in this? or still in the making?
     
  9. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,720
    It's supposed to work with GLES3 mobile hardware, but it's rather GPU intensive solution.What's the main strength is that it completely releases CPU from drawing ton of grass patches.
     
  10. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,058
    Did this ever seen any upgrades to procedural generation in runtime over the years?
     
  11. lawsochi

    lawsochi

    Joined:
    Oct 24, 2016
    Posts:
    107
    Hi, I'll use VG instead of terrane, in the places where I have a meadow. but, the size of the world is very large, I need several VG objects on the same meadow. At the junctions between the objects there are unpleasant artifacts (yellow line). is there any way to fix it?
    Thanks for the great tool)
    and have not changed the plans well the future for you, in part VG?
     
  12. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,720
    Grass objects are mapped in world space so seams should be no problem as far as you provide exactly the same normals and tangents at stitched edges.

    The fact is that GPUs get powerful and we don't need to rely on old DX9 architecture (Unity dropped this platform as well). VG technique is fine, but I more and more think about providing users with mesh based solutions rather than trying to master VG which is in the end billboard like solution. We don't need to pay any price for the number of billboards rendered so it's CPU free, but the look is constrained to the idea principle. Take a look at the solutions I made for our D.R.O.N.E. project:



    It's solution basing on DX11 architecture and works pretty effective together with physical interactions, wind, explosion blows, burnt grass. If at some point I will release grass similar, it will be rather done this way. Problem is I can't focus on new UAS products. Anyway - I'll always keep in mind what my users gave me buying my products. So VG users will be surely eligible to get discounts on new releases when they come (like I did for example with RSP to UBER upgrade path for $1).

    Tom
     
    Last edited: Sep 28, 2017
  13. Tinjaw

    Tinjaw

    Joined:
    Jan 9, 2014
    Posts:
    518
    I love VG. But it appears it is no longer compatible as it throws errors on importing the package into Unity 5.6.3p1. Please consider me as a beta tester for whatever comes next. I will need it for my current project.
     
  14. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,720
    I'll take a look importing VG into the Unity version you mention.

    Tom
     
  15. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,720
    Installed up-to-date VG in U5.6.3p1 and it doesn't seem to throw any errors. All example scenes work fine.
     
  16. Tinjaw

    Tinjaw

    Joined:
    Jan 9, 2014
    Posts:
    518
    It looks like it must be a conflict with my existing project. Thanks for confirming it is supposed to be working. I will start a clean project and import it and compare that with my project and see if I can find the conflict.

    ------

    I have narrowed it down. If I start a new project and import BuildR2 I get no errors. If I then import VolumeGrass, I get errors.

    Code (CSharp):
    1. Assets/VolumeGrass/_Scripts/VolumeGrass.cs(585,16): error CS1729: The type `Poly2Tri.PolygonPoint' does not contain a constructor that takes `3' arguments
    2.  
    3. Assets/VolumeGrass/_Scripts/VolumeGrass.cs(599,27): error CS1729: The type `Poly2Tri.TriangulationPoint' does not contain a constructor that takes `3' arguments
    4.  
    5. Assets/VolumeGrass/_Scripts/VolumeGrass.cs(611,40): error CS1061: Type `Poly2Tri.TriangulationPoint' does not contain a definition for `index' and no extension method `index' of type `Poly2Tri.TriangulationPoint' could be found. Are you missing an assembly reference?
    6.  
    It seems both assets use PolygonPoint.

    -------

    It looks like both assets use poly2tri
     
    Last edited: Oct 30, 2017
  17. dougbello

    dougbello

    Joined:
    Apr 9, 2015
    Posts:
    15
    Hello Tom, your package looks amazing, I need to make it for a soccer field grass, but it needs to work in VR in a pc with 1080 so I'm just wondering if you had any issues with VR like the terrain grass has in unity. The grass in terrain rotates with the vr headset and looks really weird. If your package works fine with vr headset, i'm buing it.

    Thanks
     
  18. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,720
    It works, but will have problems with cutting silhouettes where grass intersects ball and other objects. If you can live with it - should be fine.

    Tom
     
  19. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,720
    Package approved. Downloaded it in U2018.3 fresh project to check if right package is given Unity side. Seems everything works.

    Tom

    EDIT I misplaced this post - should be posted on RTP thread. Sorry.
     
    Last edited: Jan 8, 2019
    hopeful likes this.