Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Volume Grass system on Asset Store soon

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

  1. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    Hi there,

    I've decided to move discussion here from thread:

    http://forum.unity3d.com/threads/76748-Volume-grass-system/
    (if you have any questions read above thread first)

    Volume Grass system is nearly complete. If only below links work on every Mac (that with GPU of SM3.0 / conditionals compatible cards) the only thing is write a bit of documentation and I'll submit the system to the Asset Store (counting that Unity staff response reasonably fast because a few people asked me about release date):

    http://www.stobierski.pl/unity/meadow.html
    http://www.stobierski.pl/unity/soccer.html

    The demos and used assets will be included in the package together with some additional scripts/goodies to help setting up quickly.

    The system will consists of grass mesh editor - you'll be able to conveniently place grass areas of any shape/coverage on the ground and the heart of the system - special volumetric (raytraced) shader to render it (so beware of performance that should be reasonable for mid range GPUs - SM3.0 with conditionals / texture2Dlod compatible at least).

    So - please report me any issues before I submit the content to be sure every potential customer (esp. Mac one where some issues with shader occured) will be satisfied.

    EDIT - the package is already on AssetStore.
    Two additional links for potential users are:

    Example workflow:


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

    EDIT - VolumeGrass v1.1 (mowing expansion)
    By request of a user new mow expansion is ready on AssetStore, look at live demo available:

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

    This tweak can be also used to cut grass randomly - when we use noise texture to modulate grass height (like in lawnmower example) we can achieve effect of "bumpy" grass with even more depth apperance comparing to the original.

    I also tweaked a bit grid revealing when viewed at sharp angles. One may refer to new version of pdf docs available. I made some minor changes to documentation and adjusted it to mowing extension.

    For some GPUs configs (for example Win XP, 7900 GS) z-testing has been fixed so ball and lawnmower properly intersect grass.

    Everything at new better price ($75). This is what I meant by repricing it "a bit". I believe now it should be attractive for more users.

    EDIT:
    New Volume Grass (1.5) is submitted for Asset Store. Can't tell when it will be ready to get. You can look for new thread here:

    http://forum.unity3d.com/threads/volume-grass-unlimited-density.256497/

    as a sneak peak for new version I update here some pictures:

    screen1.jpg screen5.jpg
     
    Last edited: Jul 11, 2014
  2. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    I've got additional wish to Mac users.

    Please, test the following links on various Macs (except for nVidias GF8000 and above, because I already know all optimizations works without crash as in very original version of shader - tested on d3d9 - PC):

    http://www.stobierski.pl/unity/soccer_MACTEST_A.html
    http://www.stobierski.pl/unity/soccer_MACTEST_B.html
    http://www.stobierski.pl/unity/soccer_MACTEST_C.html
    http://www.stobierski.pl/unity/soccer_MACTEST_D.html

    Please report which of above versions eventualy crashes the player (or doesn't work at all, however they might look weird).
    Testing result might greately help with Mac shader version and it's optimization issues. I'd like the shader works as fast as possible on the widest range of machines.

    ATB, Tom
     
  3. thellama

    thellama

    Joined:
    Mar 25, 2010
    Posts:
    360
    Nice grass, this looks very cool. How easy it it to change the style and look of the grass?
     
  4. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    Easy :) I'll probably upload some tutorial/demo on youtube soon with quick workflow overview.
     
  5. thellama

    thellama

    Joined:
    Mar 25, 2010
    Posts:
    360
    I look forward to it. Could be a great asset in my current fantasy project.
     
  6. RoiDanielsen

    RoiDanielsen

    Joined:
    Nov 10, 2010
    Posts:
    130
    Wow, just wow. Is it actually possible to use it as ground instead of the plain old texture way to go? How perfomance heavy would it be?
     
  7. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    Don't know what exactly you want to achieve, but this grass system can't be replacement for terrain (ground). In simple case (like soccer field) it's just a slim "box" mesh with special shader that renders grass inside such "box". You could give it the mesh collider, but it won't work good as collisions would be detected at the surface of grass rather than on it's "bottom". In soccer example I put plane collider below grass mesh so ball behaves like it should.
     
  8. MEGATON

    MEGATON

    Guest

    Joined:
    Mar 3, 2008
    Posts:
    28
    It looks really amazing.
    I'm wondering if you need to be, or have already been, considering the copyright of UNION Agency - Science Press, Plzen, Czech Republic written into the original paper on the first page, you linked to in your previous thread?
     
  9. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    They're pure scientists, researchers. I'm only a man who pushes their ideas to the limits :)
    Refering to the paper from I've got the original idea. No part of the paper was copied, nor original Habel's code was used. I've implemented the idea own way. In fact I found much more compact formula to describe tracing the ray (comparing to the original HLSL source code). To be sure I also contacted Ralf Habel about using the idea in my project and it turned out it's not restricted.
     
  10. Lypheus

    Lypheus

    Joined:
    Apr 16, 2010
    Posts:
    664
    Tom - any ETA on when this will be available on the asset store? Also, how is the grass handled - do we "paint" it on the terrain as per the current foilage option in the terrain inspector (i.e. is applying this to an area integrated with the unity3d editor)?
     
  11. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    I'm just finishing submission pack, so AssetStore staff get it today for revision. I'll try to make youtube movie today, too. Thank you for your patience, stay tuned :)
     
  12. Lypheus

    Lypheus

    Joined:
    Apr 16, 2010
    Posts:
    664
    Sounds good :) - thanks for all the work and best of luck with this project, count me in for sure!
     
  13. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    Last edited: Mar 17, 2011
  14. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Great product, best of luck to you!
     
  15. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    Oops,

    I've just found one little bug. Users - please put nodes clockwise when building grass shape. Puting it counter clockwise causes problems with sidewalls :).
     
  16. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    For people curious about "how easy is to tweak grass look" - please refer to package content on AssetStore (no necessity to buy the package to do it of course) . You'll find grass_blades.png in _Textures subfolder which defines slices of grass grid rendered by shader. Further look can be adjusted by right coloring grass in shader params (by fully adjustable / custom noise textures).
     
  17. CallToAdventure

    CallToAdventure

    Joined:
    Apr 5, 2009
    Posts:
    159
    I love it :) Looks absolutely natural.
     
  18. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    What about performance impact? What if i use it on whole 2000*2000 terain? How LODing works? What is better, one big mesh for whole terrain, or many smaller meshes?

    BTW, I like your documentation. This is nice example, how should be Unity documented, for example new pro water. Unity documentation team should learn from you. I would recommend them to kick current documentation team manager and hire you :)
     
    Last edited: Mar 17, 2011
  19. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    Splitting one big grass mesh into several small ones is definitely better idea. Umbra can occlude completely grass models hidden for example behind hills, buildings, etc. Considering shader itself the most important factor is platform. On PC grass always uses optimized version of shader. On Macs grass system uses optimized shader only for higher nVidias. On other GPUs on Mac alternative version of shader is used. Visual result is exactly the same, but that shader doesn't benefit from many optimizations.

    The major optimization available is far distance. For distant pixels (distance adjusted in shader properties, in my demos it's about 20meters) shader skips most of its calculations. Only 1-3 (depending on settings) texture lookups are performed to determine pixel color and fragment program breaks. So - if you make one huge grass mesh on your 2000x2000 terrain, you won't notice any performance hit (for optimized shader - PCs, nVidia Macs) that fragment program could introduce for distant areas of grass. Original terrain shader also has a few (4) tex lookups at least, so for distant pixels grass shader renders as fast as terrain shader. The only slowing down factor is then complexity of mesh (number of polys). I guess for huge terrain with many hills mesh that has to be build for grass would consists of several tens thousands triangles. Upper limit in the engine is 40000 vertices/polys. You can't build grass mesh more complex (I put this limit because its safe for triangulator which could crash beyond). I believe that optimal number of polys per grass mesh is about 5000-10000 for larger areas. Example meadow scene has 8000tris of grass mesh, but could be much smaller if we adjust build settings compromising grass mesh smoothness on hills.

    Again - splitting into small pieces will be better in terms of occlusion opportunities (grass is always static object, isn't it ?). Don't hesitate to split your grass into meshes of even a few polygons, because bottleneck is not vertex count here (unless you try to render >10000-20000 polys), but fragment program which is quite expensive.

    LODs in mesh editor works on per distance basis. You can prepare up to 4 LODs (grass meshes) with decreasing number of polys and decide which mesh will be used on specified distance. This would work similar to Unity's terrain which reduces number of polys on far areas. I put it into the system to give users the best opportunities available, but in fact, when you wisely use occlusion, you'll probably don't have to use as many LODs. First, as I said, performance bottleneck lays in fragment program, not in vertex program. Furthermore - using 4 LODs with for example 10000, 8000, 6000, 4000 tris will cause your player weight will increase considerably. In practice I believe that 2, max 3 LODs are enough.

    Next optimization is that you can specify quite different shader (material) to be used for very far, specified distances at which user probably won't see any difference between "Vertex Lit" shader and grass shader. So - if you split grass areas on your huge terrain into smaller pieces and specify that on very far distances it should use different, simple material, it will work as fast as possible.

    The last optimization (that works on every platform) is that when you build grass mesh and cut several bare "holes" (for example paths) with grass coverage brush tool, then triangles that are whole cleared from grass are skipped at once - that is, instant clip function at the beginning of fragment program skips everything and that areas costs NOTHING.

    As one may notice when preparing VolumeGrass I put much concern into performance issues. I made literally hundreds of tests and tweaks to push shader performance to the limits. Believe me or not - it's not easy to optimize shader programs with complex structure and conditional instructions inside, because every single decision on how and where place some calculations might have dramatic impact on performance as, unlike CPUs, GPUs are designed to work parallel. Hopefully GPUs of todays low-mid range level like ATI HD 4650 (available at prices below $50) will be history in a year. That's the time you'll polish your game :) and then most of users could benefit from our nice looking grass. As an example I tested meadow scene on such ATI HD4650 and it worked easily 60+ fps (webplayer 800x600).

    Final word about performance. With such expensive shader as VolumeGrass shader is, try to use forward rendering. If you put only one dynamic light, and rest is lightmapped, everything will be rendered in ONE pass. In deferred there are always TWO passes which has to be considered for grass shader... Of course if you want to have better shadows and many dynamic lights on scene, use deferred. In such case it's worth using even if grass shader has to take it in two passes.

    I hope this thorough post explain many eventual doubts.

    ATB, Tom

    P.S. thanks for nice words about my documenatation. Honestly, as I'm not native speaker I was anxious if Unity refuse my submission because of my English, but it turned out it's not that bad... :)
     
    Last edited: Mar 18, 2011
  20. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    Thanks a lot! This is really perfect answer, now I know everything I need to know :) I wish Unity support worked same way, because exactly such documentaion and support saves literally tens of hours of experimenting and frustraton. You are living proof, that if there is will to do it right way, it can be done.

    P.S. I am not native speaker too.
     
  21. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    good program, but expensive.
     
  22. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    Hire somebody to do it. It will cost you easily 4-5k euros. Or do it by yourself, it will cost you few months. Do you still think it is expensive?
     
  23. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    I appreciate the enthusiasm but must claim that the previous post contents were by no mean governed by me :)

    I'm still thinking about the grass pricing, but if I put lower price I'd have no guarantee to sell more. The same time I must admint, I was working on that for 3 months, that's right (how does Demostenes know it, it's his secret only). I didn't mean to target game developers who focus on casual games where costs, budgeting and details are not that crucial as in productions of higher budget but with more attention payed to details. I care much about details, and even if my work won't pay in terms of AssetStore activity, originally I did it only for my game I'm working on, but I've decided to make it "public" to get some credentials maybe and earn some to have a bit money for 3D artwork I need to buy.

    Now it's matter of time, I don't expect to get rich overnight, but I hope to find some developers who appreciate the quality and won't get discouraged by price...
     
    Last edited: Mar 19, 2011
  24. Pixero

    Pixero

    Joined:
    Dec 10, 2009
    Posts:
    130
    Here's one. Bought it! Great work. :D
     
  25. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,561
    This volumetric grass plugin is incompatible with iMowlawns 2.6 fixitfixitfixit.
     
  26. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    When you look around, may I politely ask you to make some honest (including eventual cons) review on AssetStore :) ?
     
  27. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    I know you're man gifted with extraordinary sense of humor, but could you please be a bit less enigmatic/symbolic :) ? Do you bother about Unity2.6 compatibility ? And how people with Unity2.6 could buy it on AssetStore (Unity3 feature ?). I used some Unity3 handfull features inside, so making it 2.6 compatible would be rather tough...

    ATB, Tom

    P.S. VolumeGrass is at least goat compatible to tweak the shape :D
     
    Last edited: Mar 19, 2011
  28. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    This is no secret, I am working in SW developement for years, so I am able to make qualified guess :) I think the price is OK and my team is considering to buy it.
     
  29. artician

    artician

    Joined:
    Nov 27, 2009
    Posts:
    341
    Your English is good!

    Your extension is great! :)
     
  30. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=24794

    Sorry but $90 is too expensive.

    If you hire someone to create Unity, it would cost you millions $, what if Unity was sold $15,000 instead of $500??? Thinking like this, you should go on the Unreal forums. Guess why we are all here? Because we can afford to buy Unity!
     
    Last edited: Apr 26, 2011
  31. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    Fortunately you are not the one, who is dictating the prices, but market. I would like to have Ferrari, but I am not calling them each day and telling them that $200k is too expensive, that it is only car anyway, so OK price would be $20k, because they would sell more :)

    I noticed, that you have such comments in each topic, even for $20 assets. Too expensive! Pls lower! Being part of Unity community does not mean to be cheapskate. If you dont like the price, dont buy it and do it by yourself or get some job. Even by frying burgers in McDonalds you can earn $90 in one day in most of countries and believe me, it is 100x less work then write such shader by yourself, even if you had the skill.
     
  32. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    Volumetric grass costs $90. Bottom line, it is too expensive.
     
    Last edited: Apr 26, 2011
  33. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    I don't want to stay on defending position. I don't feel right about having explaining the pricing. All I can say is that my price is real considering amount of work I put into it and considering its quality.

    I know that for independent developers $90 may be expensive, but the same time comparing my grass system to free irrlight implementations from forum thread you've posted is a bit abusing... If I did the same work that forum people had done I'd never sell it at this price. I'd share it free for sure. Unfortunately even 1:1 Unity implementation of original idea is not that trivial as unity does not write into z-depth buffer in fragment programs which would be necessary when grass intersects other objects.

    Basically what they (irrlight forum) did is simply copy/paste job from Ralf Habel's paper HLSL shader. I went muuuuch further. I not only rebuilt shader idea from scratch, but improved it _considerably_. Note that shader is not all. Try to build grass areas simply using only the shader and you quickly realise you have to spend much time tweaking mesh that will have shader attached to. Refering to my improvements, original HLSL (irrlight) shader has NOTHING to do with grass coverage and grass area borders. With my mesh editor the whole workflow from start to end costs a few clicks to place mesh of any shape / coverage on desired land parts.

    Again, I don't want to argue with the pricing discussion, but I feel uncomfortable when my product is compared to almost useless (although constituting good start) solutions available on irrlight forum. If that would be so simple, tell me why I can not see this kind of grass in any game released after 2007 (when the original idea was born) ?

    I'm considering repricing it _a bit_ ($20 per this system does not make sense for me), but first I have to wait a moment to not make any decission prematurely. It's only a few days since I released the package.

    All the best,
    with full respect to the whole game developers community,
    Tom
     
    Last edited: Mar 21, 2011
  34. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    Thanks for your answer, I am not trying to say that your work is not worth the money, it is without any doubt a very respectable work, and I congratulate you for this hard work, really.
    This said, it is only grass. I mean unless you need to have grass in the center of your game, grass is not going to be an investment for the game developer standpoint.
    If I was shopping for a Fantasy game, I would first buy houses, weapons, IA, monsters, NPC, heros, and grass, maybe. If it is cheap, I will buy it just in case I need it, it does not hurt, $20 bucks, why not?
    But $90, I ask myself, hum... I could buy 3 animated monsters with that.

    Once again, my intent is not to upset anyone. I will understand if you do not change your price. Just remember the maths. Selling to a lot of people makes more money than to a niche of fans.
     
    Last edited: Apr 26, 2011
  35. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    I definitely don't target Indie users (it won't work for indie, at least no z-testing will be possible). Mobile developers are not of my concern either, just because this shader would crawl on mobile devices. It's dedicated to developers who need something "special", I'm selling caviar, not burgers :).
     
  36. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    Ok, understood.. Thanks to make it clear. ;)
     
    Last edited: Mar 21, 2011
  37. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    By request of a user new mow expansion is on the way, look at:

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

    Note that lawnmower customized version of shader can also nicely work for "bumps" on the grass (when "mowing" texture is random hi-freq noise) so grass can look even more detailed now. Little drawback - "mowing" subshader version is a little slower than original (as we have to set higher number of ray iterations to get convincing results at bare/mowed areas).

    Have fun :)
     
  38. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,561
    ROFLMAO! Ok that is just awesome :D On the strength of that coming from the original joke, I'm gonna save up and buy it :) Cheers! :D
     
  39. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    3,921
    Does this work in real life ??? So easy to do the garden .... Really nice !!
     
  40. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,561
    Imagine a version with random physics snails, small toys, rocks and grass particles, all flying up from under the mower, haha.
     
  41. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    3,921
    oh yeah, and a guy making stack of this cut grass ... just for me ...
     
  42. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    3,921
    BTW, one question : can this shader be used as a hair/ fur shader ???? Sorry, it's not the first time i go on this thread ... maybe it has already been answered...
     
  43. Pixero

    Pixero

    Joined:
    Dec 10, 2009
    Posts:
    130
    The lawnmover was great. Maybe some grass flying out behind it when cutting?
     
  44. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    Sure, but you'll have to implement such "bells and whistles" yourself :). BTW, May I ask for some review on AssetStore ?
     
  45. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    http://forum.unity3d.com/threads/76748/

    There's discussion on that.
     
  46. Pixero

    Pixero

    Joined:
    Dec 10, 2009
    Posts:
    130
    Sure, but I haven't had time to try it out much yet. Too much work...
     
  47. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,522
    It looks really good compared to what I can do with the default grass system in Unity, but I don't quite understand, what makes it different from the normal grass system? What does it mean when you say its volumetric? Note I am not well versed with fundamentals of shader technology.
     
    Last edited: Mar 27, 2011
  48. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,861
    Look at the first post of this thread and refer to documentation. It should make the technique used more clear to you.
     
  49. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,522
    Isn't this something the default Unity grass already does? I thought Unity's default grass are already as shaders. I still don't understand it and what it does to make it look better than Unity's grass.
     
  50. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,561
    Hello, underdog, look at your grass, now back to his, now back at your grass, now back to his. Sadly, your grass isn’t his, but if you stopped using the built-in grass and switched to Volume grass, yours could look like his. Look down, back up, where are you? You’re on a forum with the grass your grass could look like. What’s in your hand, back at me. I have it, it’s a wad of cash for that grass you need. Look again, the cash is now the plugin. Anything is possible when your grass looks like his grass and not the built-in kind. I’m on a lawnmower.
     
    AnomalusUndrdog likes this.
unityunity