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

Need a way to set a custom AABB per visual instance #9544

Closed
Zylann opened this issue Jul 8, 2017 · 8 comments
Closed

Need a way to set a custom AABB per visual instance #9544

Zylann opened this issue Jul 8, 2017 · 8 comments

Comments

@Zylann
Copy link
Contributor

Zylann commented Jul 8, 2017

In latest Godot 3.0 I didn't find any function to set a custom AABB on MeshInstances and various other objects, except particles. It's useful to have this so that visuals transformed using shaders won't get culled wrongly.

I currently need it in my HeightMap module because all chunks of the map re-use the same mesh for memory efficiency, and the Y component of the vertices is offset in the vertex shader from a height map texture. But because the AABB of the mesh is still a flat zero Y, holes suddenly appear in the map because they get culled.

@kubecz3k
Copy link
Contributor

What about VisiblityEnabler and VisiblityNotifier?

@Zylann
Copy link
Contributor Author

Zylann commented Aug 10, 2017

I believe they are based on those AABBs too, the root of the issue lies in the culling system itself, in VisualServer. I'm also not even using nodes in my module.

@kubecz3k
Copy link
Contributor

Ok in 2.x there indeed was Mesh.set_custom_aabb( AABB aabb) method. In 3.0 I cant find anything like that in gdscript.
On the c++ site there is surface_set_custom_aabb(int p_surface, const Rect3 &p_aabb); //only recognized by driver (https://github.com/godotengine/godot/blob/master/scene/resources/mesh.h#L190)
But surface api is not exposed. Not sure if it should be or what is the workflow for that in 3.0.
@reduz would be great if you would give us a hint, maybe someone will be able to contribute.

@Zylann
Copy link
Contributor Author

Zylann commented Aug 10, 2017

Actually, as I explained in the issue, I need a custom AABB on the instances, not the mesh itself.

@kubecz3k
Copy link
Contributor

@Zylann but MeshInstances are nodes that are providing interface for the mesh resource which they are holding..?

@Zylann
Copy link
Contributor Author

Zylann commented Aug 10, 2017

Read my issue again :)
I need custom AABBs per instance because they all re-use the same mesh, which is displaced in a shader in different ways depending on world position. So I just can't use an AABB that comes from the mesh.

@kubecz3k
Copy link
Contributor

@Zylann Oh, yeah, right! 👍

@Zylann
Copy link
Contributor Author

Zylann commented Oct 11, 2017

What is the status on this?

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

No branches or pull requests

3 participants