NeHe OpenGL Lesson25 – Morphing & Loading Objects From A File
This sample shows us how to do vertex morphing and load objects from text files.
For vertex morphing, you could apply such technology to transform smoothly object A to object B, like transform a human being to a vehicle and so on. Actually, this is an old animation technology. As you see, we need to keep a whole vertex posture for each key frame. This will take a lots of memory space. So currently, such animation technology already replaced by the skin animation which use only one copy of the vertex data and those key frames data saved into the bones. And we also apply skin calculation on the GPU, this will improve the speed a lots. But vertex morphing still has it’s space, like transform one object to another one, because such transform data is very hard to convert into skin animation.
Vertex Morph Implementation
To morph, the vertex number of those two objects should be the same. That means, we need to do one vertex to one vertex mapping. For each vertex, we could do the following calculation to transform source object to destination object:
D = S – (S – D) / steps;
After the ‘steps’ steps later, we could find the right part (immediate part, or morphing part) fully equal to the left part (Destination). Then we get a D from S. That is it. This is all done by this sample.
Something More
Another topic mentioned here is that loading objects from text file. For some assets, like model vertex, animation saved as text is not a good idea. String parsing will take a lots of time, make them binarized should be much better. But we could still use text file, such as .xml file during the process of game development. We could use .xml to organize the scene structure, contain the map or level content, make a simple description of a special material or shader graph and so on. We could use text files as an immediate content, but should use it as the final asset format. Of course, you could use text file as configure file.
For more details, you could find the source code from here.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了