v0.11.0 - Indexed Rendering! Collision checking improvement!
Pre-releaseYo, what's up! It's been quite awhile!
So here's Tetra3D v0.11.0! This one is kind of a massive change, as internally I've dramatically altered Tetra3D in a few ways.
Performance
Firstly, we've moved to indexed rendering. Previously, each triangle had its own vertices; now, each mesh is comprised of vertices, and each triangle is comprised of indices. This means that, in a best-case scenario, triangles can reuse vertices, making for, hopefully, faster rendering.
I also created my own Vector struct, as flat structs of numbers seems to be far faster (both in mathematics as well as in allocation of memory) than the previous vector package I was using, by quartercastle. I still recommend that package outside of Tetra3D, as it's a very elegant solution for multi-dimensional vectors where speed isn't absolutely integral to the process.
All of this should mean a fairly significant boost in performance! We can see this in the case of the stress test in the examples folder. Here's the results as performed in v0.10.0 (Average 18.6 FPS):
And here's the same test in v0.11.0 (Average 26.3 FPS):
That's over a 40% improvement, which ain't shabby!
Collision Checking
Collision checking has been improved to be simpler and easier - now, instead of two CollisionTest()
functions, there's just one, and it just takes a CollisionTestSettings
struct. In this struct, you specify the objects you want to check against, as well as an optional callback to handle a collision as it happens. This is an improvement in collision checking because previously, you could only act on all of the collisions from CollisionTest()
- however, this new callback is called before any collisions happen for each collision. This is useful because you can use it to resolve collisions sequentially (i.e. if object A collides with objects B and C, and on checking with a collision against B you move A out of collision with B and C, then you won't have a collision with C, naturally). It's a small difference, but an important one, and it's helpful to be able to know that each collision will be handled properly.
Smaller stuff
There's also a variety of other minor changes and other performance optimizations. One such minor-ish improvement is that I've added the ability to tag objects for automatic static merging or dynamic batching (either through code or in Blender). This automatic batching is done when an object is added to or removed from a scene's hierarchy, and is automatically performed when a scene is rendered through a camera (as that way, we can ensure objects should be where they're desired to be prior to batching). This should help to allow for some easy optimizing non-moving elements in a game.
You can now add game properties to scenes themselves, which can be rather useful for global properties, like specifying background music for a level, as an example.
In Blender, you now have a couple of buttons to easily set an object's vector game property to the object's center or the 3D cursor.
In Blender, you now have the ability to copy game properties from a collection instance to top-level instanced nodes (so, in other words, you can override properties on a collection instance and have them be applied to the instanced objects. This is helpful for a situation where, say, you want to change the health on a specific character; now you can check off this option and create an HP property on the instanced version of that character. That property will be passed down to the instanced nodes).
All of the examples have been overhauled to be simpler and share common elements, like the camera and debug features.
You can now draw sprites in 3D, such that it's drawn in 2D, but still can be obscured and "occupy space in 3D". See the relevant sprite3d example. This can be very useful for situations where you want a sprite to not be resized or crimped with the camera, but have the sprite still be tied to 3D space.
@tomlister added the ability to export game resolution from Blender itself, so that makes loading cameras more seamless.
@eliasdaler fixed up some of the other examples, as well.
NOTE: I've also updated the Tetra3D add-on for Blender 3.4 support - note that this add-on probably won't work any longer with a previous version of Blender, as the default GLTF exporter now exports light intensity using customizeable units (real-world accurate or otherwise).
Anyway, lots of other stuff, so check out the commits for the full changelog.
What's Changed
- GLTF Export & Resolve Scene Resolution by @tomlister in #22
- Fix examples by @eliasdaler in #23
New Contributors
- @tomlister made their first contribution in #22
- @eliasdaler made their first contribution in #23
Full Changelog: v0.10.0...v0.11.0