Volumetric grass shader

  1. For lighting we can sample neighbours of the pixel in the noise texture to determine the slope for each fragment, and from there the normals. This might be too noisy though. A better solution might be to combine this with the underlying normal of the geometry to create a slight variation to smooth shading.
  2. Discarding fragments causes aliasing, since MSAA is not applied on them. This is a huge pain, there are different solutions, none is perfect. If we are on deferred and are using TXAA we can use a random value between 0 → 1 to check against the noise texture instead of a fixed alpha cut. This creates a random noise which gets picked up by TXAA and improves the look. Alternatively alpha blending could be an option depending on the use.
  3. I took a flow map and noise from DeepspaceBanana to create the wind effect. We can use similar techniques, plus GPU collision detection to make the grass interactive to the player.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store