Morphing a model

Can we morph any model in P3D?
for eg. I load up a cube with dimension a = 1.

Can I morph it into a cuboid of dimension l = 1, b= 5, h = 10?

cube.scaleInterval(3, Vec3(1,5,10)).start()

Thanks. Gonna try it out. Btw, will it have any performance problems. Will rendering 1000 cubes take the same amount of time as 1000 morphed cuboids? :slight_smile:

The word “morph” is a bit confusing here, because that word is already used in other contexts to mean something different.

You are referring to applying a transform, which is fairly cheap, but not 100% free. It will cost a bit to apply 1000 transforms to 1000 nodes, but not nearly as much as it will cost to have 1000 nodes in the first place.

You can reduce or eliminate this additional cost by using flatten. root.flattenLight() will apply all of the transforms to the vertices, so that there are no longer 1000 transforms (but there are still 1000 nodes). You can instead use root.flattenMedium() or root.flattenStrong() to further reduce the number of nodes for even greater performance improvements. Note that all of these flatten operations are irreversible, and reduce the amount of control you have in the future.