Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grass isn't rendered in certain camera positions and angles #374

Closed
hichemfantar opened this issue Aug 24, 2024 · 4 comments
Closed

Grass isn't rendered in certain camera positions and angles #374

hichemfantar opened this issue Aug 24, 2024 · 4 comments

Comments

@hichemfantar
Copy link

I've been able to reproduce the same bug present in pmndrs grass shader example.
https://sketches.isaacmason.com/sketch/nature/grass

2024-08-22.16-25-07.mp4

related to pmndrs/examples#81

@isaac-mason
Copy link
Owner

The grass geometry likely just needs a bounding sphere set :)

@isaac-mason
Copy link
Owner

isaac-mason commented Aug 25, 2024

see GrassGeometry :https://github.com/isaac-mason/sketches/blob/main/sketches/nature/grass/src/grass.ts#L253

@hichemfantar
Copy link
Author

hichemfantar commented Aug 25, 2024

@isaac-mason i think it's fixed!
do you know how i could apply a similar fix to the pmndrs grass example?
I quote from the discord server ThreeJS uses an objects BoundingSphere for frustum culling. Your grass mesh's bounds are calculated before you scatter your grass. So the engine doesnt know the bounds of the mesh after scattering. You need to recalculate the those bounds after scattering
The proposed solution was to call theInstanceMesh.computeBoundingSphere() in a useEffect but it's not fixing the issue for me.

@isaac-mason
Copy link
Owner

I've raised a PR in pmndrs/examples :)

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

No branches or pull requests

2 participants