原文:SwitchingColor Shader
翻译:dreamana.com
你有看过这个 Nissan Juke 的网站专题吗?我在偶然在 Away3D showcase 里发现这个 microsite 的。很棒的美术,优雅的程序。自从我玩过许多 shader 之后,我立刻就对这个不可思议的 shader 作品产生兴趣。尤其这个“颜色切换”特效(当你点击汽车有色的区域并选择一个新颜色的时候)引起了我的注意。花了几个钟头的修修补补之后我做了一个 shader 出来,看起来很像。看!就点击方块的任意地方,却换到一个随机颜色。
Have you already seen the Nissan Juke webspecial? I came across this microsite on the Away3D showcase. Great artwork, neat programming. As I was playing a lot with shaders, I was immediately interested in the incredible shaderwork that was done here. Especially the “color switching” effect (when you click on a colored area of the car and select a new color), caught my attention. After some hours of tinkering I came up with a shader, which looks quite the same. Have a look! Just click on the block anywhere, to switch to a random color.

继续研究 MMD,换用 Flare3D 来渲染。
已实现:模型文件解析,Mesh 生成,骨骼,蒙皮,IK 计算

未完善:动作文件解析,动画
TODO: 表情
查看 上一次的实验

尝试将 pmd 解析部分地移植到 Away3D 4.x
以后有时间再继续完善,现在这个实验只是 半成品,混合了一些 PV3D 的代码片段,代码很糟糕
2013-12-05 updated
仔细研究过 MD5MeshParser.as 之后,大概明白类 Away3D 的骨骼动画如何组织。之后才发现官方论坛里其实已经 有人总结过:

出处:Nothing But The Truth | Premultiplied Alpha
What is “Alpha"?
“Alpha” 指的是「不透明度」= “Opacity”。Alpha 值越大,則越不透明。本文將以 a 代替 Alpha。
What is “Alpha Blending"?
Alpha Blending 是指當有兩個 Pixel 在同一個位置時,且上方的 Pixel 為「透明的」(也就是其 alpha < 1),如此一來,後方的 Pixel 就應該會“透出“來。
事實上 Alpha Blending 也就是我們常說的 Compositing。
——《Stage3D Game Programming Beginner’s Guide》阅读笔记
Molehill 是什么 ?
Molehill 是 Flash Stage3D 技术的开发代号(现在正式命名 Stage3D)。它能让下一代 Flash 游戏通过显卡 GPU 硬件加速去渲染 3D 图形(或成千上万个“精灵”),从而降低 CPU 负载。
Molehill 不是什么 ?
Molehill 是非常低层的 API,只提供基本的 3D 渲染功能。它不是一个游戏引擎(如 Unity3d 或者 Unreal 又或者 ID Tech),一个游戏引擎还包含物理模拟,音频,音乐,碰撞检测等等补充的游戏函数。取而代之的是,你可使用 Molehill 这样的低层 API 去制作你自己的游戏引擎。与 OpenGL 或 Direct3D 相似,Molehill 是一些非常基本的函数集合,是游戏和游戏引擎的基本构件。
用 Starling 的 Quad 类只需写几行代码就能生成的矩形,直接用 Stage3D 的 API 写,会发现不是那么简单……
开发文档里面关于渲染步骤的介绍:
To render and display a scene (after getting a Context3D object), the following steps are typical:
- Configure the main display buffer attributes by calling configureBackBuffer().
- Create and initialize your rendering resources, including:
- Vertex and index buffers defining the scene geometry
- Vertex and pixel programs (shaders) for rendering the scene
- Textures
- Render a frame:
- Set the render state as appropriate for an object or collection of objects in the scene.
- Call the drawTriangles() method to render a set of triangles.
- Change the rendering state for the next group of objects.
- Call drawTriangles() to draw the triangles defining the objects.
- Repeat until the scene is entirely rendered.
- Call the present() method to display the rendered scene on the stage.