pmndrs / examples

🍱 A monorepo holding pmndrs demos
https://pmndrs.github.io/examples/
MIT License
19 stars 6 forks source link

Grass shader bug #81

Closed hichemfantar closed 2 months ago

hichemfantar commented 2 months ago

https://github.com/pmndrs/examples/tree/main/demos/grass-shader

there's a bug with the grass shader example where the grass isn't rendered on certain camera angles

https://github.com/user-attachments/assets/d51b47b7-de6c-45e8-b674-645ba11053db

fixed by #82

abernier commented 2 months ago

I cannot reproduce on my setup (macos 15 m1 / Chrome latest)

hichemfantar commented 2 months ago

I cannot reproduce on my setup (macos 15 m1 / Chrome latest)

i can reproduce, both on windows 10 and macos sonoma, and mobile android and ios. try different angles and camera positions

abernier commented 2 months ago

even on different camera angles/positions

abernier commented 2 months ago

can you create a PR to fix it?

hichemfantar commented 2 months ago

setting frustumCulled={false} fixes it but im not sure it's a real fix

isaac-mason commented 2 months ago

You can reproduce it by positioning the camera not to look at the center of the grass.

The grass geometry needs a bounding sphere manually set as the grass blades are positioned in the shader using the "offset" attribute.

image
hichemfantar commented 2 months ago

thanks for the fix @isaac-mason

isaac-mason commented 2 months ago

No worries! :)