0
\$\begingroup\$

What I am trying to achieve :

I’m trying to recreate the grass shader of Breath of the wild & Tears of the Kingdom. There is a glow on the edge of the individual grass blades present when the sun/moon and the camera are facing each other. I want the grass to have a glow in the edge similar to a SSS effect in breath of the wild.

This is my video reference. As you can see, the grass which is in the same line as the sun has a glow on it and the rest of them just appear to be the base texture of the grass.

Below picture is a picture reference of the effect I am trying to achieve. The sun is somewhere on the top left causing the grass to have that glow only in that direction, and the rest of them on the right are darker. enter image description here

I have tried multiple implementations to achieve the effect and am very lost. Can someone tell me what EXACTLY breath of the wild or tears of the kingdom is doing to get the effect and how I can implement it in Unity URP?

What I have tried so far :

There were issues with backface colouring due to it being a flat mesh, tried to flip normals in shadergraph but that did not entirely fix the issue. One side was still darker than the other. I tried using ambient light to compensate for the darker side but there was a limit on how bright I can make the ambient light, so that did not entirely fix the issue (Ambient light was set to Color mode,not skybox or gradient).The direction light also seemed to be effecting the colours even though the colour of light was set to white and intensity 1. This forum thread was my reference for this issue.

The effect looked like sub surface scattering so I tried to imitate that effect using light angles and camera angles using shader graph but it was effecting all the grass blades instead of just the grass blades in the same direction of the sun. I tried to use the sub surface glow effect to compensate the darker side in the above bullet point, but the issue was that the logic enabled the sub surface effect only when the camera and the light where in completely opposite directions, there was no transition for the effect, it just toggled even with the linear interpolation node present so the darker sides would be visible for some duration until the threshold is crossed.

This is what my implementation looks like. Right now all the instances change colours instantly instead of being based on the light like what breath of the wild does

Felt like the effect was relying on reflections some how so tried to use custom smoothness maps to define shiny parts but the intended effect was not achieved. The reflectiveness seemed to work per object, but it did not work the way breath of the wilds grass. This is what it looked like.

I tried to use transparency to give an effect of sub surface scattering. I changed the shader from Opaque to transparent and give the shader a metallic map.I used a gradient texture as well as a separate alpha map which both gave the same effect. It caused all the grass to be shiny at the edges after a certain distance, depending on the angle of the light source.

Only a few grass blades were glowing, not all of them, as seen in the below picture.

Implementation and Technical details

This is my shader graph. enter image description here There are 4 groups you can see in the above shader graph.

The SSS group i used as a mask for defining the glowing parts of the grass blade as well as the metallic mask. I experimented with a simpler metallic mask as well which yielded roughly same results. This image is the simpler metallic map.

The flip normals group i used to flip normals of grass blade mesh.

The light angle threshold group i used to calculate at what angle of the light the grass should glow. This was tunable with a float variable.

The camera angle threshold group i used to calculate at what angle between the camera and the light source the grass should glow. This was also tunable with a float variable.

This shader graph was a much simpler shadergraph to achieve the effect mentioned in the last bullet point in the “What I have tried so far” section. enter image description here The light angle threshold defines the angle at which the edge starts glowing. If the camera and the light source are roughly facing the same direction and camera is looking at the grass, then there will be no glow effect. The glow is present only when the light and the camera are roughly facing each other.

Only if both the thresholds cross the SSS mask texture is multiplied with the base texture to give the effect of glowing and SSS.

\$\endgroup\$
1
  • \$\begingroup\$ Possibly related question on BotW grass shading. I thought we had another related question, but I haven't been able to locate it. \$\endgroup\$
    – Pikalek
    Dec 22, 2023 at 15:54

0

You must log in to answer this question.

Browse other questions tagged .