Skip to content

Commit

Permalink
test alt
Browse files Browse the repository at this point in the history
  • Loading branch information
KarthikChandran303 committed Jan 19, 2024
1 parent 09f5bc6 commit fb77436
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions content/project/grass-project/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Rendering grass is a topic that has always intrigued me. In the past, I've exper
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" data-zoomable=true >}}
[![Alternative Text](grass-height.png)](grass-height.png)

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

Expand Down

0 comments on commit fb77436

Please sign in to comment.