Skip to content

Conversation

CuddlyBunion341
Copy link
Owner

@CuddlyBunion341 CuddlyBunion341 commented Mar 7, 2025

Grass

The landscape was feeling very baren and the next logical step from trees is grass. The grass proposed in this PR consists of a cross mesh with two intersecting grass sprites.
(100% without the use of AI 🎉)

  1. Create meshes for all blocks that should be represented by a cross instead of a cube
  2. Find all positions of blocks in chunk that have cross representation
  3. Add cross mesh instance at block position to the scene

Note

The initial idea with the mesh instancing was too slow and was thus replaced with a more performant approach, having two meshes per chunk, one transparent, the other popaque. All the cross meshes get combined into a single mesh. (b2dc458). Grouping the meshes did not in fact break transparency, which made the optimization possible.

Known Problems

  • Performance is worse, as meshes are not grouped, this would break transparency (See note above)
  • Self shadows make the grass too dark from certain angles (no idea how to fix that)

Screenshot From 2025-03-08 18-25-25

Notes

image

Todo

Server

  • Add randomly spawning tallgrass on grassblocks
  • Add params for configuring frequency
  • Add slider for grass frequency

Client

  • Add tallgrass texture to atlas
  • Update texture atlas record
  • Update client side representation of blocks
  • Update mesher to accept grass (use instancing?)
  • Update colliders to ignore grass
  • Update culler to ignore grass
  • Update raycaster hit location vector when hitting grass -> lets make grass non selectable
  • Check that transparency doesn't look like dog water
  • Mesh cleanup

@CuddlyBunion341 CuddlyBunion341 self-assigned this Mar 7, 2025
@CuddlyBunion341 CuddlyBunion341 changed the title Feature/grass Add Grass Mar 8, 2025
@CuddlyBunion341 CuddlyBunion341 marked this pull request as ready for review March 8, 2025 18:17
Copy link
Owner Author

@CuddlyBunion341 CuddlyBunion341 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost ready

Copy link
Owner Author

@CuddlyBunion341 CuddlyBunion341 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@CuddlyBunion341 CuddlyBunion341 enabled auto-merge (squash) March 9, 2025 10:26
@CuddlyBunion341 CuddlyBunion341 disabled auto-merge March 9, 2025 10:26
@CuddlyBunion341 CuddlyBunion341 enabled auto-merge (squash) March 9, 2025 10:28
@CuddlyBunion341 CuddlyBunion341 merged commit 2836679 into main Mar 9, 2025
3 checks passed
@CuddlyBunion341 CuddlyBunion341 deleted the feature/grass branch March 9, 2025 10:28
@SemiShogun
Copy link

so... you can finally touch grass now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants