Issue with rendering an texture onto a mesh

Godot 4.3

I first had a shader that relied on vertex colors to blend between meshes (it is a map that is split up into multiple parts). But I then realized that mesh LoD’s would probably mess up those vertex colors and make it look weird.

I then decided to just save the texture on the mesh using a SubViewport and a camera with orthogonal view.

But the texture I would have to make to cover the entire mesh would be gigantic. Or I would have to split the texture up many times and then I don’t think it would be efficient. Since I would have to sample from each one and blend between them depending on where the pixel is in a fragment shader.

I am kind of at a loss as to how to render this image onto my mesh currently. If anybody knows a solution. simple or complex, please do answer. Thanks!

What is the issue you are running into?

This statement sounds like a very normal shader technique, what exactly have you tried? what do you expect to happen and what really happens?

I just read through it again, and sorry, I didn’t really ask my question.

My textures would probably be around 10-15k. They could be lower resolution, but the there would need to be more of them.

Would sampling from 20 different textures be inefficient in that scenario? Would that hog a lot of VRAM? I don’t know of a way to test VRAM usage, and I haven’t tested if sampling from that many different textures would be inefficient either.

I can check performance in a couple of hours, but if you already know whether it would be doable or unrealistic, that’d be great.

15K textures sounds extreme, plenty get away with 4K or less for heightmap terrain shaders. What exactly are you doing?


That is, in full resolution, an 8k by 8k image, and looks like the one i want to save, only lower resolution. It is the result of putting my normal terrain shader onto a chunk of terrain and saving that through a SubViewport.

The edges of the blob are brown, those were decided by vertex colors.

Because vertex colors slightly change if the LoD of the mesh changes, those edges would look different if the LoD changed.

I do not want that, so I decided to just save the texture of the entire bit of terrain as it looks on the highest LoD, so i can just render this image onto the mesh, and the edges won’t change.

If you know of a way to make vertex colors not change if the LoD changes, or another way to not need these crazy high resolution images in this scenario, I would love to know.

How are you intending to use this mesh? If it’s one giant mesh for a small first person player then I don’t think it’s going to LOD anyways. If it’s far enough away to LOD then how is your shader affected so drastically? Can you show the LOD edges in-engine you want to avoid so I can compare?

Using this image as a texture for the terrain would still have LOD differences, maybe affecting the edges, depends on how you set up your shader, could you paste that too?

I would avoid a single crazy high resolution image by using standard heightmap techniques, up to a 4K image and segmenting each chunk of land. And/or use one of the good addons in the AssetLib like hterrain or Terrain3D, I’m sure you could render out this mesh as a heightmap and a material splatmap