Skip to content

Commit

Permalink
Changed fur rez and removed captions
Browse files Browse the repository at this point in the history
  • Loading branch information
KarthikChandran303 committed Jan 17, 2024
1 parent 92bd2e1 commit 660f707
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Binary file modified assets/media/grass-height.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions content/project/grass-project/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ image:
preview_only: true

---
{{< video src="grassvid.mp4" controls="yes" caption="Ball Moving through Grass Field" numbered="true">}}
{{< video src="grassvid.mp4" controls="yes">}}

Rendering grass is a topic that has always intrigued me. In the past, I've experimented with GPU instancing 3D grass blade meshes, used billboards, and explored Unity's built-in grass system for terrains. So when I came across Youtubers Acerola and Harry's videos on shell texturing and learned that a friend needed a lightweight solution for stylized grass in his game, it only made sense that I try using shell texturing to render some more grass! I was pleasantly surprised with the results. I learned that it is possible to fabricate dense grass fields from simple textures. While there are certainly trade-offs to using this technique, such as overdraw, visual artifacts, and scalability, if used correctly, one can leverage their artistic vision to create optimized grass fairly quickly. Below is a brief breakdown of the steps to achieve shell-textured grass.

{{< video src="grass-breakdown.mp4" controls="yes" caption="Shell Texturing Breakdown" numbered="true">}}
{{< 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 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.

Expand Down

0 comments on commit 660f707

Please sign in to comment.