The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

Hey,
I want to make a project where I distort meshes using a vertex shader. This works fine, except when the mesh would not be in the camera when the shader is not applied. Then the Camera seems to auto-unload that mesh and not render it, until the camera is moved so that the mesh would be visible without the shader.
So is there a possibility to manually choose which mesh to render and which to unload?

in Engine by (12 points)

Hi! Have you tried vortext shader module because what you try to do is not simple with 4 lines of code as I have looked up it earlier

What is a vortext shader module? I can't find anything about that.

That is an interesting demo, but sadly I don't know how this helps with my problem.

2 Answers

0 votes

Hello!

Godot have an invisible box around meshes, called the AABB (axis aligned bounding box). When this box is not visible (out of camera), the mesh is not displayed. This is an optimization trick to not draw objects that are not visible.

You are using a shader to move the vertexes of your object, however the AABB is static and will not adjust to the new vertex positions, this is the problem.

Unfortunately I don't know how to fix this, since I don't think there is a way to set a custom AABB, you can only get it. https://docs.godotengine.org/en/3.1/classes/class_visualinstance.html#class-visualinstance

by (255 points)
0 votes

Ok, I found the solution :) If you click on your MeshInstance, you can set a customer Aabb:

"Overrides the AABB with one defined by user for use with frustum culling. Especially useful to avoid unexpected culling when using a shader to offset vertices."

by (255 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.