Wednesday, December 24, 2008
Wednesday, December 10, 2008
z-ground goes 'real' 3D ! - z-ground FP10 preview
Thursday, November 20, 2008
Maximum z-ground ---- z-ground FP9 v 0.1 preview
4.time of the day
We can change the time of our world, the position of sun, brightness of stage, color of the clouds and shadows of objects will change according to the time.
Saturday, October 25, 2008
Z-Ground Terrain demo
This demo was just to test my way of rendering terrain in z-ground engine. It is half-finished, not smooth, doesn't 'looks right', and the code is a mess. All in all the result is not very satisfactory but at least it prove that my way works!After some optimization it will be usable, I think.
It looks like some kind of voxel rendering effect but actually not.(I also write one 3D Voxel Terrain engine using as3.0, if you are interested, here it is(with code))
I use nothing but some basic ideas of z-ground to create it. Again, this swf was created by pure code, the textures were generated by my texture generator engine on the fly.
By the way, my next demo of z-ground, which is almost done, is about lighting and shadow, water reflection effect of z-ground engine.
Demo:HERE(arrow key to move)
(BE CAREFUL! It needs lots of time for pre-rendering,to avoid crashing you computer,download it and use a flash player to view. )
Code:UNDER OPTIMIZATION
Saturday, October 18, 2008
open-source as3.0 Voxel terrain engine v0.1 released
New Version: http://flaswf.googlecode.com/svn/trunk/VoxelTerrain_v0.15
演示:(使用方向键控制移动)http://flaswf.googlecode.com/files/voxel_terrain.swf原C代码(由云风提供):http://turinger.center-tech.com/articlefile/image/newvox_48.zip
AS3.0源代码:http://flaswf.googlecode.com/files/Voxel_v0.1.rar
代码中文注释请参见原C代码(由云风翻译)
==============================
Interested in generating terrains, I wanted to create a real-time terrain engine on flash. I'm trying to write one using action script 3.0 using some 3D classes and perlin noise but it's not finished yet.
Not long before I found Andrea "6502" Griffini's old demo of his voxel terrain (NEWVOX.C). The original C code is really clear and the final work is impressive. So I decided to write another voxel terrain engine using his code.
This is the first step, I just 'translate' his C code into action script 3.0. What I want to do is add textures of terrain, sky and the background, and maybe some lighting effect as well. It's far from being finished.
Demo:
HERE (use arrow keys to move)
Latest
Source Code:
C(by Andrea "6502" Griffini): thanks to FengYun
C/SDL
AS3.0: HERE Latest
Links:
http://simulationcorner.net/index.php?page=comanche (JS&Java demo with texture)
http://www.playfuljs.com/realistic-terrain-in-130-lines/ (html5)
Update on 2012-12-11:
lizhi posted the modified code on wonderfl: http://wonderfl.net/c/9v5N (AS3)
Update on 2019-Feb-11:
Voxel terrain rendering algorithm in less than 20 lines of code:
https://github.com/s-macke/VoxelSpace (Python, JavaScript)
Sunday, September 28, 2008
New demo of Z-Ground out!
This demo of my Z-Ground was half-finished about a month ago. I want to make it better so didn't let it out that time. But now I'm aware that I will be very busy for something else in the following months. Not much time for flash, so I decide to share it first. However, code is not available this time. Just be patient, all the documented sources will go public sooner or later. OK, now let's see what I am doing :
The biggest difference this demo from the old one is this swf is created by pure code, that's why it is only 7 kb! Maybe you don't believe it, what about the textures? Yes, they're generated by code! This is also a test for my texture generator engine-a small tool to generate all kinds of textures using perlin noise. The textures of cloud and sea are created by it.
DEMO:HERE
CODE:UNDER OPTIMIZATION
Saturday, August 30, 2008
My chatbot in Flash
类的功能很简单-通过用户输入字符在写好的XML中寻找相关语句并显示出来。
但格式好像为as1.0,没太看懂,自己用as3重写了一个,代码下载:http://flaswf.googlecode.com/files/flash_chatbot_v1.0.rar
源代码是对于英文的,汉语分词太复杂,所以没有增加回答汉语功能。
有兴趣的朋友可下载代码继续完善。(自己对as的XML功能并不熟悉,现学现卖,写出的代码一定有很多需要改善之处)
最后推荐两个较完善的flash聊天机器人:(英文)
Crunchy: http://portfoliosites.com.au/billtest/chat/
by Billy T .
Square-bear: http://www.square-bear.co.uk/games/bearbot/chat.htm
by Steve Worswick.
==============================
I was inspired by an interesting chatbot flash made by Chad Adams.
I can't fully understand his original class in flash mx, so just write one myself.
It costs me some time because I have to write the code while searching and learning what I need about XML.
I am not good at using action script to deal with XML and strings.
So no doubt the class can be improved.
Don't laugh at my bot, after all its brain only weighs 2 KB!
My chatbot source is Here: flash_chatbot_v1.0.rar
Chad Adams's original code is available at http://www.flashcomponents.net/component/flash_chat_bot.html
All in all, this is one simple experiment. All it can do is to search the XML data (by Chad) to find answers according to some word you typed in and display the answers.
To extend my chatbot and make it more "clever", you can replace "brain.xml" with more complicated things such as "Artificial Intelligence Markup Language" and try to parser them:
http://en.wikipedia.org/wiki/AIML
http://www.alicebot.org/aiml.html
and some open source chatbots based on AIML:
http://sourceforge.net/projects/programe/(AIML chatterbot written in PHP and using MySQL.)
http://www.smart-page.net/blog/2009/10/16/flash-aiml-tts-chatbot-hal9000-using-php-and-festival/ (Flash AIML TTS Chatbot – ‘HAL9000′ using PHP and Festival)
By the way, if you are interested in chatbot, here are some links:
Some powerful chatbots are
Adam:http://www.dudziak.com/talk.cgi
Alice:http://alice.pandorabots.com/
MegaHAL: http://megahal.alioth.debian.org/
they can say more and answer more questions.
Jamie Durrant offers us a tutorial about how to write a chatbot using what ALICE (above) knows(as2.0 or lower) with code here: http://www.jamiedurrant.com/flashbot.html .
What that flash file do is to replace the default html interface when using the AI chatbot at www.pandorabots.com.
Another Actionscript 3 Pandorabot Chat Class is here:
http://alicebot.blogspot.com/2008/05/pandorabots-has-xml-rpc-interface-that.html
Finally, some flash chatbots:
Crunchy: http://portfoliosites.com.au/billtest/chat/
by Billy T (nice UI !).
Square-bear: http://www.square-bear.co.uk/games/bearbot/chat.htm
by Steve Worswick.
Monday, August 25, 2008
ray tracing in AS3.0
但计算需要耗费相当长的时间,所以目前在实时三维中并不多见。
然而,光线追踪仍是未来3D技术的发展方向,随着硬件的升级,它很可能将成为以后游戏标准特效。
光线追踪也是我最喜欢的一项技术,三维物体透视成像、贴图、光照和阴影运算一气呵成。
光线追踪原理就是通过投射光线来模拟成像,所以对光影的模拟特别强。
限于速度,大量实时光线追踪演示程序都是由C++加OpenGL或Direct3D写的。
好在ActionScript3.0速度已经能勉强维持低分辨率的光线追踪效果。
目前能找到的基于flash的实时光线追踪演示有:
1.Strille的raytracer_f9(效果较好,比较复杂,未开源):
http://www.strille.net/works/as3/raytracer/raytracer_f9.swf
(注意拖动鼠标左键移动视角,滑轮可用来控制远近,方向键上下分别来控制分辨率高低)
2.Forrest Briggs的Real Time Ray Tracer in AS3(效果一般,比较简单,开源,为保证速度而进行优化导致代码可读性降低):
http://www.laserpirate.com/as3raytracer/
源代码下载:http://www.laserpirate.com/as3raytracer/RayTracer.as
3.非实时的ray-tracing早在flash-mx(flash-6)时代就出现了:
Strille: http://www.strille.net/works/raytracer.swf (有较多控制,可追加光源,球体,设置材质)
Ross Richardson:http://www.flashkit.com/movies/3D/Ray_Trac-Ross_Ric-9255/index.php (简单,开源)
Ross Richardson源代码下载:http://www.flashkit.com/downloads/movies/zip/9255/Ray%20Tracer%20v0.8.zip
最后,自己改写了一下Forrest Briggs的源码,增加了控制(方向键+空格+shift控制镜头),虚假贴图: (效果一般,速度降低,代码可读性更低)
效果见:https://flaswf.googlecode.com/svn/trunk/flaswfblog/old_homepage/raytracersmall.swf
此外,还写了一个基于flashplayer-10的,使用了新Vector3D类,去掉了优化,速度降至3~5fps,基本很难维持实时效果。
(这让我对flash-10的新特性大失所望,看看OpenGL和Direct3D,动辄上千的fps,那才叫硬件加速!)
注:由于ActionScript限制,复杂实时ray-tracing引擎是不现实的,如果放弃实时性,采用逐行扫描渲染,比较可行。
==============================
Recently I trying ray tracing in action script. Some ray tracer in flash I know is :
1.Strille’s raytracer_f9(nice effect, source not available ):http://www.strille.net/works/as3/raytracer/raytracer_f9.swf
2.Forrest Briggs’ Real Time Ray Tracer in AS3(simple but effective):http://www.laserpirate.com/as3raytracer/
source:http://www.laserpirate.com/as3raytracer/RayTracer.as
3.non real time ray-tracing in flash-mx(flash-6):
Strille:http://www.strille.net/works/raytracer.swf
(more controls, you can add light source, sphere, set texture)
Ross Richardson:
http://www.flashkit.com/movies/3D/Ray_Trac-Ross_Ric-9255/index.php (simple and open source)
Ross Richardson’s source:http://www.flashkit.com/downloads/movies/zip/9255/Ray%20Tracer%20v0.8.zip
I rewrite Forrest Briggs’s source and add some controls(arrow &space&shift key to move the camera)and fake textures.
demo:https://flaswf.googlecode.com/svn/trunk/flaswfblog/old_homepage/raytracersmall.swf
I also write one using the new Vector3D class for flash 10,but speed down to 3~5 fps! By the way, all above is mostly about Ray-tracing spheres so I also write one Ray-tracing triangle using Barycentric coordinate.
open source ray-tracing engine based on c++ http://www.devmaster.net/articles/raytracing_series/part1.php(C++source+toturial)
The Basics of Raytracing
http://www.devmaster.net/articles/raytracing/
Another Raytracing experiment based on Forrest Briggs's work:
http://unitcu.be/?p=1
ASTrace Raytracing Library (Open Source, AS3)
http://experimentalized.com/astrace.html
http://experimentalized.blogspot.com/2010/10/astrace-pre-release.html
Wednesday, August 20, 2008
3d slice engine in AS3.0
但这东西还是有一定优势,尤其在图片变形方面,不用三维模型,只用一张图片就可做出很好的三维效果,更重要的是原理和代码及其简单,有兴趣的可研究一下。
大家可以去http://www.arseiam.com/查看一些的3D作品。
自己用AS3.0改写了 http://www.arseiam.com/的一个有趣眼睛的小动画,其他作品原理代码都类似,这里算是抛砖引玉。
效果:https://flaswf.googlecode.com/svn/trunk/flaswfblog/old_homepage/geocities/song/song.htm
源码下载:http://flaswf.googlecode.com/files/slice_eye_v0.1.rar
不了解原理去http://www.arseiam.com/tuts/distort/distort.htm有一教程,很简单。
不懂英文?只看图片也就差不多明白了!
Ant Eden 的书
Flash 3D Cheats Most Wanted源码下载:
http://www.friendsofed.com/download.html?isbn=1590592212
(http://www.arseiam.com/)上几乎全部与3d slice engine有关的作品源码都包括了,不过是mx格式的。
==============================
Ant Eden designed the 3D slice engine long ago, which extends the concept by rotating and scaling the slices in flash mx.
It's a pity I got to know that wonderful engine only about one year ago.
I'm sorry to found that not many people are talking about 3d slice nowadays.
"We already have more powerful 3d engine why waste time on those out-of-data & less effective stuffs?"
But it's really powerful when you want to make a 2D image looks like 3D.
Check the work in http://www.arseiam.com/ .
I'm sure no other flash 3d engine can make those works in such an easy way.
I really like this simple and useful tools,It's easy to understand and use. So if you want to make an eye that can move, create a face looks like 3D without 3D modeling, or if you don't want to use some 3D engine too complicated for your to understand, I recommend you to try it.
Good things should never die, so here is one example in AS3.0. I rewrite the original mx code, please don't fool me for my dirty code.
My 3d slice eye in AS3.0, source here or you may want to check the result first.
If you know nothing about 3D slice. Here is a simple tutorial by Ant Eden.
you can still find the source code of the book
'Flash 3D Cheats Most Wanted'(flash mx)
here , include source files of most flash related to 3D slice engine you see in http://www.arseiam.com/
and finally, link to the old book:
"Flash 3D Cheats Most Wanted"
Read the book online: http://flylib.com/books/en/1.226.1.1/1/