NeHe OpenGL Lesson25 – Morphing & Loading Objects From A File

screen_shot7-300x223 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.

转载于:https://www.cnblogs.com/open-coder/archive/2012/08/23/2653274.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
NeHe OpenGL教程(中英文版附带VC++源码)中英文系列 Lesson 01-lesson 02 创建一个OpenGL窗口: 如何创建三角形和四边形 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=53679 Lesson 03-lesson 04 添加颜色 旋转 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=53682 Lesson 05-lesson 06 3D空间 纹理映射 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=53706 Lesson 07-lesson 08 光照和键盘控制 混合 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=53709 Lesson 09-lesson 10 3D空间中移动图像 加载3D世界,并在其中漫游 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=53822 Lesson 11-lesson 12 飘动的旗帜 显示列表 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=53823 Lesson 13-lesson 14 图像字体 图形字体 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=53880 Lesson 15-lesson 16 图形字体的纹理映射 雾 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=53881 Lesson 17-lesson 18 2D 图像文字 二次几何体 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=54042 Lesson 19-lesson 20 粒子系统 蒙板 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=54072 Lesson 21-lesson 22 线,反走样,计时,正投影和简单的声音 凹凸映射,多重纹理扩展 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=54074 Lesson 23-lesson 24 球面映射 扩展,剪裁和TGA图像文件的加载 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=54176 Lesson 25-lesson 26 变形和从文件中加载3D物体 剪裁平面,蒙板缓存和反射 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=54177 Lesson 27-lesson 28 影子 贝塞尔曲面 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=54180 Lesson 29-lesson 30 Blitter 函数 碰撞检测 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=54186 Lesson 31-lesson 32 模型加载 拾取, Alpha混合, Alpha测试, 排序 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=54209 Lesson 33-lesson 34 加载压缩和未压缩的TGA文件 从高度图生成地形 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=54271 Lesson 35-lesson 36 在OpenGL中播放AVI 放射模糊和渲染到纹理 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=54289 Lesson 37-lesson 38 卡通映射 从资源文件中载入图像 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=54290 Lesson 39-lesson 40 物理模拟简介 绳子的模拟 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=54706 Lesson 41-lesson 42 体积雾气 多重视口 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=54707 Lesson 43-lesson 44 在OpenGL中使用FreeType库 3D 光晕 http://ieee.org.cn/dispbbs.asp?boardID=61&ID=54710

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值