Skip to content

Commit

Permalink
Quick Edit
Browse files Browse the repository at this point in the history
  • Loading branch information
KarthikChandran303 committed Jan 17, 2024
1 parent 8631cfd commit fd457fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions content/project/grass-project/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ Rendering grass is a topic that has always intrigued me. In the past, I've exper

{{< video src="grass-breakdown.mp4" controls="yes" >}}

First, a compute shader procedurally generates shells along the normal of the base mesh. Each generated vertex contains normal, UV coordinates, position, and height data. (the height data is normalized that the highest shell has a height of 1 and the lowest shell has a height of 0) This data is then passed to the vertex and fragment shader where we offset the masking textures, discard pixels, and generate color data. A pixel is discarded if the height of its shell exceeds the value sampled in the masking texture. This creates a tapering effect (since higher shells will have more pixels discarded), effectively simulating a grass blade. For my mask, I used a texture generated in Substance Designer.
First, a compute shader procedurally generates shells along the normal of the base mesh. Each generated vertex contains normal, UV coordinates, position, and height data. (the height data is normalized so that the highest shell has a height of 1 and the lowest shell has a height of 0) This data is then passed to the vertex and fragment shader where we offset the masking textures, discard pixels, and generate color data. A pixel is discarded if the height of its shell exceeds the value sampled in the masking texture. This creates a tapering effect (since higher shells will have more pixels discarded), effectively simulating a grass blade. For my mask, I used a texture generated in Substance Designer.

{{< figure src="grass-height.png" caption="Grass Masking Texture" numbered="true" >}}

The fragment shader is also responsible for displacing the grass wherever the ball moves.
The fragment shader is also responsible for displacing the grass wherever the ball moves.

{{< video src="uv-grass.mp4" controls="yes" >}}

Expand Down

0 comments on commit fd457fe

Please sign in to comment.