Search Unity

Volume Grass system on Asset Store soon

Discussion in 'Assets and Asset Store' started by tomaszek, Mar 8, 2011.

  1. KEMBL

    KEMBL

    Joined:
    Apr 16, 2009
    Posts:
    181
    Hello Tomaszek!

    The problem in quote was gone after VG reinstall (delete all old files, import new files to scene).
    One more problem: By some unresolved reason, all my grass start points to inner view area. To solve this I was try to copy all settings from meadow to my exists material and build mesh. But this not help to solve problem. All settings looks equal, where can be problem?



    P.S. I work with last version (today redownloaded) of VG in Unity 3.5.3f3
     
    Last edited: Jul 5, 2012
  2. tomaszek

    tomaszek

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

    To mix together soccer (grass bending under ball) and printing foosteps like in lawnmower you should mix subshaders' code together. Easiest way will be finding Cg code part where I modify viewing vector basing on arbitrary worldspace position from soccer subshader and copy this functionality into lawnmower subshader.

    I don't know what's the problem with your grass now. If you see your grass "from the top" and it's not intended, I think something is wrong with normal vector calculation. Maybe it's not properly passed into fragment program of surface shader ? Black "ground" seen on your screen shot is probably result of ground settings in shader defines or material params.
     
  3. artician

    artician

    Joined:
    Nov 27, 2009
    Posts:
    345
    I've gone back and looked at your demo probably half a dozen times. It's about time I picked it up, but I need to make sure it will support what I'm doing in my current projects first.

    - Can I have multiple types of grass in the same scene, on the same terrain? How many?

    - Do you have a terrain size limitation? I'm working with a 4km x 4km chunk of landscape.

    - How does your grass deal with sudden changes in slope? I have some rough/jagged terrain on my landscape that I imagine it would clip through or need to be erased by hand.

    - What kind of authoring tools does your plugin offer? I assume I can change density and draw distance, but how about:
    - slope grade termination and/or blending?
    - mass-placement?
    - splat-map association for placement?

    - Does your grass automatically cull around other landscape objects, such as terrain trees?

    - Can your grass auto-cull around regular physics objects like rocks, or other hand-placed obstacles?

    Sorry if this is answered elsewhere but this thread has grown quite long. I hope that's a result of your plugins success though.

    Thanks!
     
  4. Curious

    Curious

    Joined:
    Nov 19, 2009
    Posts:
    334
    Have you tried Unity Pro's Image Post Processing on your Volume Grass system yet? I'm seeing artifacts where the ball touches the grass field in Unity 3.5.4f1

    Do you confirm this issue?

    P.S I've also tried to mess with 'Unity's Script Execution Order' to solve the problem, but that was a no go either!
     
    Last edited: Aug 13, 2012
  5. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    1. Every grass object on the scene has its own properties (grass mesh, all material params, textures, etc.)
    2. My system is not related to unity terrain. Grass has own mesh where grass blades are rendered on "virtual slices" inside fragment shader. We don't need Unity terrain at all to have volume grass.
    3. My grass mesh is built basing on any collider (terrain, another mesh, etc.). Where you'll find grass looks bad on slopes you won't put grass mesh there. You can use any number of grass meshes (areas where grass exists) in the scene. I put special feature to refine UV coords on aggresive slopes after grass mesh preparation which improve look of grass in such places.
    4. To see how work with grass looks like - just look here:

    Example workflow: http://www.youtube.com/watch?v=04TaWOmWsCM

    Docs as published in the package: http://www.stobierski.pl/unity/VolumeGrass.pdf

    We can "cut holes" in grass mesh (gradual on the hole borders) basing on vertex color of grass mesh (see workflow above on youtube). It's mesh based, not bitmap dependent like grass in Unity. Don't confuse "mesh based" with grass using separate meshes for distinct grass blades. It renders grass "inside mesh volume", so even one triangle mesh with my shader can show large area covered with dense grass.

    About culling - yes. As any other static meshes on the scene (using Umbra). Good idea is to split grass into smaller pieces (can be adjanced to each other) then culling will work better.
     
    Last edited: Aug 14, 2012
  6. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Could you tell me which post process effect you exactly refer to ? Is this issue new to U3.5.4 or earlier version of Unity, too ? What I see for example is screwed DoF in Unity 3.5.2 at areas of ball hidden under grass. In general post FXes that uses depth can cause problems. This is issue of Unity depth buffer state and way Unity post-process handles it. I didn't inspected it yet and as far as my shader writes into z-buffer like any other alpha-cutoff shader, so - mystery :).

    To find the source of problem could be visualize depth buffer as it's seen in Post-FX and find the reason it's not properly rendered.
     
    Last edited: Aug 14, 2012
  7. Curious

    Curious

    Joined:
    Nov 19, 2009
    Posts:
    334
    I found the problem, it's the shadowing which causes this problem.

    I'm wondering if there's a way to solve this problem, please have a look:
     

    Attached Files:

  8. Curious

    Curious

    Joined:
    Nov 19, 2009
    Posts:
    334
    Okay, now I'm sure, enabling the shadow + any image processing effect will cause this problem...

    Any idea how to solve this?
     
  9. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Please, let me think. I'll look into it ASAP as, unfortunately, I can't focus only on things I like the most :).
     
  10. tomaszek

    tomaszek

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

    2 days of head-ache due to Unity "moods", but at last I know where we are:

    1. Targeting screen and source RenderTexture on OnRenderImage gives different results. There must be some differences in rendering pipeline when using postFXes comparing to direct screen output. My shader is kind of transparent-cutout. Basing on custom depth buffer, where I render grass crossing objects like soccer ball, I know where to cut holes in grass so that underlying, not occluded by grass blades, geometry can be visible. Unity gives us "hidden feature" I used. Although my geometry is transparent-cutout, I use simple solid shadow collector (custom for meadow, and built-in from diffuse fallback for soccer and lawnmower). It used to work fine, but not when we try to use directional light + shadows + forward rendering + posFXes. Unfortunately I can't use full ShadowCollector pass (thru addshadow directive in surface shader), because for some unknown reason this pass can not access my depth buffer, so it can't cut the same holes like in regular pass. This is the reason we see garbage (if we use skybox) or empty background "hole". No matter how hard I tried - no result. Even if it worked you would probably won't be very happy to add another expensie grass pass for shadow collecting. Anyway I wasn't happy, that's why I use simple shadow collecting pass and it worked (!) ... without postFXes. But the problem isn't hopeless...

    2. Problem is only in forward + directional light. You could try to use another type of light. It might be slower, but will work as far as I added fullforwardshadows directive to the shader. You could also use deferred. I experienced problems with directional shadows in deferred when lightmapping (single) is on. When I put off lightmapping I can get any shadows and number of lights. That's not bad ! But...you might not like deferred as it always uses 2 passes for everything, so solution is slower than forward with 1 (directional) light. Furthermore, you might need to use antialias which deferred lacks of... But the problem isn't hopeless...

    3. By accident I came across problem magically disappears when you turn on ... antialiasing :) Well. You might not want to use antialis and still need to use forward lightmapped directional light with its shadows and postFX. Well, the problem isn't hopeless...

    4. As we know what causes the problem, let's turn of shadow collecting passes completely for grass. Comment my shadows collector pass in meadow subshader and turn off fallback at the end of shader code (put Fallback Off instead of Fallback "Diffuse"). Remember to do it in both shaders - regular and OpenGL "_ALT" version. The whole hackish trick is that when you do it and the same time leave shadows receiving for grass mesh TURNED ON, grass will still receive "dummy" shadows via underlying objects. In soccer example - put big plane of playfield dimensions just under the grass and attach a material with such simple shader:

    Code (csharp):
    1. Shader "Custom/DummyShaderCollector" {
    2.  
    3. SubShader {
    4.     Tags {"Queue"="Geometry-1" "IgnoreProjector"="True" "RenderType"="Opaque"}
    5.     LOD 200
    6.    
    7. Pass {
    8.         Fog {Mode Off}
    9.         ZWrite Off ZTest LEqual
    10. ColorMask RGB
    11. Color(0.2,0.4,0.02 ,0)
    12. }
    13.  
    14.     // Pass to render object as a shadow collector
    15.     Pass {
    16.         Name "ShadowCollector"
    17.         Tags { "LightMode" = "ShadowCollector" }
    18.        
    19.         Fog {Mode Off}
    20.         ZWrite Off ZTest LEqual
    21.  
    22. CGPROGRAM
    23. #pragma vertex vert
    24. #pragma fragment frag
    25. #pragma fragmentoption ARB_precision_hint_fastest
    26. #pragma multi_compile_shadowcollector
    27.  
    28. #define SHADOW_COLLECTOR_PASS
    29. #include "UnityCG.cginc"
    30.  
    31. struct v2f {
    32.     V2F_SHADOW_COLLECTOR;
    33. };
    34.  
    35. v2f vert (appdata_base v)
    36. {
    37.     v2f o;
    38.     TRANSFER_SHADOW_COLLECTOR(o)
    39.     return o;
    40. }
    41.  
    42. fixed4 frag (v2f i) : COLOR
    43. {
    44.     SHADOW_COLLECTOR_FRAGMENT(i)
    45. }
    46. ENDCG
    47.  
    48.     }
    49.    
    50.    
    51. }  
    52.    
    53. }
    54.  
    55.  
    This plane will not render itself as it doesn't write in z-buffer and its contents will be replaced by ball, but it WILL receive shadows the way grass can show it :D.

    And here is the proof:

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

    I use postFX glow here (turn shadows on by L button). As you may see, solution is smart, but not ideal. Not only our dummy plane receives shadow on the grass, but also lower part of the ball which is placed under the grass surface. It's, however, visible only when you look from low angle and is not visible all the time (try to orbit camera around the ball to see what I mean).

    I hope next versions of Unity will bring better solutions. Maybe problem will be fixed at some stage or another possibility will arise so that I could cutout intersecting grass pixels better (without usage of custom depthbuffer). Ideal soultion would be I could use main camera depth buffer but without grass rendered. I could then render grass after other opaque geometry. Already tried different solutions (multiple camers, etc.) but without success.

    Tom
     
    Last edited: Aug 19, 2012
  11. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    Not necessarily related to the grass but since i noticed it on this plugin, who's wrong? Your fps or unitys? because that's pretty important when pondering wether it'll run far elsewhere (the 2 additional labels are total update calls and total time since start, which are closer to your reported fps, but i'm having a hard time believing unity's fps counter could be so wrong)
     
  12. tomaszek

    tomaszek

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

    Well, just don't believe Unity... Can't say the method of measuring GPU load is right or wrong here, but this is GPU intensive shader. Unless you've got hardware like 580GTX or HD 6850+, it's rather impossible to get 700fps (maybe I'm wrong, because I'm getting about 150fps on my GT240). I assume you have these ca. 30fps on kind of laptop hardware.
     
  13. jbenjaminhollman

    jbenjaminhollman

    Joined:
    Jul 4, 2012
    Posts:
    2
    Is it possible to place grass at run-time, for instance applying it to realtime randomly generated terrain?
     
  14. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Look at page 5 of the thread. Yes - that's possible - KEMBL already resolved it. If you'd like to put grass in random places - it's more complex, but my engine is open-source. Just hack into pointgroups that constitutes grass area borders and try to make instantiation process realtime.

    Tom
     
  15. CommunityUS

    CommunityUS

    Joined:
    Sep 2, 2011
    Posts:
    240
    I am certainly interested in this asset. I've tried to read through most of the comments and have gotten a lot of questions answered.

    One thing I haven't found yet is - according to your benchmarked cards:
    ...how many polygons and draw calls could I add on top of the meadow example. How many with lightmapping, and how many with realtime shadows. I am just looking for rough guess/ballpark, I know it depends on several things. On my mac the grass scene runs about 50 fps, and I've kinda been using my mac as a bench mark. I also test on a PC with a new card with more ram and support for DX11. However, my question is focused around really any computer between 3-5 years old...how many poly's and additional draw calls could I add...assuming my models are optimized as much as possible etc.

    I hope this question isn't too vague, perhaps some users can post their results as well. Thanks everyone!
     
  16. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Meadow itself isn't poly intensive. You can draw grass on single triangle ! Just put anything you need. If anything occludes my grass, performance hit will be minimal as my expensive fragment program will never run (it's set as render queue geometry+250 so it's rendered late).

    You may also check this version on your Mac:

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

    It seems that now grass works on every Mac with SM3.0 GPU (something good happened to Unity's GLSL optimizer in the last year). It's optimized version.

    When I'll find a moment I look into grass package again. I've got some ideas how to improve performance further, but now I'm hard woking on terrain shaders (may look at my another thread about relief shaders).

    http://forum.unity3d.com/threads/157573-CryEngine-like-terrain-look-%28I-mean-it-!%29-for-Unity-%28indie-yes%29
    http://forum.unity3d.com/threads/152531-New-relief-mapping-techniques-%28fast%29

    ATB, Tom
     
  17. andrewc

    andrewc

    Joined:
    Aug 20, 2008
    Posts:
    180
    Hello,

    The most demo works on my mac great. Before purchasing, I just wanted to confirm that the shader works with light-mapping, both dual and single in deferred and forward, on a mac. Are there any cases where it will not work?

    Thank You
     
  18. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    It works with lightmapper. Example scene is lightmapped (single) and works in forward and deferred.

    A hint before I update package on AssetStore - Mac users can go to VolumeGrass.cs script and make function checking compatibility (first function in the script) return always true. In next VolumeGrass releases the most probably there will be no such thing like separate shaders for directX and openGL since after some fixesdone by Unity in GLSL optimizer things should just work on every Mac with GPU of SM3.0.

    Tom
     
  19. rgoomes

    rgoomes

    Joined:
    Dec 12, 2012
    Posts:
    6
    This volume grass system looks amazing and I want to buy it but I have a question, is that possible the change the grass mesh to different one? Because I just see the same grass in all of your videos. And is it possible to change height and colour of the grass? For example I have an idea to put rye on my game and for that I need to change the colour to some kind of yellow and the height. Will this product do this?
     
  20. andrewc

    andrewc

    Joined:
    Aug 20, 2008
    Posts:
    180
    Cool, seems to work well. One thing I couldn't figure out from the docs, can you convert an existing mesh to grass rather than drawing the mesh, I'd like to preserve some very specific dimensions and lightmap uv's

    Thanks
     
  21. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    At this stage - it's possible, but does not work out of the box. You'll have to uv map a mesh yourself and compute right values to be put into material "internal" material fields. How to calculate them is rather easy to figure out checking VolumeGrass script. There is also how dynamically created mesh is uv mapped depending on desired density and height. More complex would be extruding proper sidewalls of grass. Anyway - nothing is intentionally hidden from user.
     
  22. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    It's fully adjustable. Grass look depends on what you would use as grass slices - it's based on texture. There are rich coloring features inside (bottom coloring, general coloring depending on the position). You may refer to pdf documentation (take it from the first post of this thread). You should be aware than your rye should be rather dense. The more "holes" in grass slices texture the more steps are necessary to resolve computations and the same time shader might become expensive. Using only a few stalks is not good idea.

    Tom
     
  23. mah

    mah

    Joined:
    Sep 15, 2012
    Posts:
    12
    since I am totally crap at scripting and tech stuff, is there any chances your thing could run on android?..
     
  24. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Any chance - hard to say as I'm not much into mobile platforms. You might try to uncomment:

    #pragma exclude_renderers gles

    everywhere in my shaders. Could work or not :). Anyway this will be still too slow on most mobile devices.
     
  25. incubegames

    incubegames

    Joined:
    Jan 4, 2013
    Posts:
    2
    Hi. I have a "small" problem with. I can't import it. It stops on GrassShader_ALT.shader and all hangs after that. On the next start Unity, I get the message: "Automatic import for 'Assets/VolumeGrass/_Shaders and Materials/resources/GrassShader_ALT.shader' was disabled because the asset importer crashed on it last time. You can use 'Assets -> Reimport' to enable automatic importing again." and all hangs again on GrassShader_ALT.shader. Reimport doesn't help too. Unity crashing every time on import. What to do, what's the problem? Unity version 4.0.1f2. Best regards.

    UPD. Problem in Unity4. In Unity 3.5 works well.
    UPDUPD. I was able to import it in Unity 4, after 4 hours of waiting. And I got a strange message -"<RI.Hid> Device is not supported: Audio Controls (65280, 0x0001).". Mmm... AudioShader?! Very nice :)
     
    Last edited: Mar 12, 2013
  26. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    GLSL shaders tends to take veeeeery long to compile in Unity -sorry, I can't help. In regards to _ALT shader. I still don't have time to make update refreshment of the project, but _ALT shader seem to be not necessery now. It's version for openGL only as some functionalities didn't work in OGL previously. Now they work (Unity still works on Cg shader lab compilers), so you could uncheck it when importing. Then in script for VolumeGrass you can set the function that checks compatibility to return always true, this way alt shader won't be used and regular shader that has been written for direct x should work, and work much faster.

    Tom
     
    Last edited: Mar 18, 2013
  27. Piers909

    Piers909

    Joined:
    Feb 27, 2013
    Posts:
    25
    I noticed both demos prevent the player from going below the grass line. Would there be a problem if my player was able to crawl through the grass?

    Seriously considering buying this - awesome work!
     
  28. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Yes, the reason my camera moves like this is that the grass looks best from this perspective. Generally the most problematic perspective is when you view it from sharp angles (view direction exactly perpendicular to the grass surface). This is the potential issue when viewing grass from regular distance (0.5-2m) and viewing angles 80-90 degrees which is rare in 1st person or 3rd person scenarions.

    Your problem is more serious one as VolumeGrass has its "height". It's distance from real ground (i.e. terrain) and grass model surface where I render it. So - you can't put the camera that low and move among grass blades because this moment you'll go under grass model surface - grass disappears there. So - if your project needs crawling camera - this system might be not for you.

    Please, try this player (I allowed camera to get below grass line (using , / . keys) - you'll see the explanation of above:

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

    ATB, Tom
     
    Last edited: Mar 22, 2013
  29. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    How big can the grass area be?
    Is it suable for like 5km square?
     
  30. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Generally - it doesn't matter. The only limitation you should consider is that grass have to be rendered on some surface which is regular mesh. If your area shape is simple - without many hills, the grass model can be quite simple. You can also split your grass areas into smaller pieces if you find it convinient (and simplier to handle by Umbra occluder).

    ATB, Tom
     
  31. pbosteels

    pbosteels

    Joined:
    Jan 6, 2013
    Posts:
    1
    This grass looks great! Would it work on tablets (iPad or android) ?
     
  32. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Look a few posts above.
     
  33. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Would it be possible to use this plugin to create grass in real-time?

    I'm making using voxel terrains which are built dynamically, during the game, chunk by chunk (a chunk is a small portion of terrain). Could I create grass on each chunk in real-time without having a big impact on the frame rate? Would it be easy to make the grass follow the chunk's mesh geometry (i.e. non-plane geometry)?

    Thanks
     
  34. erran-liu

    erran-liu

    Joined:
    May 13, 2013
    Posts:
    10
    This is the most amazing plugin I've ever brought in asset store, and totally worth the price!

    There still two problems for us now.

    The correct grass
    $correctGrass.jpg
    The flicker grass
    $wrongGrass.jpg

    When we built grass far away from (0,0,0) (Like (500, 100, 500)), the grass became the wrong one.If we build the grass at (0, 0, 0), the result is good. And it's only about where did you build it, move the grass after build won't make the grass different.




    The second problem is about the side wall, we have a big of grass area in the scene, we need splat the grass in to several blocks, each block is a grass volume. But when side wall generate, the side wall cut other grasses like this.
    $withSideWall.jpg
    When we delete the sidewalls, the seam gone.
    $withoutsidewall.jpg

    I still need the side wall function to make the edge of the grasses good, is there any way to make it work with multi-grass-volume?
     
  35. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    VolumeGrass has all source code, so - possible, the only impact on frame rate on build is creating surface that will display grass, but as you're able to make voxel mesh realtime, I guess it's also possible to make grass surface realtime. You have to implement build() function so it works realtime, because now it's editor based functionality. Look a few pages back. As I remember Kembl resolved this in his project. Grass surface can be any mesh (not _too_ wavy because of possible artifacts) which has proper setup (uv, normals, tangents +params that are injected into grass material via editor script on build() ).

    ATB, Tom
     
  36. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    I'm glad you find it useful.
    I can't see attachments (forum engine problem), but I know what you're talking about.

    Answer 1) comment all #define CUSTOM_HASH_FUNCTION in GrassShader.shader, this function adds random offset to grass planes so hide tiling. When we don't use custom hash function, we use random texture and your problem will gone. You can also rewrite custom hash function - make modulo on argument used (lat's say %20) so function input doesn't have big world position values. This is problem of floating point precision. Or - write your own hash function. I introduced it because math in this shader acts faster than texture lookups which we've got a lot here.

    Answer 2) To make multichunk grass (good idea BTW) you can disable sidewalls per side, not only per model - refer carefully to docs.

    ATB, Tom
     
  37. PranayKamat

    PranayKamat

    Joined:
    May 29, 2013
    Posts:
    6
    Hello Tom,

    I just bought a copy of the package and have this strange issue. the side walls seem to have the normals pointing inward. $SideWall_flipped.jpg

    Not sure if it is only on my system or generic.

    Also does this work in DX 11? i got a blank plane when i hit the build button.
     

    Attached Files:

    Last edited: May 29, 2013
  38. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    @PranayKamat

    Try to place mesh control points the opposite direction (clockwise) while composing the grass area.

    I haven't tested in under DX11 yet, but I'll do it in next release.

    ATB, Tom
     
  39. PranayKamat

    PranayKamat

    Joined:
    May 29, 2013
    Posts:
    6
    Cool clockwise direction fixed it.. Would be helpful for others if docs reflected this.

    Another issue.. am planning on using this for grass pavers. Creating a mesh for each small area is painstaking. I see you have a feature to change the grass height at vertices anyway i can use a mask instead?

    thanks
     
  40. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Pavers... You could try to use subshader version that is used in lawnmower example - it uses texture mask (it creates the mask realtime when lawnmower moves) that control grass height, too. You might try to adopt it (follow the setup of example lawnmower scene).

    You could also try to make one paver cell, setup its mesh (its done via my script that build grass). Then populate this mesh (with the same material used), then try to combine meshes (batch it) as we don't like to put separate drawcall for each paver cell.

    You might also try to setup your own mesh (inspect how its done by my script - I mean uv coords and vertex colors).

    ATB, Tom
     
  41. artician

    artician

    Joined:
    Nov 27, 2009
    Posts:
    345
    Hi,

    I was finally able to pick this up. I had no idea what I was getting into, and it's really well made.

    When I attempt to modify the volume height on vertices, it's extremely slow. If I click one vertex to lower the height, it takes between 20-30 seconds before seeing any result, and Unity is frozen during that time.

    Thanks for any help.
     
    Last edited: Jun 12, 2013
  42. tomaszek

    tomaszek

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

    Look for VolumeGrass/_Internal/Editor/VolumeGrassEditor.cs script. Inside you'll find such lines of code:

    Undo.RegisterSceneUndo("grass edit (height)");

    You may comment it as scene undo behaves extremely slow for more complex scenes. Although you won't be able to undo your height painting, everything will work faster.

    ATB, Tom

    P.S. I'll try to fix it in next release w/o breaking undo functionality (hopefully I find time to do it in a month or so... ) as I'm working on RTP / RSP unpdate now.
     
  43. artician

    artician

    Joined:
    Nov 27, 2009
    Posts:
    345
    That's great, I will try this. Thanks for your reply.

    One more question for you: I have skinned meshes crawling through the grass, but despite being on the proper layers for the Setup For Grass Rendering scripts culling mask, they appear grey whenever they're obscured by any of the grass. Does this not support skinned meshes, or am I doing something wrong?

    Thank you again.
     
  44. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    I use replacement shaders that render into depth texture. This texture is then used in VolumeGrass to check where "cut holes" in grass blades for geometries that intersect grass mesh surface. In fact I haven't tested this for skinned meshes - you'll probably have to go a little deeper into what's going on inside. Check where this render texture is being prepared and check whether your skinned meshes are rendered right or not.
     
  45. matthuston

    matthuston

    Joined:
    Sep 29, 2009
    Posts:
    14
    Does this work with Unity 4 ( I see that it Requires Unity 3.1 on the Asset Store page )
     
  46. tomaszek

    tomaszek

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

    No current user (some of them for sure use U4) complain about Unity4 with VolumeGrass - I believe you can go ahead :). If anything would be broken I'll gladly fix it...

    ATB, Tom

    P.S. Excuse my response lag (it's holiday time here in Poland).
     
  47. TimeSniper

    TimeSniper

    Joined:
    Nov 26, 2012
    Posts:
    18
    Hello?

    Before purchasing this addition, I'd like to ask some questions.

    I'm making a golf game. And as you know, golf courses have such as fairway, green, rough area. In case of rough area, grasses and lawn are long enough. As a result, if I use yours, it will give me best result.

    But in case of fairway, the lawn is mowed shortly, which, I guess, will let the players see empty spaces among the lawn sprites. But I'd like to have it most realistic. I wonder if I will have a solution for this with your product.

    For the green area, different type of lawn is used. It is the shortest and very fine. Can you advise me how I can make them using your product?

    Thanks in advance.
     
    Last edited: Sep 27, 2013
  48. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Empty areas of short mowed grass - it depends more on the angle it will be viewed from. If not much steep (in worst case almost orthogonal to terrain surface) user won't see the empty "cells" as my shader "bends" viewing direction inside pixel shader. You can also adjust cells size (distances between subsequent virtual billboard planes). You can refer to my soccer example - and you could make it just right this way, but in a but different scale as golf ball is smaller. Anyway it should work fine.

    The only problem might be places where longer and shorter grass stick together - you'll have to use precise models there. By the models I mean grass outline as viewed from the top which are then virtually "extruded" (this shape is edited via my editor). Also I've got a ready made script that can extrude any flat mesh (flat I mean it's a surface, not a volume) which is not yet part of package as I'm focused on my other products. When you buy VolumeGrass, you could drop me a PM so I can give it to you.

    Anyway - the time for better grass will come I believe, because I haven't revised this package for a while...

    To hide more artifacts you can always put some mesh detail on the grass which would also improve the look, so it's not that "similar" everywhere. The same way I showh this near the tree trunk in meadow demo. Unity billboard grass is mixed with my grass.

    Tom
     
    Last edited: Sep 27, 2013
  49. TimeSniper

    TimeSniper

    Joined:
    Nov 26, 2012
    Posts:
    18
    Hi Tom,

    Purchased the pack last Friday and left a PM requesting the script you mentioned. Meantime, I have played around your pack. But still I cannot understand what you mean by "By the models I mean grass outline as viewed from the top which are then virtually "extruded" (this shape is edited via my editor)". I have found the outline of Mesh is something like green wall when looked from outside of the mesh. Do you mean the model that can cope with this, something like 3D grass?
     
  50. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    The outline is shape that defines the top surface of "grass volume". Grass volume is model which has top surface covered by triangles that follow outline shape and "sidewalls" that define grass viewed from side. The outline is defined in my editor - it's described in docs. Try to build your patch of grass (outlined by any shape editer in my tool) then you'll realise how it works. You'll have only a basic mesh (top volume surface and its sidewalls) while all magic is done inside shader. That's why we see grass billboards "inside" volume. Give me your invoice # for verification purposes and I'll give you script that can use any flat mesh instead of this edited outline for VolumeGrass to work.

    Tom