-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
Investigate a single-mesh solution w/texture atlasing #38
Comments
Godot provides the AtlasTexture class that wraps a subsection of another texture, so you can get native wrapping etc. However, I don't think this would work for the single-mesh idea, since AtlasTexture objects are CPU-side. You'd need a way to feed an array of textures into a shader, at which point you might as well just write a custom atlas lookup yourself. This might be a bit less limited than I thought, at least as far as PBR goes. You could atlas all the PBR content's channels separately from regular textures, then feed them all into a shader that outputs the appropriate PBR information. |
I think meshes / collisions should be generated on a "per brush" basis. Since you can benefit from Godot's basic frustum culling. |
The basis on which meshes and collisions are generated is fully controllable through the build step system, so that can be arranged @DeadlyLampshade As far as groups go, those become top-level func_group entities alongside the worldspawn in the resulting .map file. The QodotBuildMaterialMeshes step doesn't account for that as it's just splitting by texture, but such behaviour could be implemented by creating a new build step class in a similar vein, by inheriting from QodotBuildMeshes. TL;DR Qodot is designed to be able to output optimal geo for a given use case, so compatibility with culling won't be a problem. |
Need to do some draw call profiling with AtlasTexture and figure out if Godot is smart enough to batch up instances of the same material that all draw from the same atlas. Could make doing this trivial if so. |
AtlasTexture was a bust, but I managed to put together a ShaderMaterial-driven single-mesh atlas setup in the latest commit. Still to do:
|
Todo: Investigate 3D textures. These might be a perfect way to avoid mipmap / aniso issues. |
TextureArray was the key to getting properly-mipmappable textures, but unfortunately it and its TextureLayered superclass don't serialize properly if created in the editor, so they can't be used for offline baking like this. I've opened an issue on the Godot GitHub: On way to work around this may be to build a TextureArray that's internal to QodotMap and not serialized, then rebuild it from a list of textures on startup both at runtime and in the editor. That would work around the issue, but requires build steps being able to store persistent post-build data in the map. Needs some thinking about. |
I built a wrapper class to work around the TextureLayered issue, and integrated it into the atlased mesh pipeline in the latest two commits. |
Combine all meshes into one and use a texture atlas, presumably with a customized fragment shader to allow for wrapping textures that are looked up?
The text was updated successfully, but these errors were encountered: