Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[RELEASED] DirectX 11 Grass Shader

Discussion in 'Assets and Asset Store' started by Nonakesh, Aug 17, 2015.

  1. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    158
    Hi, thanks for your reply.

    Using the forward only version of the shader is exactly what I have decided to do, and it seems to work well. I'm not too concerned about the performance issues, since I am targeting high-end systems (and I am quite some time from release).

    Are there any other disadvantages to using forward only? Would deferred rendering look better visually, if I used the second approach?

    I am quite happy with the look of the grass now, so I'm not too worried, but I am just trying to decide if I *should* be using deferred rendering or not?
     
  2. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    446
    The only advantage of deferred rendering is better performance with many lights. With forward rendering the grass material has to be rendered for each light source, which can be quite performance costly for a high end shader like this. In deferred the grass is rendered into a texture once, then the lighting is calculated with that information.

    Deferred makes it impossible to use custom lighting effects, that's why the grass looks so dark, it's treated like a solid material, instead of thin blades of grass.
     
  3. unity_c1ndWE1Nn46iPg

    unity_c1ndWE1Nn46iPg

    Joined:
    Jan 13, 2019
    Posts:
    165
    Hi. I can't seem to to do anything with grass painter
     
  4. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    446
  5. indieDoroid

    indieDoroid

    Joined:
    Jan 25, 2016
    Posts:
    225
    hi @Nonakesh

    May I ask if this works for LWRP or Forward rendering? :)

    Thank you!
     
  6. pagnotmf

    pagnotmf

    Joined:
    May 20, 2016
    Posts:
    23
    Nonakesh,

    I am still very much enjoying your shader. (Legacy version) I have made small advances monthly and it keeps looking better and better. I have an issue that I am having trouble solving. I am seeing dark flashing along my grass textures in game. It happens with shadows ON and OFF on the mesh. It is more obvious with certain textures.

    I am using a PSD file as a texture atlas with a proper alpha, defringing, and have tested wrap modes "Clamp" and "Repeat" with no change in results. I feel that this is not a texture related issue. I am thinking this is either a Unity problem or something with the shader modes?

    Any suggestions would be appreciated. Video of flashing issue is below. Starts with material settings in case you might notice an issue.
     
    Last edited: Sep 24, 2019
  7. ILoveMyDada

    ILoveMyDada

    Joined:
    Apr 30, 2014
    Posts:
    2
    Whenever I go to the Material, it shows it as pink. And your shader gets filed under Not Supported. Is there something I'm doing wrong? Any help would be great.
     
  8. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    446
    It doesn't support LWRP yet, but it does support forward rendering! I will add support for the different render pipelines in a future version.

    It looks like there are multiple textures in the same position. This could be a problem I fixed during development of the 2.0 update. Can you try using the new version? Make a backup first, of course. I've created a short upgrade guide here: http://stixgames.com/grassshader/documentation/upgrade-to-version-2

    Which version and platform are you on? Are you sure that you deleted any old versions before importing? Have you tried reimporting the asset, or import it into an empty project?
     
    indieDoroid likes this.
  9. webjeff

    webjeff

    Joined:
    Mar 11, 2015
    Posts:
    32
    Any ETA on a LWRP (URP) version? Would love to see that, this is the only thing holding my project from going to URP at the moment.

    Thanks!
     
  10. macish

    macish

    Joined:
    Oct 29, 2018
    Posts:
    32
    @Nonakesh hi, i updated from an old build (1.x something i don't recall) to the latest version.
    I splittet my terrain into a mesh by using the now deprecated tool (previously it was not). Now i have the issue that i can't use the grass painter at all.. it say to select a grass object but when i select a SubTerrain object it just deselect its right away. Any ideas?

    EDIT: Never mind, apparently the setup changed, while it still rendered the "old" setup just fine, it just did not recognized the grass elements without all components.

    BTW i love this grass.. by faar the best grass solution i tried yet
     
    Last edited: Oct 11, 2019
  11. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    446
    I've been working on another asset lately, which is in its final stage of development, but in that case I will try to look into it sometime next week. Let's hope there aren't any major problems while porting.

    I can't make any promises though, last time I tried to port it to the HDRP it looked like it would require a fairly intense journey through their shader code...

    Yes, it's necessary to switch to the new workflow, which helped me clean up the code a lot. I think it's both more useable and less error prone now. If you still need some help porting, I've written a really short guide: https://stixgames.com/grassshader/documentation/upgrade-to-version-2

    Also I'm happy you like my asset! If you have any other problems with using it, you can always post here!
     
    macish and webjeff like this.
  12. unity_c1ndWE1Nn46iPg

    unity_c1ndWE1Nn46iPg

    Joined:
    Jan 13, 2019
    Posts:
    165
    Hey,
    can you integrate your shader with Vegetation Studio?
     
  13. macish

    macish

    Joined:
    Oct 29, 2018
    Posts:
    32
    @Nonakesh

    What is the other asset you are working on?

    Can u tell me if burned grass could recover similar to the trail? So that "destroyed" potions of the grass regrow after some time?
     
  14. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    446
    I've never used it myself, so I don't know. It mostly depends on the developer of Vegetation Studio, but I'd be happy to help with supporting my shader in other assets, if I can.

    Right now I'm in the final stages of a Wave Function Collapse asset. If you've never heard of the technique, it basically let's you take a set of tiles (e.g. individual parts of a building, spaceship, or whatever you can imagine), create constraints for each tile (basically defining which tiles can neighbor each other), after that the algorithm will create a working model. In other words, you create a few tiles and it automatically generates maps, buildings, vehicles, weapons, or basically anything else that fits into a grid.

    I've been working mostly on an editor that makes this as easy as possible, but I'm not sure yet how long it will take. Once the documentation is finished I'll probably make a beta test.
     
  15. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    446
    I'm currently uploading an update with very basic URP support. Only randomized orientation grass and no special lighting modes, but it should be possible to work with it if you really want to switch to URP.
     
    webjeff likes this.
  16. unity_c1ndWE1Nn46iPg

    unity_c1ndWE1Nn46iPg

    Joined:
    Jan 13, 2019
    Posts:
    165
    I remember when I import your asset with VS in my project.. There was some conflict code in console and had to delete your shader. When I have time I will show you
     
  17. macish

    macish

    Joined:
    Oct 29, 2018
    Posts:
    32
    Something like this ?
    , that sounds interesting!

    Could you still answere my previous question regarding regrow of burned parts?
    "Can u tell me if burned grass could recover similar to the trail? So that "destroyed" portions of the grass regrow after some time?"
     
  18. webjeff

    webjeff

    Joined:
    Mar 11, 2015
    Posts:
    32
    Wow, I was sure this was going to take a long time! I'm going to test this as soon as I see the update. Thank you for working on this!
     
  19. wayego

    wayego

    Joined:
    Aug 6, 2018
    Posts:
    9
    Hey
    I'm unable to use the grasspainter because everytime I open it and select a grass object it instantly deselects it and gives me this console error. (See attachment)

    Any idea what might be wrong?
     

    Attached Files:

  20. NathanJeeves

    NathanJeeves

    Joined:
    Jul 6, 2015
    Posts:
    8
    Hey Stix,

    I am using your shader in unity 2019.2,

    For some reason im getting this horrible darkening effect, do you have any idea what could be causing it?

    I literally copied this 'crop' material from your example file.

    Cheers
     

    Attached Files:

  21. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    446
    Yes, exactly! I really love the technique, but in it's raw form it's far from usable for artists / non-programmers, so I've been trying to create editor tools that make it easier to use. I've you're interested, I've been posting some screenshots on twitter, although I'm not really very active there: https://twitter.com/simon_stix

    Sorry about that, looks like I missed the question. Yes, that's definitely possible. You could for example animate the burn strength property, decreasing it with time, then delete the object once it's 0.

    I'm honestly quite happy about the new pipelines. They seem well designed and documented. I only wish my own code wasn't dependent on parts of the old pipeline, but it was possible to fix that with some semi ugly code. If you need any specific features, tell me and I'll try to add them as well. As you might guess it would be a lot of work to port everything at once.

    It looks like the problem is caused by a TransformReset script? That doesn't seem to be a part of my asset.

    I'm guessing that your sun in rotated fairly straight from above? If that's the case you can fix the problem by using the subsurface scattering feature for your grass material: https://stixgames.com/grassshader/documentation/general#subsurface-scattering

    If you're using deferred rendering, I'd recommend adding a fill light to brighten the grass.
     
  22. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,256
    Will this work on standard renderpipline with metal? as metal does not support geometry shaders.
     
  23. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    446
    If it doesn't support geometry shaders, then the DX11 shader won't work. The grass fallback should work as expected.