Search Unity

[RELEASED] DirectX 11 Grass Shader

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

  1. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    Sadly, it didn't work :/ don't know why the connection breakes up. I downloaded files in gb size already, so it's not about my connection can't handle some file sizes in general. It must be something else.

    edit: It's pretty much exactly 5 minutes, so it's a fixed timeout.
     
    Last edited: May 30, 2019
  2. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    I'll look into those warnings. Thanks for the report!

    I think I've found the problem! I could reproduce it while trying to record a video tutorial. Can you try the newest beta (beta 7) to see if it fixes the problem for you as well?
     
  3. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    397
    Hello,

    Problem is still there, basically to summarize it:

    Case 1: On the grass plane object, in editor, if the component grass renderer is expended but the material component is collapsed: No stuttering anywhere, everything is fine (that was stuttering before and I had to reduce the grass renderer component)

    upload_2019-5-31_16-9-32.png

    Case 2: Same as case 1 but this time I expend the Material component (that is kind of built-in the Grass renderer component if I get that right?), all the editor, scene view etc. stutter like crazy (probably 1 to 10 fps max)

    upload_2019-5-31_16-11-46.png

    Case 3: I instead change the material property on the material itself in the project hierarchy: no stuttering, it's not the fastest and smoothest but honestly it's really fine to handle, almost perfect let say

    upload_2019-5-31_16-13-48.png

    So the issue is only with Case 2, and so on my side, I'm fine to edit the material directly. I just need to have the stutter when I want to expand the material component on the game object only when I need to paint. But the good thing is that the painter close the inspector window so the stuttering doesn't happen when painting.

    So from my "troubleshooting" it's clear that it's with the built-in display of the material inside the grass renderer. Have no idea why as you can see in Case 1 and 3 it's all ok
     
  4. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    Yeah, that's exactly what I experienced, however, my fix seemed to stop the problem, at least in Unity 2019.

    Can you check something for me? Go to the GrassRendererEditor.cs and comment or delete the following lines:

    Code (CSharp):
    1. materialEditor.SetDefaultGUIWidths();
    2. var offset = EditorGUIUtility.currentViewWidth * 0.55f -64f;
    3. EditorGUIUtility.fieldWidth += offset - 10;
    4. EditorGUIUtility.labelWidth -= offset + 15;
    That code shouldn't be used in the new version any more, but who knows, maybe I missed something. Either way, I hope you can work well enough by just editing the material directly. I think that should only be a minor inconvenience, right?
     
  5. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    The Beta7 has the same time limit :/
     
  6. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    397
    My bad, I now deleted the whole Beta from my project (I updated from beta 5 to 7) and reimported 7, it works fine with no more stuttering!

    Thanks a lot, that was a great job tracking and fixing that bug :)
     
    Nonakesh likes this.
  7. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    411
    Wow. I´am impressed and so happy. An first test. Just purchased today and added NGSS contact shadows, some HBAO layers and PPV2.

    Can t wait to try the Beta and hope i could reach the same.)

    Do you have already some bullets about changes?

    I will use this on a fotoreal meshbased driving/race track.
    Do you think motion vectors and grass removal at faster speed is possible. The flattening works great . But at higher speed the flattened instances should be removed .)
    GPU instancer has this option integrated.

    Also nice would be HDR color fields in shader editor. (like in GrasFlow Asset)
    Would allow to simply pick colors from ibl like in screenshot above.

    Gloss and Normalmaps would complete PBR workflow and help to better handle the bright speculars.


    fyi. an nice article out of the offline rendering world.
    https://cgtricks.com/making-meadow-darstellungsart/
    Some useful tips and good example for multi splat maps.
    Think with your asset you could come pretty close to this in realtime. I will try next days.


    DX11Grass_Test001.JPG
     
    Last edited: Jun 1, 2019
    VirtualDawn likes this.
  8. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    Alright, I'll try a different route and will reduce the file size of the beta. It was a bit excessive anyways, because of the example projects. I don't think I'll be able to reduce it by much, but I should be able to get it below the magic 240. Otherwise, you'll get a direct download link via private message. I really hope to automate the whole process.

    I'm glad it worked after all!

    I haven't yet, but I might as well track the changes down right now, I need the feature list for the asset store sooner or later anyways...

    • Adds a Nature Mesh Filter that can preprocess meshes and Unity terrain
    • Adds a dedicated Grass Renderer for ease of use
    • Changes the density settings to a more powerful and easier to use system
    • Adds CPU fallback, with automatic texture processing, for hardware that doesn't support the shader
    • Renames the displacement system to interaction system
    • The interaction system can now burn different areas in different colors, instead of the color being set in the material
    • The interaction system should no longer have any hardware limitations
    • Adds a texture atlas creator, which simplifies the workflow of creating texture atlases for the shader
    • The interaction trail renderer now supports jumping
    • The shader and CPU fallback now use Alpha to Coverage, when antialiasing is enabled
    • Adds tooltips for almost all parameters in the package
    • Various smaller changes and additions
    Motion vectors would be quite hard, to be honest, I've thought about it a few times because that would enable a lot of really cool image effects, but I'm not sure if or when I'll be able to look into it.
    Grass removal, on the other hand, would be fairly easy for you to implement, at any speed! Look at the documentation for the interaction system. The burn feature can be used without a burn color, so it will just remove the grass.

    Why screenshots do you mean? And where would you like to use HDR color for the grass shader? I mean technically that should be possible, but I don't really see a use case for it right now? (I'm not trying to block it, if you can tell me a good reason for it, I'll be happy to patch it, if it's as easy to do as I think it is)

    The problem here was always that with the non-randomized grass direction that doesn't really make sense, but now with the more realistic rendering mode I agree. I will probably add this in a future version.

    Your screenshot looks quite good! If you have any good results, please post them here, I'd be happy to see them!
     
  9. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    I've reduced the file size to about 100mb now, so even with the limit, I how you'll be able to download it now!

    For other people reading this, the beta download is here: http://stixgames.com/grassshader/beta
     
    Zyblade likes this.
  10. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    I could download it now, thanks a bunch =)
     
    Nonakesh likes this.
  11. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    411
    Hi,
    my pc is far away but it try to explain after some beers in the sun.

    MotionVectors
    probably this helps
    https://github.com/keijiro/InstancedMotionVector
    Sure this is high end stuff but my cameras move fast on road niveau and this is the last missing thing for cinematic quality.
    The wind movement would also be greatly benefit and i think TAA could work better.
    In the Repros from Keijiro are also other implementations and a nice motion vector debug rendering.


    HDR Color picker
    DX11Grass_Test001.JPG
    - i loaded an HDR Cubemap on a Skybox in the background. What you see here is your ExampleScene. Only hided burned grass and terrain examples.

    - on HDR Cubemap on skybox under the trees is also grass. You cannot see in the screenshot because of camera pos. Because it s hard to get grass colors right you can simply pick with pipette on grass in the skybox or the tree in area who lies not in shadow. gives a good fast match. afterward you can repace the skybox with an hdr based dynamic sky like overcloud an it simply matches.

    lt s nearly impossible to get this color by hand. (for me)
    Enable/disable post processing, here i use aces(filmic), and adjust exposure up and down. Using the picked green from the environment ibl for your grass makes it match in every post setting (low exposure like in screenshot or higher exposures and all other post color correction settings). The correct blooming from speculars of the foliage is also easier possible. Think this depends on hdr color value in linears space you simply can pick. But this need some serious tests.
    Could be easy to implement through switching unity editor color dialog stuff.

    - your explanation with non randomized grass direction i did not get. could you explain a little more?
    The optmize for camera from top is incredible. It was a big thing i never managed to get right.

    Adding normals and gloss map is costy. But in real live your grass is a ground cover and would be mixed with hand placed lod pbr foliage. Simply imagine a pbr scanned high detail lod foliage there where the white sphere is.

    It would be killer when it would be possible to integrate normal and gloss and only on camera closeups like my screenshots they are really needed. At most to get brigth blooming grass speculars under control. At the moment the grass who lies flat at the ground after trampeling gets mostly white.

    For everythig in a distance about 5m not really.
    So on highest tesselation and “lod". don t know if this is possible.

    At the moment i must define dof that it smears grass close to the camera. See shot.

    Sorry for fast write. At home i could do better explanation.

    Your shader is the most perfect i found (light source, directional light) for forward rendering and pretty close to rest of unity pbr stuff whats really needed to integrate everything in real world scenarios.
    I would try too get as close as possible.

    Fyi. Have a look on Grassflow painting for inspiration.
    Third video on store page. really nice. Unfortunately the shader doesnt implement common pbr stuff , point light, dir light intensity. Did only fast tests here.

    I will try to get your asset together with SSDM
    See screen space displacement mapping on Unity forum.
    It s in an early stage but gives such great detail on cloeseups.
    I also recommended your asset to the author.

    A last last question. On screenshot i used NGSS contact shadows. They work great for every single grass.
    But normal shadow casting i did not get to work.

    Also the SSS slider doesnt impact in my test scene.
     
    Last edited: Jun 1, 2019
  12. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    So, I could test the beta now. I already removed the 4 lines of code, which seems to slow down the editor.

    But the overall fps are like 10x slower than before. I tested out the current assetstore version of stix grass. With pretty wide range of grass and quite dense. Like 300-400 fps left. No shadows casting, only receive.

    The new one, I got like 20-40fps with a small 2m radius grass around the camera. I just imported the project, created a new material, a new scene, Pasted a rough terrain prototype and added the renderer/filter components. I did not change any material settings. The fps count doesn't increase if I "unview" the material settings.

    edit: Okay, this does only occur on terrain. The fps are pretty good on a normal mesh.
     
    Last edited: Jun 2, 2019
  13. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    So with a mesh based workflow, the beta is very nice. The performance, the option to blend the grass better to the floor and the overall look.
    One addition would be pretty nice. The option to lerp between the first and the second grass color, using the base color for the grass. So I can use a noise texture, and the grass is being shaded across this noise texture, instead each blade of grass is bein darker or lighter (which is too noise for my stylized project). Keep up the good work!
     
  14. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    If 'm looking directly in sun direction so I see the reflections and put the smooth values a little higher I can see black artifacts from the "smoothness" value left and right in a horizontal line. Here are some screenshots:

    Looking to the light source:
    shiny_01.jpg

    And looking more to the left(on the right side it's the same):
    shiny_02.jpg

    In fact, I can see those lines all the time, a little lighter than the grass color but almost invisible, if the smoothness values are around 0.5f. The getting brighter on a value range 0.4 to 0 and darker on 0.6 to 1.

    edit: maybe there is missing a "saturate" somewhere to prevent negative values, which cause wrong results?
     
    Last edited: Jun 2, 2019
  15. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    One last thing I noticed is, when I use a terrain/mesh shader, which follows the nDotL rules. The grass normals don't follow the surface normal from its underlying mesh. I don't know if it's possible, but without having at least the bottom vertices normals following the mesh normals below, I can't blend my grass smoothly to the terrain.

    Here's again a screenshot for better visualization:
    grass_normals.jpg

    You can see in the middle, it blends perfect, but on the left and right it's lighter/darker respectively.
     
    Last edited: Jun 2, 2019
  16. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    I know what motion vectors are and how they work, however it's not that easy in this case. All of the movement happens in the shader code itself, so the shader would have to calculate the last position as well, which would include the wind calculations and the interaction system. It would be quite performance costly too, as all of the grass would have to be rendered once more. I will most likely look into it in the future, but it's really not a trivial problem with the grass shader!

    I still don't really understand how HDR color would make sense with an albedo color. HDR is useful for lighting information, you can't just set the HDR color directly on the material, as most of it is dependent on the sun color and intensity. There's no simple color picker to get the exact color settings you'd need, not even with the Unity standard shader (which the lighting calculations are based on).

    Sorry, but I'm afraid you'll have to play around with your color and light settings to get it right, like with all other materials in the scene. You can still use the pipette tool for the rough color and then try to get closer to the real color value you want. Unless I misunderstood something?

    I basically just said that it wasn't possible before because of technical reasons, but theoretically, it should be now.

    I will think about implementing normals and specular textures, but most likely after version 2.0 is released.

    My shader has a grass painter tool too: http://stixgames.com/grassshader/documentation/grass-painter

    I'd be happy to work with other developers to implement new features, if its technically possible .

    Maybe your shadow distance is too high, or your shadow quality too low?

    Subsurface scattering only works with randomized direction mode. There were also some versions where it was bugged. You are using the newest beta version, right? There it should work without problems!


    Are you using the new workflow, with NatureMeshFilters and GrassRenderers? If so, maybe your subdivision settings are too high? Otherwise the performance should be exactly the same, both Unity terrain and regular meshes use meshes internally, the NatureMeshFilter simply converts the terrain into a mesh.

    Couldn't you just recolor the noise texture with the two colors? I think that would be easier and more intuitive than creating a new shader variant for that.

    Enable "Ignore specular global illumination" and those lighting artifacts should vanish!
    upload_2019-6-3_12-2-37.png

    Sorry, but I don't really know what you mean here.
     
  17. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    The normals in default unity terrain grass following the normal of its underlying terrain mesh. So for hills, which are somewhat lighter/darker (based on the light direction), the grass adapts this behavior, if I use the standard shader, or at least a custom shader, which multiplies nDotL with the final color.

    For everyone else; nDotL is the dot product of the world normal and light direction. It is responsible for a mesh being lit from one side, while being darker shaded on the other side. If you google just "nDotL", you find some example images.
    If the terrain follows this shading rule(which almost every lit shader does) and the grass is not, you'll not being able to blend grass with the terrain correctly. It's the first thing I add for any custom shader I create with amplify to support basic lighting.
     
  18. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    Oh, you mean that the grass doesn't have exactly the same color as the floor, when inside shadows?

    It's actually quite a good idea to calculate lighting for the floor first. I'm not sure if this is possible. Unity might not expose all necessary variables in the geometry shader phase.
     
  19. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    I'm just not sure if you mean the same "shadows" as I mean^^ Because receiving shadows already works for the grass.
    But if the grass is being in the dark shaded/shadowed area of the terrain, it won't adapt the shading, because either the normals are pointing always upwards or the grass has its own light calculation which doesn't include nDotL or both.

    There's an option in the grass shader, which adapts the direction from the base mesh's normal, so it's pointing to the surface normal of it's parent mesh. This is all information you need for the calculation I think. If you dot product this normal with the light direction and multiply it by the grass color, the outcoming valueshould be darker in dark areas and vise versa. If you put a basic lambert shader on the parent mesh, you could test it relatively easy. The standard shader has ggx, which causes reflections at steep angles regardless of the smoothness, which again separates the grass from its parent mesh visually^^ This is the reason I'm using a custom amplify shader for my terrain.

    edit: Ah, and the "ignore specular global illumination" doesn't change the behavior of the dark area mentioned before.
     
    Last edited: Jun 3, 2019
  20. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    I was talking about diffuse shading, which you're calling nDotL. By the way I'm not sure if modern PBR shaders still use the simple nDotL thing for diffuse rendering, instead of more complex and accurate methods.

    Which is one of the reasons why it might be hard to implement something like like in the shader. It's dependent on the floor material!
    Right now I would try to add the shading to the grass floor texture, manually fixing the problem, even though that's not exactly elegant.
     
  21. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    Yeah, pbr shader are pretty complex, I don't know what kind of way they exactly use.
    Hm, I'm currently searching for the lines of code, which are responsible for the floor texture/area of the grass. I'd like to reduce the shading to just a really simple nDotL functionality, so it matches my terrain shader : D

    edit: here a screenshot of my current grass solution, which blends smoothly with the terrain. But I like stix grass a little more, in terms of functionality and reflections and interactivity^^:

    aligned_normals02.jpg

    edit2: Okay, it's harder than I thought, to achieve the same effect on the stix grass ó.Ò
    I don't know what unitys build in grass does, but I only had to apply basic diffuse shading and it was pretty much done. I only had to tweak the color value once. Let me know if you find a solution eventually.
     
    Last edited: Jun 3, 2019
  22. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    Yeah, the whole tessellation and geometry shader stuff adds a lot of complexity to the shader.

    I actually like the idea of a new lighting mode for this, so let me check this, to make sure:
    You'd like a lighting mode, where the grass isn't shaded individually, but instead uses the normal of the floor, which creates a very smooth and artistic feel to the grass?
     
  23. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    sipon and keeponshading like this.
  24. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    That would be pretty nice. But could we chat up in discord if you got time the next days? Would be a shame if we talk past each other and you put time and effort into this and it's not what I had in mind =) We are in the same time zone, so that should be possible^^
     
  25. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    I think I can already work with your screenshot unless that's not exactly what you are looking for?
    Also, I'm not even sure if I'll have the time to work on it. I've put it onto my todo list for now and I'll contact you when I've looked into it. I'm mostly working on the tutorials right now, my goal is to publish the 2.0 version on the asset store in the next 2-3 weeks.
     
  26. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    Basically this, but for grass: https://simonschreibt.de/gat/airborn-trees/
     
  27. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    upload_2019-6-5_16-40-27.png

    I think I did it? It uses the unity standard shader, but if your floor has a Standard (specular) shader and you have exactly the same settings on both, the lighting fits perfectly!

    upload_2019-6-5_16-42-51.png
    If you use the right floor color, you can also add some variation!

    I'll upload the beta, but I have to admit that I quite like that new lighting setting.

    There's a new toggle in the lighting settings. You can use it with all lighting mode, but the only one where it really makes sense is the Default PBR.
     
    Last edited: Jun 5, 2019
    keeponshading and Zyblade like this.
  28. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    Looks promising =)
    Is it possible to have this kind of behavior at the bottom(floor texture area) but having still the nice reflections above the floor area? :D
     
  29. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    Honestly, that would be quite difficult, as the shader would have to blend between the two normals. That might lead to strange lighting effects... It would probably not look very good.

    I'll have to think about it, but I won't have time until next week.
     
    Zyblade likes this.
  30. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    Ah, because the normals interpolate between vertices, hmm. I'm curious what we can achieve out of this idea^^
    And thanks for the effort so far!

    edit: tested out beta9. It blends really well! I'm gonna tackle the reflection problem until you got some time to look at it =) Maybe I find out something interesting
     
    Last edited: Jun 9, 2019
  31. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    Hey Nona, I almost finished my custom stuff with the stix shader. Just one last thing bothers me: Could you tell me how I can bring the half2 windDir from GrassGeom.hlsl to the GrassSurface.hlsl? Just through parameters? Because even if I recalculate it, the wind function won't get the correct values there, so I want to put it into the parameters from the function call. Maybe I'm too tired right now, but I can't find the right place to inject it into the GrassSurface.hlsl. I know the GrassFrag calls "surf", so I need to get the wind there somehow. Thanks in advance!
     
  32. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    Why do you need the wind direction in the surface shader? I'm quite interested in the custom stuff you're doing.

    If you want to get a variable from the geometry shader to the surface shader you'll have to do it via the vertex structs. The structs are in the GrassDefinitionsAndFunctions.hlsl file. The you'll have to add it there in the geometry shader. It's a bit annoying, but that's how shaders work. I think you only have to change the GS_OUTPUS and FS_INPUT structs.

    By the way I'll try the double normal thing today and post if I can get something to work. Then I'll probably stop including more features for some time, I'm already stalling the boring marketing stuff! :D
     
    Zyblade likes this.
  33. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    Well, combining both normals into one worked about as well as I expected:
    upload_2019-6-12_9-5-4.png

    I'll try the hybrid approach now, where two normals are used. Not sure if the lighting will support that, though.
     
  34. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    This worked better than expected! The new hybrid mode uses the floor normal for diffuse lighting and the billboards normal for specular calculations.

    upload_2019-6-12_9-45-14.png

    I'll upload the new version now.

    By the way, it won't be possible to fit the floor perfectly like this, that would require two full PBR lighting calculations, one for the floor and one for the grass.. and then merge them together. It's close enough like this, in my opinion, so I'll leave it for now.
     
    Zyblade likes this.
  35. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    Well, I'll answer this if I got home from work =)

    Thanks, I'll try that out.

    Can't wait to try this one out!
     
    Nonakesh likes this.
  36. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    Alright, I got the windDir inside the gs_output struct, but it seems shader semantic is a little more different than expected o_O Give me some time,I'll edit this post once I found the right way to feed the input struct so I can use it in the surface shader^^

    edit: silly me, forget to map the value from gs_output to fs_input correctly ontop of the geom shader. Now I can use this wind together with some uv information and a texture to make some fancy translucency effect, based on how much the wind will bend the grass to the ground :D If I get some good results, I can show you.

    edit2: The new hybrid approach is awesome! And if you tweak a little floor and grass color, you can match it up pretty close, it's just slightly visible in the transitions between light and shadow, but totally okay. Thanks for the implementation :cool:
     
    Last edited: Jun 12, 2019
    Nonakesh likes this.
  37. pagnotmf

    pagnotmf

    Joined:
    May 20, 2016
    Posts:
    23
    I just wanted to post a massive "Thank you" for your shader and your commitment to supporting this product. I hope you don't mind a screenshot of your grass in a community project. Our community creates and plays golf courses for PC players and golf simulator players.

    I just released a tutorial for the community on how to set up our courses with your grass shader. I am hoping you will see a small but significant bump in purchases for your shader over the next few days. Even stuck in Unity 5.2.3f, it looks great!

    Using a 3 texture variant
     
  38. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    That actually looks really great! Thanks for posting!

    And also thanks for making this tutorial. Things like this help me to continue supporting the shader.
     
    pagnotmf likes this.
  39. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100


    This is the pure "surface mode" without the built in reflections. It's using the wind values with a viewvector based translucency, which shines through white on the top + edges on the grass blades. The center translucency color is more green/yellow-ish but more subtle. At the arch model, you can see on the right side, where nDotL comes into play, the light doesn't come through, but at the top/left, it glows more.

    So that's kind of the result I tried to achieve. A little more defined glow including core(greenish) and edge(white) translucency in different strenghts. I also add the possibility to use a texture, but without alpha masking (keep the triangle form of the grass blade). Because I didn't need to cut out the grass. The alpha channel is for the defined white translucency. Btw. do I have to disable a "cutout" mode somewhere to save performance if I use texture mode?

    So after all the hard work is done by you, I can keep modifying it to my needs :D
    I like playing with math and stuff, but shader syntax is still confusing sometimes o_O

    edit: The cube was just to dimm the light slightly. I was too lazy to modify my light settings for this recording xD
     
    Last edited: Jun 14, 2019
    HenryChinaski and Nonakesh like this.
  40. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    Wow, this looks amazing! It sounds like you've done quite a few changes that would be a bit hard to generalize, otherwise, I'd love to include your changes into the shader. Maybe I'll look into it in the future and create a similar lighting mode myself!

    I'm really happy that your experiments turned out so great!

    I don't think you'll have to disable the cutout mode, I believe the performance cost is quite minimal.

    I've personally learned shader programming by looking at other shaders, so I think you're doing it just right! :D
     
    HenryChinaski and Zyblade like this.
  41. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    Thanks alot! I'd say, bring out the stix shader in its current state. Later, we can chat up what features you could possibly add, to extend the shader further.

    I'm glad you like the result! And thanks again, I couldn't do that without having all those lines written already^^
     
    Nonakesh likes this.
  42. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    Can someone here post his/her fps from the stats window after hitting play at the alpine scene? fullHD 1920x1080.
    And if it's about 60fps or even more, what kind of graphics card and cpu you got? Thanks a bunch.
    Because my fps are about 8-10^^ Same for the GameScene, but there I got about 15-25fps.
    Are those scenes benchmarks, which have to run slowly? Or am I occuring a bug?

    My stats: Win10 pro. Nvidia 1050ti, intel core i7-7700HQ 2.80GHZ - Unity 2019.1.2f1
    Not quite fast but it can run the most games I play on fullHD resolution
     
  43. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    453
    Is this gonna be an update to the current dx 11 grass shader or another version and your leaving behind the one on the asset store for this new one? Really want to try out the latest one.
     
  44. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    411
    Hi. Is your Tutorial public?
     
  45. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    I'm not even getting 60 fps with my RTX 2080 TI, so your stats are fine. Those settings were for the trailer, I'll have to set them to something more reasonable for demo/tutorial purposes.

    It will be an update for the current version on the asset store! You won't have to buy a new one. If you haven't bought it yet and you're interested, you might want to check it out now, I'll likely increase the price with the new version.
    You can try the beta here: http://stixgames.com/grassshader/beta

    If you're looking for tutorials for the shader in general, I made some and included them in the documentation: http://stixgames.com/grassshader/documentation/general
     
  46. DTek

    DTek

    Joined:
    May 29, 2013
    Posts:
    14
    Hi there, I have just a few questions before purchasing :
    - does it work with the deferred shading rendering path ? we're using that one for our project and obviously, lights are a big deal.
    - does it work with the ambient light ? meaning, if in some areas the place is entirely dark, and there is no ambient light (or it is black ) , will the grass still show ?
    - does it work with point lights and spotlights ?
    - does it work with volumetric solutions ? ( let's say Aura 2 )
    - does it have any issue with Post Processing Stack v2?
     
  47. Nonakesh

    Nonakesh

    Joined:
    Aug 27, 2011
    Posts:
    449
    - it works with deferred rendering, but some of the advanced lighting options don't work (because the lighting is handled by unity) and only with the randomized orientation grass mode (you can't orient the normals towards the screen, if the screen normal handles all lighting)
    - It works with ambient lighting, but because grass in real life has subsurface scattering, which isn't possible in deferred rendering, the grass looks much darker than expected, unless you counter this effect
    - all light types work perfectly
    - volumetrics should work as well
    - I've used the post processing stack and it doesn't seem to have any problems. There are no motion vectors, but other than that, it should work fine

    As I said before, the problem in deferred rendering is that the advanced lighting options are missing, so you'll have to use fill lights to make the grass appear more realistic, for example when it is being lit directly from above. It's still works great with a bit of additional work, in my opinion.
     
  48. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    100
    Small feature request:
    disable painter when holding "alt" key.
    Small feature, but it helps alot! when I'm panning around and not accidentally paint/remove stuff.
     
  49. cubrman

    cubrman

    Joined:
    Jun 18, 2016
    Posts:
    191
    Just a quick showcase of what is possible with your shader:
    1.JPG
    2.JPG 3.JPG
     
  50. cubrman

    cubrman

    Joined:
    Jun 18, 2016
    Posts:
    191