Rotation optimization, GPU accelerated
An experimental release, with a possible large increase in rotation performance.
TLDR; Rotation will now cost minimal CPU and animation can be paused while rotation will still work. In one case it goes from 25% of CPU to 0% CPU to rotate multiple complex models.
I moved the rotation calculations from the CPU to GPU by using changing the C3 Model/View matrix to Include the x,y,z rotation angles. The rotation calculation is now done in the C3 standard vertex shader in the GPU with no real increase in GPU performance requirement and the CPU performance for rotation is almost completely eliminated (except for the Model/View matrix calculation.)
You can now pause animation and rotation will continue to work. If animation is not required, this is recommended (I may also change animation paused to the default initialized state.)
Note that rotation with Euler angles (x,y,z) still will suffer from gimbal lock, so if possible, pre-rotate your models in a 3d modeling program (like Blender) to reduce the change of gimbal lock.
Note that animation will still continue to run on CPU and will still be somewhat expensive based on the animation rate and the number of vertices/triangles that must rotate. It's not obvious yet if the animation calculations can be done on the CPU, because in the case of skinned nodes, each vertice may have a different blended transform.)
There may be some issues with this new update in terms of the bounding box, z height, since they are not yet updated based on rotation done on the GPU, this may make the 3DObject 'clip' early. I will work on updating the bounding box and z height to match the GPU based rotation of the vertices.
Please leave feedback, if you see performance improve with rotation (w/o animation) or if you see issues in more complex C3 examples (I restore the C3 Model/View matrix, but there could be issues with changing the matrix or with the original matrix being used.)
Files
Get Construct 3 3DObject Plugin
Construct 3 3DObject Plugin
Construct 3 3DObject, loaded from 3D model files (gltf embedded format)
Status | Released |
Category | Assets |
Author | kindeyegames |
Tags | 3D, construct, construct-3 |
More posts
- fix (accessors) add support for sparse accessors in gltf8 hours ago
- Fix (node-disable) fix node disable without skinned node20 days ago
- fix (node-disable) regression26 days ago
- Fix (playable Ad)38 days ago
- fix (worker) correct animation blend for worker (translation)55 days ago
- fix (opacity)61 days ago
- add (sample) sample gpu-skin with phong light74 days ago
- fix (gpu-skinning) fix regression for worker mode74 days ago
- fix (light) fix for simple phong orientation75 days ago
- Add simple phong lighting support75 days ago
Comments
Log in with itch.io to leave a comment.
nice!!!