How to deal with big polygon 2D?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Sprowk
:warning: Old Version Published before Godot 3 was released.

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?

:bust_in_silhouette: Reply From: Zylann

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.

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

Sprowk | 2017-03-03 14:26

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.

Zylann | 2017-03-03 21:38

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.

timoschwarzer | 2017-03-06 14:56

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)

Zylann | 2017-03-06 20:10

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

timoschwarzer | 2017-03-06 21:25