In this latest beta, we’ve added a quite exciting feature: the Mesh Component
Although the feature isn’t 100% done, we believe it’s still usable in its current form.
And we’d love to hear your feedback to this feature.
For instance, we lack proper documentation for this feature (but ofc that will come soon too).
So, currently, this test project will have to serve as a starting/learning point for those interested.
What does it do then, you ask?
Mesh
This component displays a single mesh.
This is different form a model which might have multiple meshes, and may be skinned.
Custom vertex formats
The mesh format supports custom vertex formats.
We use our buffer api which supports multiple named streams.
As such, you can get/set values and alter a stream at runtime. (E.g. positions, colors, normals…)
Formats
In order to make these files easy to generate and manipulate using tools or by hand, they’re in json format. (.mesh, .buffer)
Material
The named streams are automatically provided as input to the vertex shader.
There is no need to specify them in the material file itself.
Material Local Space
The data will be provided as-is to you in your shader, and you will have to transform vertices/normals as usual on the GPU.
Material World Space
If your material has “World” space set, you have to either provide a default “position” and “normal”, stream, or you can select it from the dropdown, when editing the mesh. This is so that the engine can transform the data to world space for batching with other objects.
Test project
MeshTest.zip (252.5 KB) (License: MIT)
Rotate the camera with the left moust button (or touching the screen)
Blender
Inside the test project, in assets/blender/
you’ll find the test scene I created for with geometry setup.
- UV coordinates layer named
texcoord0
- Vertex color layer named
color0
(You can name these what you wish, as long as you match the names in your shaders)
Exporter
Also, you’ll find the defold_mesh.py
, a Blender exporter which outputs to the mesh buffer format.
It is currently very basic, it currently only exports the mesh of the currently selected object
Currently, it supports positions, normals, uvcoordinates and vertex colors.
Wrap up
Finally, I’d also like to thank the team, most notably @sven and @mats.gisselson for their hard work implementing this feature.
And ofc a mention to @ross.grams for the excellent RenderCam which is part of this test project.
And please get back to us with feedback to this feature!
In this clip, I the manipulation of the buffer at runtime, using hot reload (CTRL+R) to refresh the resources while the app is still running.
(Update 2024-08-13: Added MIT license)