Currently, all the textures for my project are all PNGs and mostly SVGs. Are SVGs a limitation of the game engine. I cloned my project from my repo and editing and running the game is very laggy and objects are invisible.
Reimporting the SVGs fix the issue but this is only a temporary fix. The game is still very laggy and most of the other textures are still missing despite the files existing.
How do you generate the SVGs? In what software?
SVGs are text files as a markup language (little bit like a script).
Godot is using the ThorVG API. Not every function of SVGs are supported in ThorVG SVG, it’s developing fast, but not 100% support for all geometries and logic there, yet. That’s why some parts of your image could be missing.
What are the image sizes of your grass and corals?
Here is an overview what is supported:
At some point Godot has to render your SVGs to textures. At start or when you load the SVGs into your scene. Ensure that you render the SVG textures to fitting sizes. When all SVGs are converted to textures by Godot there is no difference to an PNG.
I assume you have too many textures with too large resolutions.
As one texture?!? That is your problem. As one texture that is toooooo large.
Try to chose texture sizes for your other textures with a power of two, like 256, 512, 1024 … It’s a minimal optimazation, but no relation to your huge map texture.
You have to split it up into chunks, as one texture its too massive.
With SVGs you could have the option to render your map in lower resolution when zoomed out, if it is one SVG. You need a solution for different zoom levels with such a huge map.
I think they meant the advantages of using SVGs in Godot. Because what you’re describing here doesn’t really work in a game engine the way you’d expect.
Doesn’t work that way with 3d and most 2d rendering on the GPU : you can’t pass vector data to texture units expecting an array of interleaved pixel data
I tried. Here on the left is Godot’s default icon.svg assigned as a texture, and on the right is a png I got by loading icon.svg into Inkscape and exporting it as a 128x128 png. They look almost the same. The png even looks slightly better.
I noticed that people who have some background in graphics design are typically not aware of this and believe that vector images imported into game engines would behave similarly to how they do in their favorite vector editors (which are typically cpu-side rasterizes, possibly with some compute shader help)
@mmei4 Graphics cards don’t speak “vector” language. They are optimized to only understand two things: triangles and pixels. Anything you want drawn by a dedicated graphics hardware must be converted into one or the other. That’s the price to pay for insanely fast drawing we all enjoy having.
So tldr, “vector graphics” you refer to doesn’t exist in Godot, or any other comparable game engine. When you import a SVG file, it will be rasterized to a bitmap of the pixel size specified in the SVG file. If that’s large, you’ll encounter performance and storage problems as graphics cards have physical limits on bitmap/texture sizes they can handle. And as @OleNic mentioned, many cards really like their texture sizes to be the power of two (so; 8, 16, 32, 64…). It’s a good habit to stick to those sizes.
Small correction, pixel size doesn’t have to be present in the svg file, Godot will convert size in pts or mm to the equivalent pixel value when rasterizing the image. However if a unit is not specified in the size it assumes the size is size in pixels.
I want to make sure I am approaching this correctly by converting my original map into multiple 512x512 pngs then placing using a tilemaplayer. I would then need to figure out how to load and manage these chunks?
Is there anything I should be aware of if I am doing this correctly?
Looking at your map, I’d use 2d meshes instead for those big flat shapes. That’d be closer to “vector graphics” approach and would also give you “infinite scalability” without pixelization.
As I have never build something similar, I can’t / don’t want to suggest the best solution here.
Some thoughts, every tile as an individual 512px image is a lot of data. Some optimization is there for all the empty and similar tiles.AFAIK the Tilemap should handle the visibility logic. Not sure if all tiles will be loaded into VRAM at start, but I think so.
Maybe others have better solutions / suggestions.
I don’t really know about 2D meshes but a bit of research shows me this would allow Godot to render the actual parts of the sprite which would help with my performance issues?
I’ll do this to all my sprites but will stick to the tilemapping the map for now to see how this goes.
Why doesn’t Godot automatically do this for sprites (assuming they are not too complicated), the conversion seems pretty simple with a press of a button.