0 votes

I have big terrain which is actually single collision polygon 2D which works as smart texture (found it on this forum somewhere).
The more accurate edges are the better the texture looks but the less fps I get.

Here is the question: Can I make part of this polygon 2D not render or is there other way to solve this?

in Engine by (329 points)

1 Answer

+2 votes
Best answer

Everytime you have issues due to a huge element in the game world, the solution is almost always about splitting it into chunks. Doing that takes advantage of the engine's culling system, so chunks not in view are not drawn, collision shapes far away are ignored, and the extents of it can nearly be infinite because it can be unloaded when too far away.
Note that if you are using a single texture for the whole thing, you will have a limit on some graphic cards above 4096x4096 (if you want to go that far), so if it's really huge, you can split it as well.

by (27,897 points)
selected by

Thanks for fast answer but I could not find anything about how to split into chunks.

There is no built-in tool to split stuff into chunks. You have to design this in your own way. At the moment, the only 2D node that performs such chunking automatically is the TileMap. If you can't use it, you'll have to find a solution yourself, like making multiple polygons rather than dealing with a giant one.

There is LargeTexture exactly for that. It splits the image into multiple pieces so the engine can cull away invisible pieces. You can create LargeTexture textures under the Import option.

Are you really sure LargeTexture also splits geometry of the polygon into chunks to cull them? Splitting geometry and textures are unrelated matters (what if polygon doesn't have a texture :p)

I'm not entirely sure tbh. :)
I just noticed that the game runs faster when I split many 4096² textures into smaller ones to a LargeTexture.

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 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 webmaster@godotengine.org with your username.