Loog time no see~

很久,很久,很久没有写博客,好像都有半年的样子了 😀
相关主页在FB上啦 https://www.facebook.com/kingdomscharge


The Legend of Heroes:Sen No Kiseki. stage all clear!



比如校舍第七层的最终BOSS场景,就是Fate Stay Night 中 Archer的无限剑制呀


最终BOSS的高达战,又满满的 异度装甲 的即视感。。。十几年前的游戏了。。




最后的最后,今天想把 CCSpriteWithFilter 放到手机上测试的时候,发现不设置滤镜的话,默认根本不显示。。 然后是 GodRay滤镜会直接把程序弄崩溃了。。

GodRay的问题我在PC上测试本来是木有问题的,看来手机上的OpenglES 更加严格的说。。。 抱歉之前一直都没有真机测试的说了。

手机上的OpenglES 是强类型的, 不同类型运算比如int / float 会崩溃。
uniform 设置初始值会崩溃
给float 赋值时末尾带f会崩溃

GodRay 在我的小霸王手机上测试大概20帧的样子,实际上可以通过修改采样数来提高帧数的说

真机截屏,华为荣耀3(前几天差点给摔碎了 :p )

GodRay APK (小米手机勿下,会闪退)


–Opengl 超级宝典我已经决定放弃不看了,太尼玛坑了,为了运行个Demo,去捣鼓作者的工具类库,但是这本书可是面向小白的,工具类库又是各种恶心的问题不能用,要有一定经验的人才能解决,简直本末倒置~

so~ 我决定看 Opengl 编程指南了, 目前看到第六章感觉良好~
第六章的Demo blendeqn.c 是Opengl的混合模式,里面用到了glBlendEquation API 这是Opengl的API,因此要么使用 glutext 扩展,要么直接使用 glew 我选择后者。 可是在编译的时候,各种找不到 glew 的相关定义,造成这种问题的一般都是 dll 或者 lib 的位置问题。

.h文件放到 VS/VC/include 中
.lib 放到 VS/VC/lib 中
.dll 放到 system32 中

结果编译项目,还是符号错误。 之后我在 glew 的 binary 文件中有看到 x64的版本。 我估计可能我是 win7 x64系统,就必须用x64版本的glew. 于是 .dll 文件就丢到了 SYSWOW64 目录下,结果编译失败。一番寻找,让我在 VS/VC/lib 目录下居然找到了个 amd64 的目录(真坑) 把 .lib 丢到 这个目录下。 终于未知定义的错误没了。 但是给我弹出 找不到符号的错误,在各种系统相关的dll中, 搜索了一番,这个还算好解决 直接 VS菜单 调试 -> 选项和设置 -> 常规 -> 打勾源服务器支持 / 调试 -> 选项和设置 -> 符号 -> Microsoft符号服务器 。 之后编译项目,还是报错 0xc000007b 错误。 最后的最后,我考虑下只有一种可能性了。
glew 的包中提供了 win32 和 win64 的2个版本,之前是 win64 丢到 syswow64 , win32 丢到 system32 目录下。这一次, 我把 glew 的win32中的文件,也丢到 syswowo64 下, 终于编译成功了。。总之,好坑~~


最近在从stage3D转向到opengl开发,于是入手了 Opengl超级宝典第五版。 结果SB5 工具库各种恶心的环境搭建,耗费了3个多小时,最终放弃。 于是转向用 第四版学习。

进度蛮顺利的,第一天就看到第四章 (跟stage3D大同小异,API的变种版本而已,很多都是跳着看的)

结果编译 transformGl 的时候出错了。

这2个API 报错


error LNK2019: 无法解析的外部符号 “void __cdecl gltDrawTorus(float,float,int,int)” (?gltDrawTorus@@YAXMMHH@Z),该符号在函数 “void __cdecl RenderScene(void)” (?RenderScene@@YAXXZ) 中被引用

看到这个就知道是函数没有具体实现的问题,于是到 shared 里做文档内部搜索
最后发现 gltDrawTorus 的实现在 gltools.cpp 里,m3dRotationMatrix44 的实现在 math3d.cpp 里,果断将这2个cpp引入到项目中,之后继续编译出现新的错误

gltools.obj : error LNK2001: unresolved external symbol _pglCreateShaderObjectARB
gltools.obj : error LNK2001: unresolved external symbol _pglCreateProgramObjectARB
gltools.obj : error LNK2001: unresolved external symbol _pglLinkProgramARB
gltools.obj : error LNK2001: unresolved external symbol _pglShaderSourceARB
gltools.obj : error LNK2001: unresolved external symbol _pglGetObjectParameterivARB
gltools.obj : error LNK2001: unresolved external symbol _pglAttachObjectARB
gltools.obj : error LNK2001: unresolved external symbol _pglDeleteObjectARB
gltools.obj : error LNK2001: unresolved external symbol _pglCompileShaderARB

=。= 真是命运多舛



like this


好了,先去爽下 “Watch Dog” !

AGAL2 is here


After a bit of a start and stop first round, the Adobe team recently stated that they were back and working on the AGAL2 specification, a feature that was previously available in an earlier beta version of the Flash player, but later dropped but a feature set that I had been eagerly awaiting.

Anyone who joined us at the last Stage3D online conference will have seen the Adobe Flash team showing off some of the great new player features, which included demonstrations of AGAL2 in action, amongst other features. Today, I’m really excited to see that the new beta player is available for download and the AGAL2 features will be available publicly in the next iteration, which is scheduled for public release next month. Meanwhile, we can download the latest beta player from Adobe labs:


What’s new in AGAL2?

AGAL2 offers a set of additional features that can be used to improve the visual fidelity of rendering output in your Stage3D projects. This means that Flash graphics are about to got a lot sexier. Features such as MRT help to increase the speed of rendering by referencing multiple render to target textures from within a single shader pass, we have additional features and memory space. So what can you expect to be playing with? Here is a quick overview of some of the new features:

  • Multiple Render Texture (MRT)
  • Anisotropic filters
  • Conditional forward jump
  • Increases in register space
  • Floating point textures (RGBA_HALF_FLOAT)
  • Partial derivatives (ddx, ddy)
  • Fragment depth (od)
  • Texture anti-aliasing


Multiple Render Targets (MRT)

MRT is a feature that will allow a shader to access a number of addressable render targets. This is useful when considering the concepts used in deferred rendering. Deferred rendering is a technique in which multiple images are rendered sequentially and then those images are composited back into a final result. The memory space used during this process is often referred to as the GBuffer and will contain channels such as; albedo, light, normals, depth etc. There are a number of advantages to this technique, perhaps most notably, the ability to render lights to an independent light map, which is then combined with the scene accordingly.



Anisotropic Filtering

Anisotropic filtering is used to improve the artifacts that are caused by viewing a surface at an oblique angle. The image below illustrates the difference in output quality where the texture on the right is being anisotropically filtered.


To make use of this feature is very simple. A new sampler parameter is now available that can be placed within a tex operation as such:

tex ft0, v0, fs0 <2d,anisotropic8x,miplinear,wrap,dxt1>

The anisotropic sampler parameters can be any of the following:

  • anisotropic2x
  • anisotropic4x
  • anisotropic8x
  • anisotropic16x


Conditional Forward Jump

If you are familiar with an if statement, you are already well equipped to dealing with conditional jumps on the GPU if you’ve used that with an else statement, then you’re really ready to roll. Prior to this, AGAL required various hacks to achieve similar functionality with branching that required checks against register data. The conditional flow controls of AGAL2 allow for execution of shader code upon a particular condition. These operations are:

  • IFE – (if equal)
  • INE – (if not equal)
  • IFG – (if greater than)
  • IFL – (if less than)
  • ELS – (else)
  • EIF – (else if)

Collectively they serve to provide developers with more granular control over the flow of their shader programs but I must add a quick note to say they should be used judiciously. Using conditional statements inherently means that you will be using more operations, which can impact the performance of your shader code. That being said, conditionals are great when used to simplify workflow and their advantages often outweigh the negative performance hit. It’s probably wise to see what works best and monitor execution speed of your shaders. There is always Adobe Scout or Intel GPA etc for such tasks ;)


Increased Register Space

In the previous AGAL spec, we had access to the usual set of registers. Vertex and fragment registers were made available, allowing us to intermediately store resources and make them available to the programmable graphic pipeline. Whilst this is exactly the same with AGAL2, the amount of memory that each shader can access has been increased. Here is a chart that shows a comparison between the numbers of available registers.

AGAL Resisters

We can see from the table that we have access to well over double the number of registers on most registers. Possibly the two most notable would be the number of tokens that can be used, which directly translates to the overall size of your shader programs, and the VC register. My guess is that the large increase of the VC register is balanced like this for one important reason, bone animation. Bone animations are used for manipulating vertices, the technique is also known as skinning, and requires that either matrices or quaternions are uploaded to the GPU via the VC register. The original AGAL spec was quite limited in this regard but the increase means that more than double the number of bones can be uploaded, offering the ability to produce more detailed animations.


Half Time Conclusion

Well, that’s half way! We can see that Adobe are really bringing exciting and much awaited set of features and whilst many of them are nothing new to the 3D community, it’s important to realize that the emphasis for Adobe is on platform reach. Adobe are seemingly striving to provide cross platform GPU support to as many users as possible by offering subsets of features that target as many GPU chipsets as possible. In this regard, it makes complete sense that the Flash Player team are trying to ensure that Stage3D doesn’t need to fall back on its software rendering mode and the result of that is a good overall experience to the end-users.



Diary – 2013 – 11 – 09

今晚恒大赢了啊,为了看比赛不困喝了一杯咖啡,导致现在还睡不着的说~~~  比赛最后2分钟紧张死我了,守门员曾诚还被裁判警告拖延时间的说~ 哈哈。

之前的之前,今天才买2个月的三星显示器全屏发红的影响我Dota的发挥,心想900块的显示器果然不靠谱什么的,正在填下京东退货单的时候灵机一动,在红屏的时候开启我的PS3,切换信号源后一切正常了!!! 果然是连接我笔电的HDMI信号线的问题!!! 话说这线是买PS3时候某同事挑的,入手后这线只要扭曲到90度就无信号了~ (我这人又很节省嘛~)于是就将就用了,平时也相安无事,最近2个月果然连抗干扰这功能也费了吗?都搞的我显示器发红了(也许是被我笔电的排气口长期烧烤的缘故吧 :D). 一怒之下吃完饭,赶在恒大开始前飚车去买新线回来了~一切又完好如初!!

之前的之前的之前,中午把使命召唤10通关了的说~ 虽然配置碉堡了(我的小霸王关闭了 抗锯齿,景深, 全屏幕真实光反射 后高分辨满帧坚挺的说) 但是画面渣透了!!! 不过剧情真的很爽就是 了,秒9代几百条街!! IW 社果然不是盖的说。。。

因为某些原因,最近又开始撸Starling了~  命运总是让我无法彻底割舍你呢~~ 于是乎,下周吧,发一个在Starling下创建3D模型的教程吧~~ 支持Starling原生的画家算法的说。。。。

最后来个配图好了~~ 就决定你是了 – 使命召唤 – Ghosts

I’m back


话说最近大作又扎堆出了~~下周三 使命召唤, 这周蝙蝠侠, 命运之镜HD~

突然又想败家一个Gundam 模型~~


starling 笔记01

DreamFairy正在把前年的 苍白的茧大冒险 移植到starling上.
之前的游戏在这里 点我进入


1.创建starling后, 要么设置 starling.start() 要么在 某个render中调用 starling.nextfame(); 否则所有的监听都会失效. 比如 Event.TRIGGERED

2.创建一个MovieClip后 必须使用 Starling.juggler.add 加载后,才会播放帧. 移除MovieClip 后从 juggler移除,然后执行dispose ,它的事件会自动移除

3.在用之前的洛克素材创建MovieClip的时候,发现每帧会出现拉伸和模糊. 原因是 MovieClip会根据其第一个Texture来设置其宽高, 而洛克的素材原本就是矢量的逐帧动画,每帧宽高不一样,导致部分帧被拉伸.

要解决模糊问题, 直接调用 Texture.fromBitmapData(bmd,false); 第二个参数设置为 false即可.
要解决拉伸问题. 我试过几种方法.
1) 遍历洛克的所有帧,取出最大宽和最大高,然后创建一个空的Texture插入 Texture数组. 待创建MovieClip后 将其移除. 结果画面仍然被拉伸, 虽然还没去看源码,但我估计是 MovieClip设置宽高依据的不是第一个 Texture的width 和 height 而是 colorBounds ,因此第一个空的Texuture因为没有任何像素而导致宽高失效.

2) 试着使用TexturePacker 但是这货要导出一张位图和一张xml配置表.这样导致项目的复杂度又高了…(其实是DreamFairy很懒,不舍得写混合loader,连greensock的queueloader都不舍得用, 更别说写一个 xml+png 打包成一个文件的 打包工具了)

3) 于是考虑着既然游戏的体积不大,就适当的浪费一下性能吧.

        private function createIdelTexture() : void
            var cls : Class = getDefinitionByName("stand") as Class;
            var standMovie : flash.display.MovieClip = new cls();
            var textureList : Vector.<Texture> = new Vector.<Texture>();
            var bmd : BitmapData;
            var maxWidth : Number = 0;
            var maxHeight : Number = 0;
            for(var i : int = 0; i <= standMovie.totalFrames; i++)
                if(standMovie.width > maxWidth) maxWidth = standMovie.width;
                if(standMovie.height > maxHeight) maxHeight = standMovie.height;
            for(var j : int = 0; j <= standMovie.totalFrames; j++)
                bmd = new BitmapData(maxWidth, maxHeight, true, 0);
            m_idelMovie = new starling.display.MovieClip(textureList);
            m_idelMovie.pivotX = m_idelMovie.width >> 1;
            m_idelMovie.pivotY = m_idelMovie.height;


by the way… stage3d的 实时阴影部分的源码,很多大神明明写出来了,却不公开源码. 我懂得,这是潜规则. It’s ok 我也已经研究出来flare3d 创建实时投影的办法,虽然在我看来我的实现方式比较笨. 嘛嘛~既然是潜规则,你们不公开,那我也不公开.