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.
  2. Dismiss Notice

Stylized Grass Shader [URP] ☘️

Discussion in 'Assets and Asset Store' started by StaggartCreations, Jan 5, 2020.

  1. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    When you render the color map, it should come out the same no matter which time of day the scene is in. Though there have been cases where Enviro interferes with the rendering. In this case, it'd be required to temporarily disable the Enviro parent object before pressing "Render".

    But what you're seeing in your screenshot is the translucency effect, which becomes most prominent under low light angles. Increasing the Exponent or Offset parameters (under the Shading) tab will decrease the effect.
     
    Qilbby likes this.
  2. Qilbby

    Qilbby

    Joined:
    Nov 7, 2017
    Posts:
    5
    Thanks for the directions, they've been helpful to me!
     
  3. marckv

    marckv

    Joined:
    Sep 19, 2013
    Posts:
    61
    Hi there, I have noticed that in my WEBGL build, the scale map is not applying correctly.
    The grass in the build, looks like it has 100% scale on the colourmap renderer, even though the layer is only set to 50%. Any ideas?
    Editor on the left, build on the right.

    upload_2022-7-5_22-42-38.png

    Edit, I can confirm the grass scaler for the colourmap renderer is not working in my WebGL build, but it does work in the editor. In the build the grass is the length is would be if the sliders were set to 100%.
     
    Last edited: Jul 6, 2022
  4. marckv

    marckv

    Joined:
    Sep 19, 2013
    Posts:
    61
    I just converted the project to PC build, and the scale map is working fine in that build. Do you know if there is anything I can do, I am supposed to be shipping these builds today xD Thanks
    I assume its not a shader problem as the perspective correction seems to work fine.
    Could it be something to do with the format of the image saved?
     
    Last edited: Jul 6, 2022
  5. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    That could be it, though the same DXT5 texture compression should be supported on WebGL.

    I've meanwhile set up a testing scene, for the scale functionality, with 16 terrain layers. I'll check if this pans out any differently in WebGL
     
  6. marckv

    marckv

    Joined:
    Sep 19, 2013
    Posts:
    61
    Any luck?
     
  7. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    It took forever to test two different versions, but I'm personally seeing the same outcome in a WebGL build as I do in the editor. It seems like the alpha channel of the colormap texture is omitted on your end for some reason, providing a 100% scale overal o_O
     
  8. marckv

    marckv

    Joined:
    Sep 19, 2013
    Posts:
    61
    damn... ok thanks for trying
     
  9. marckv

    marckv

    Joined:
    Sep 19, 2013
    Posts:
    61
    Is there a work flow to get the grass shader working on custom meshes rather than a terrain? I guess im referring mostly to the renderer colour map which a custom mesh would not be compatible with.
     
  10. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    On the Colormap Renderer component, the "terrains" list also accepts regular Mesh Renderers. Assuming they're mesh terrains that is ;)

    Small note, that's not clear in the current version, when using mesh terrains, the "Using non-standard terrain shader" checkbox must be ticked. These objects aren't even using a terrain shader to begin with, so it's practically always the case :)
     
  11. marckv

    marckv

    Joined:
    Sep 19, 2013
    Posts:
    61
    That's great :D
    By mesh terrain, do you mean "A mesh, that you are using as a Terrain"?
    Or is a "mesh terrain" something I am unfamiliar with?

    Another question... If I am not using a terrain, I assume there is no benefit in using Nature renderer or Vegetation Studio? Would GPU Instancer be a better option in that scenario? Or is the standard gpu instancing good enough?
     
    Last edited: Jul 22, 2022
  12. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    That's correct! Technically, a Mesh Renderer, that just so happens to serve the purpose of a terrain.

    Unity's rendering system is not particularly capable of handling tens of thousands of individual Mesh Renderers, which is common for vegetation, so these custom renderers would still be beneficial, despite the presence of a terrain.
     
  13. marckv

    marckv

    Joined:
    Sep 19, 2013
    Posts:
    61
    Ok thanks.

    On another note, is there a way I can turn down the realtime shadows received by the foliage? Ie so the shadow the grass receives is half as dark?
     
  14. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    Afraid, shadows get applied in the URP lighting function, but there's no control over this outside of it.
     
  15. marckv

    marckv

    Joined:
    Sep 19, 2013
    Posts:
    61
    Quick question. When baking lightmaps with the grass shader, I notice the lightmaps dont take into account the alpha clipping. A plane with a single leaf on it casts a shadow from the whole plane. This is not how the standard lit shader works. Any ideas why?

    upload_2022-7-25_22-14-6.png

    I am using the bakery lightmapper btw.

    Here is what the doc says

    If I change the tag to TreeLeaf, it works, is there anything wrong with doing that?
     
    Last edited: Jul 25, 2022
  16. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    That's fine! The RenderType tag is merely a way to identify the purpose of certain shaders, for other systems (Bakery in this case)
     
  17. marckv

    marckv

    Joined:
    Sep 19, 2013
    Posts:
    61
    Awesome thank you
     
  18. FrankAtt

    FrankAtt

    Joined:
    Jan 29, 2021
    Posts:
    3
    Hi,
    at first I want to thank you for the great asset package. It's really helpful and a lot of fun to improve my scenes with your gras shader. (And also with the water shader ;) )

    I found a little issue (maybe only in my setup) with the created camera (renderCam) in the StylizedGrassRenderer class.

    I use Unity 2021.3.6f1 with URP 12.1.7.

    In my case all cameras (fixed cameras at several points) are disabled in the beginning of a scene, because I check where the player starts. Then I will enable the chosen camera (+ fading animation).
    In this case the renderCam is the only active camera in the beginning of a scene and the game shows a pink screen for a very brief moment.
    This happens in unity editor and release.

    I also can reproduce it in your demo scenes (e.g. BendingDemo).
    Maybe you are also able to reproduce it:

    Step 1:
    Deactivate Camera (or disable Camera Component) and deactivate GrassBendRenderer (or disable Stylized Grass Renderer Component)

    Grass_Pink_1.jpg


    Step 2:
    With this step you can simulate the start of the scene. (OnEnable in StylizedGrassRenderer class will be triggered)

    Activate GrassBendRenderer (or enable Stylized Grass Renderer Component) again.
    For a short moment the game view will be pink.
    It is the color you are using for your neutralVector
    private static Color neutralVector = new Color(0.5f, 0f, 0.5f, 0f);

    Grass_Pink_2.jpg

    After this the scene is rendering correctly.


    Step 3: (maybe soloution)
    I could solve the problem with a simple check in the Update of the StylizedGrassRenderer class:

    Grass_Pink_3.jpg

    I don't know if this could occure other problems (Currently everything seems allright).
    Also maybe only I have this issue. Maybe you could check it out on your platform if you you are able to reproduce it.

    Thanks again =)

    Best regards,
    -Frank
     
    Last edited: Jul 29, 2022
  19. iArkeus

    iArkeus

    Joined:
    Feb 21, 2019
    Posts:
    4
    Hi there, I have a question (or problem?) regarding a couple of the setting interactions with AO.

    For reference, here's an image showing the different states (raw link is https://i.imgur.com/gInaIFC.png in case the forums resize and make it unreadable):


    On top the colors are as I would expect, using the color map with full strength and height. However, when indirect translucency and spherify normals are off, AO causes it to become a huge blurry mess. The middle shows when I ramp up indirect translucency, it solves the blurriness, but it also changes the colors (as expected when using indirect translucency). The bottom shows that spherify normals also mostly? solves the blurryness, but again, causes unwanted side effects.

    My question is... I would like to retain the colors and lighting without any indirect translucency or the changes that come with spherifying the normals -- is there a way to do that while also getting the sharpness in the middle picture with AO enabled. Without AO enabled, the top picture looks absolutely perfect without any blurriness (but for now I'm living with less desirable grass due to the benefits of AO in all other places). None of the other settings in the shader (either in the shading section, or elsewhere) affect the blurriness.

    For reference, I'm using 2022.1.11f1 and the latest version of Stylized Grass Shader. Screenshots taken in the editor (so no AA from post processing applied), and I'm using forward rendering. URP is 13.1.8 and I'm using the SSAO provided by URP, with the following settings:



    Playing around with AO settings makes things look... different, but not better. I did just upgrade from 2021.3 LTS and a version or two old of the shader but as far as I could tell, it had the same issue (I didn't play around with it as extensively as I am now).
     
  20. marckv

    marckv

    Joined:
    Sep 19, 2013
    Posts:
    61
    You could disable the SSAO on the grass shader.

    "You can however remove SSAO support from the grass shader itself. In the StylizedGrassShader.shader file you can comment out this line, which will do just that.


    After which the SSAO effect will no longer draw on grass geometry. However, grass will "cast" ambient occlusion on the terrain, that in itself is unavoidable."
     
  21. marckv

    marckv

    Joined:
    Sep 19, 2013
    Posts:
    61
    Is there something I can add so I can apply the ambient occlusion after the colour map? Basically in this project I would like to keep the fake ambient occlusion but also sample the terrain colour.
     
    Last edited: Aug 2, 2022
  22. ACSimps

    ACSimps

    Joined:
    Feb 12, 2021
    Posts:
    2
    Hey Staggart! I love the shader, its done amazing things for our project. Specifically the terrain color-matching. Generally, it works very well, but I have noticed that sometimes there are discrepancies between the terrain color and the grass color- specifically when the terrain is in shadow. I'm using cards that are modified versions of the cards that come with your shader, and I've tried to tweak and account for almost every variable that might be affecting it, but I'm kind of stumped. Here's an example of what I'm talking about:



    EDIT: After continuing to tinker with this stuff, I'm confident that it has to do with the global illumination settings. I'm using Vegetation Studio Pro to spawn the grass, and that also seems to be related, since when I spawn your grass using VSP versus as a prefab, it looks different. Prefab grass seems to be much more accurate to the terrain color, whereas VSP grass seems to be color shifted for some reason. I have made sure many times that the base color and variation color on the stylized grass section of the VSP spawner are set to 0/0/0/0 (same as the prefab), and I can find no other relevant settings that might affect how/why some grass is receiving a darker shadow than other grass. Attached is a screen cap of prefab grass vs Vegetation Studio Pro spawned grass. You can see the dark green strand of grass in the middle of the below screenshot. That's the same grass card but as a prefab spawned in scene.


    I know you've worked quite a bit with VSP. Anything you could do to help us would be huge, since were getting a bit tired of banging out heads against this.

    EDIT EDIT: Turns out that the problems were twofold, and almost entirely with VSP. I had to axe a reflection probe that was lying around from before I used VSP, and I had to mark the terrain as non-static for GI purposes. Those two things make all the grass blend beautifully.
     
    Last edited: Aug 5, 2022
  23. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    Version 1.3.0 will be available soon later today!

    This has been in the works for quite some time and is considered a major update. As such, there are some expected breaking changes.


    An update guide has been prepared here: https://staggart.xyz/sgs-130-upgrade-guide/

    Before importing version 1.3.0 from the Package Manager, first delete the following folders:
    • Stylized Grass Shader/Scripts
    • Stylized Grass Shader/Shaders/Resources
    Failing to do so will cause new scripts to be imported in the wrong folder, and creates a duplicate assembly definitions. You’d see the following errors:


    If you forgot this step, you can still delete these folders. Just be sure to reimport the asset from the Package Manager afterwards.

    Should you still see the 3rd error: right-click on the Stylized Grass Shader/Shaders folder and choose “re-import”.

    Change log:
    Minimum supported version is now Unity 2020.3 and URP 10.3.2

    - Reworked the grass bending functionality for greatly improved performance.
    - Restructured folders to follow the UPM standard. Scripts now in a separate Runtime/Editor folder.

    Added:
    - Prefabs specific to use with the terrain system (without LODs)
    - Normal maps for all grass textures
    - Masking Sphere component. Fades out the grass towards a single point, with a given radius.
    - GI support for DOTS Instancing (Hybrid Renderer)
    - Options for near/fade camera fading

    Changed:
    - Recreated most grass textures for improved shape and density.
    - Scale map is no longer experimental
    * Transitions between different terrain layers are now seamless
    * Grass scale defaults to 100% for any layers not configured​
    - Translucency shading is now greatly improved for orthographic cameras.
    - Color Map Renderer now respects individual materials assigned to terrain tiles.
    - Reworked material UI to support multi-selection and Material Variants. This causes the following parameters to be reset:
    * Normal parameters
    * Distance fading parameters
    * Environment reflections toggle​

    Fixed:
    - Alpha clipping value no longer influences the angle fading functionality.
    - Color map rendering as completely red if the terrain had 0 height.
    - Grass appearing shorter if the "Apply scale map" option was enabled, yet no scale map was present
    - Sparkles appearing when the grass geometry occupies <1px on the screen and MSAA is enabled.
    - Certain terrain layers not being configurable in the layer-based grass scale options
     
  24. marckv

    marckv

    Joined:
    Sep 19, 2013
    Posts:
    61
    Hiya, on the new update if you have non-standard terrain shader ticked in the colour map renderer, rendering replaces the terrain shader on the terrain with a hidden/terrainsplatmask

    upload_2022-8-9_16-33-17.png
     
  25. marckv

    marckv

    Joined:
    Sep 19, 2013
    Posts:
    61
    is it possible to get a backup package for the old version please? I like the new version, but as it is so different, I need a backup in case I need to reimport.
     
  26. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    Thanks for the headsup! That is indeed unintended, and obvious miss it seems! I've identified where/why this happens and will submit an update shortly!

    I'll DM you a link for the v1.2.2 package :)
     
  27. deshowiz

    deshowiz

    Joined:
    Mar 28, 2015
    Posts:
    21
    Hey Staggart! I'm looking through the new contents and I'm trying to find the support for dynamic wind speeds mentioned. Did you manage to change the gust maps so that they aren't tied to time like they were before? At the moment when direction changes on my end I still get the sliding issue with the gusts. The shader supported dynamic wind speeds before, but generally I'm interested in how that ties into dynamic direction as well, since dynamic wind would have to involve both.
     
  28. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    Practically speaking, there's no change in workflow. Assigning a Wind Zone component to the Stylized Grass Renderer component will alter the wind strength/speed of all grass materials. Previously, this was only the wind strength.

    While dynamically changing the wind direction works for ambient wind, it still doesn't for wind gusts. I've concluded that simply can't be made to work unfortunately.

    The documentation page was updated to reflect the current functionality, if you hadn't seen this already.
     
  29. deshowiz

    deshowiz

    Joined:
    Mar 28, 2015
    Posts:
    21

    So the way I see to solve it is since I'm calculating wind direction and magnitude changes outside of the grass shader, I can just use that math to create an offset and then update that offset in the shader through a script using shader.SetVector. I'm struggling with implementation though since my shader knowledge is pretty shallow, and I'm used to using shadergraph or amplify shader editor. Do you think you can give me some pointers on how to implement this change?

    From what I can gather, if I can manage to swap the positionWS in the wind hlsl then I should be able to change the offset so that it's controlled outside of the shader and injected that way. I know it would be nice to be able to store the offset in the shader and just use delta time but I can't find a way to do that, which is why I figure you mentioned it not being possible.

    A general description of steps for this would be very helpful, if you can manage. Thanks :)
     
  30. marckv

    marckv

    Joined:
    Sep 19, 2013
    Posts:
    61
    Hi our cloud builds are failing with this error
    ERROR: DXT5|BC3 compressed textures are not supported when publishing to iPhone.
    How do I change the format of the colormap texture please? I've turned off scaling for now to get it building.
     
    Last edited: Aug 12, 2022
  31. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    You could have a look at the UpdateWind() function in the StylizedGrassRenderer file. This is where the delta time is calculated, and the wind direction is passed onto shaderland. It sounds like what you're describing is already being handled there. Though you can copy/paste the logic and incorporate it into your own script if that's easier.

    You could try to change this from DXT5 to RGBA32 in the ColorMapEditor.cs file on line 405.
    upload_2022-8-12_12-38-35.png

    That's a format that is supported on iOS, the file size is just larger. For this to take effect, you'd have to re-render the color map so the change code runs.
     
    deshowiz likes this.
  32. mr_president

    mr_president

    Joined:
    Jun 28, 2015
    Posts:
    22
    Hey great asset, just wanted to mention some missing info in the documentation for the grass bending:

    If you're using a multi-camera setup, with different renderers for each camera, the camera with the grass layer must use the renderer that is set to default in the URP asset. Simply adding the Grass Bending Feature to a non-default renderer for use with that camera will not work.

    As a side note, the underwater renderer will also display an error if you're using a non-default renderer to display it, even though everything works just fine.
     
  33. marckv

    marckv

    Joined:
    Sep 19, 2013
    Posts:
    61
    Hi there, I have noticed that shadow casting/receiving for grass, changes when enabling the planar reflection renderer for the water shader. It is also affected by the Offset figure. Is there a way to solve this?
    It seems the shadows nears normality with the offset figure around 6, but I haven't tested that enough to work out why. I have attached a zip with a video in it describing the issue.
    I thought maybe it was due to the shadow size, but I am using a small shadow res, and increasing it vastly still doesnt get close
     

    Attached Files:

    Last edited: Aug 16, 2022
  34. marckv

    marckv

    Joined:
    Sep 19, 2013
    Posts:
    61
    Ok to further this problem, this only occurs on materials using perspective correction or billboarding.

    To summarise, the shadows on grass change to very low quality/bugged shadows when enabling the planar reflection renderer from the water shader, and are affected by the offset figure in the planar refection script.

    With billboarded grass, the effect is noticeable with perspective correction on or off.
    With non billboarded grass the effect doesn't happen when perspective correction is off.

    I guess the vertex adjustment of billboarding/perspective correction is affecting the shadow position when planar reflection is on. Is there a way to fix it? im still on 1.22 btw.
    The shadows are fine when the planar reflection is turned off.
     
    Last edited: Aug 22, 2022
  35. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    Apologies for the late reply, thread notifications seemed to have expired for me.

    I've encountered issues with shadow casting before, particularly when using Perspective Correction. But this only occurred when placing grass using the terrain system. This is a bug that's supposedly been fixed in Unity 2020.1+.

    Does this align with your use case (Unity 2019)?
     
  36. Lee1384

    Lee1384

    Joined:
    Jun 8, 2014
    Posts:
    11
    Hello,

    I want to use a particle bender to make an effect of cutting or burning grass. If I use a particle bender to lower the grass down to the ground and then create particles that the grass is fluttering, I think it will look plausible.

    So, I would like to know if there is a way to find if the particle bender is in contact with the grass via a script.
     
  37. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    All the grass displacement and bending happens on a GPU-level, which means the information can't be read through scripting (traditionally peaking, not in real time).

    An easier approximation would be to check for collision with the ground instead (+ a 20cm margin, however long the grass is). Considering that the grass geometry is on the ground, anything that hovers ~20cm above it, is touching grass. That logic could be a way to check for collisions with grass using conventional means.
     
  38. YoungDeveloper

    YoungDeveloper

    Joined:
    Jun 28, 2013
    Posts:
    63
    Hi, will this work on Android, iOS - if so how good the performance could be ? Can it he placed on non terrain ?
     
  39. ScorpioGamer

    ScorpioGamer

    Joined:
    Oct 14, 2012
    Posts:
    9
    We have a light-mapped scene with Shrubs and Grass
    They look like the below image in the editor.

    Screenshot 2022-10-13 183154.jpeg

    But looks like the following when we make a build.

    Screenshot 2022-10-13 180435.jpeg

    Any idea why this could be happening? Kinda lost here.
     
  40. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    Please see this page for full compatibility details. A piece of grass is essentially a mesh prefab, so it can basically be placed on anything like any other object can be :)

    Could you tell me which Unity version you're using? Lightmaps should work fine, I can verify this in testing scenes I have set up. But I can try to check them in a build in whichever version you're using. Always possible a new version broke something.
     
  41. gr3chu

    gr3chu

    Joined:
    May 15, 2019
    Posts:
    5
    Hi,

    I'm using Unity 2022.1.14f1

    After upgrading to latest version of your package. I followed the docs, and did all steps required prior to update (here)

    Sadly, I'm experiencing an issue with grass bender which is only visible at runtime:

    upload_2022-10-15_9-14-48.png

    Any suggestions and pointers on what can be wrong?

    Thanks
     
  42. GilJoWal

    GilJoWal

    Joined:
    Mar 28, 2020
    Posts:
    26
    Hi, firstly thank you very much for the shader, really helpful

    I have an issue with Vegetation Studio (Standard). I can't control the wind. I try changing all wind related effects to zero and the grass is still going crazy. I tried deleting the wind zone, having the wind zone to zero, zeroing the wind in the terrain settings, and zeroing all wind related value in vegetation studio.

    Any clue what could cause the issue? Thank you very much in advance.
     
  43. ScorpioGamer

    ScorpioGamer

    Joined:
    Oct 14, 2012
    Posts:
    9
    We are using Unity version 2021.3.5f1
     
  44. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    The pink spheres indicate that they're rendering using a shader that's stuck on some kind of error. It's not uncommon as of Unity 2021 for the shader compiler to throw false positive errors, which has to do with the order in which things are imported.

    If you select the Stylized Grass Shader/Shaders/Bending/GrassBendMesh.shader file, you could check the inspector if any errors are shown:
    upload_2022-10-17_13-33-14.png

    If that is indeed the case, you can right-click on the file and choose "Reimport". If that still doesn't resolve it, please let me know!

    Happy to hear it's proving useful! :)

    In order for a Wind Zone component to have any effect on the grass, it needs to be hooked up to the Stylized Grass Renderer component. This will translate it's value to the grass shader.

    More details about this are outlined on this page: https://staggart.xyz/unity/stylized-grass-shader/sgs-docs/?section=controlling-wind

    Great, thanks! I'm currently making a build, but it's taking its sweet time to finish. I'll be able to check later today or tomorrow if I can reproduce any issues ;)
     
  45. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    After some extensive testing, things come out the same for me in a build as they do in the editor. If you could provide a repo project I'd be happy to take a look at it.
     
  46. gr3chu

    gr3chu

    Joined:
    May 15, 2019
    Posts:
    5
    Hi,

    Thanks for your answer and recommendation. Sadly there are no errors visible in the editor.
    As mentioned, I'm experiencing this issue only at runtime. After I create a build of my game. While playing the game in the editor everything works fine. Also there is nothing useful in player logs :(

    So I basically have no idea how to tackle this one...

    Any help will be greatly appreciated!
     
  47. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    I believe I know what the issue is, especially if you say it only occurs in a build. The shader being used on those spheres ends up not being included in the build, hence renders the materials as pink.

    This is definitely a contingency that only affects Grass Bender components set up using version <1.3.0 of the asset, and something I missed to take into account in the upgrade guide.

    Long story short, you can remedy this by resetting a Grass Bender component:
    upload_2022-10-20_12-0-9.png

    By doing so, the shader will be referenced on the component, and will then be picked up by the build process. Realistically, you only need to do this for one Grass Bender component. Just have to make sure you pick one that's definitely being used ;)
     
  48. gr3chu

    gr3chu

    Joined:
    May 15, 2019
    Posts:
    5
    Hi again,

    Thanks for getting back to me, really appreciated! :)

    So I did this trick but it didn't work. It was easy to check as I'm using your prefab directly in the hierarchy of my character prefabs :)

    That being said I've noticed sphere being rendered pink in editor as well thanks to that!

    Please see following screenshots:

    1 - selecting prefab in project view shows in the preview in pink. Worth noticing that Material field is set to None.
    sphare bender issue - selecting prefab in project view.png

    2 - entering the prefab mode immediately resolves the issue. Material is now set but with postfix (Instance). Which suggests that this is dynamic in memory material?
    sphare bender issue - entering the prefab mode.png

    Is this is expected behavior or is this giving you some ideas?

    Please let me know :)
    Thanks
     
  49. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,102
    That's correct on both accounts! The material is created and assigned by the Grass Bender component, and doesn't stick around.

    If you were to drag the BendSphere prefab into the scene, it should render as invisible, rather than a pink sphere. Is that the case?
    upload_2022-10-24_12-24-31.png
     
  50. gr3chu

    gr3chu

    Joined:
    May 15, 2019
    Posts:
    5
    Hi,

    Yes, after dragging the bend sphere onto the scene it works fine, that being said in the runtime after I make a build, my original issue persist:
    upload_2022-10-25_6-5-6.png

    I'm using addressables so maybe this the reason? Sphere is visible on the scene after the build though, but its pink.
    Also I made sure that both shaders (StylizedGrassShader, GrassBendMesh) are marked as addressable so they are definitely a part of the build, and grass works and behaves fine.

    Any suggestions on how to resolve this are greatly appreciated.

    Thanks!