IcterusGames / SimpleGrassTextured

Plugin to make grass on Godot 4
MIT License
170 stars 16 forks source link

Shader Disappears at Certain Angles #4

Closed FeralBytes closed 8 months ago

FeralBytes commented 9 months ago

Hi I was wondering if you might have a solution for this issue that we are running into. I will attach a video to help demonstrate.

The issue happens when grass is used upside down like in a cave. The grass disappears at certain camera angles.

I realize that we are not exactly using the shader as intended. But it is an amazing shader started to use it more and more. If there is anything that we can try to fix it, I would like to know? Thank you for your amazing shader.

https://github.com/IcterusGames/SimpleGrassTextured/assets/7874274/c3f72abc-5333-474f-bf98-a293a1148327

IcterusGames commented 9 months ago

This could be happening because the AABB of the geometry is not being calculated correctly (perhaps you have changed the Y Scale property), you could try to adjust this on the inspector -> Geometry -> Custom AABB, changing the w, h, d values (for example try w = 100, h = -100, d = 100, or whith positive h = 100) Note: the AABB are used by Godot to calculate "occlusion culling" so very large values could cause Godot to always render that grass even when it is not visible on the screen In the next version I will add an option to calculate the aabb automatically to handle these cases.

FeralBytes commented 9 months ago

Thank you for your advice. Trying the custom AABB did not work consistently for us, and in fact produce odd blinking even with slight camera movement. However we used the extra cull margin along the same line of thinking and we were able to prevent the items from disappearing from the camera. Again thank you very much. Since our issue is solved would you like this bug closed or do you want to leave it open for your future work?