Bill's profile这里是我博客的备份PhotosBlogLists Tools Help
Photo 1 of 12

这里是我博客的备份

msn space越来越丑 只好走

November 10

blogger再次被封之后的一些变通的办法

blogger再次被封之后的一些变通的办法

用代理,用tor,用pkblogs.com的老方式就不说了。最近发现beta.blogger的后台上不了了,这个是真正最要命的东西。后来看到好像封的是dns,在host文件中添加ip: 72.14.219.190 beta.blogger.com 就行了。
最近beta.blogger进行了更新,支持原来的ftp发布,这样就可以注册免费的ftp空间,将blogger的内容发布到ftp上去。有个免费的空间sitesled.com,好像有250兆大小,注册立即开通。可惜的是选择了发布到ftp之后,功能上受一定限制,只能用经典模版。
搞不懂为什么封杀blogspot.com,最近wordpress.com反而解禁了,geocity也解禁了,不知道是为什么。

关于中医的一点想法

关于中医的一点想法

一般有吐故纳新的机会,我都是个先锋人物,但是对于中医我还是很宽容的。
很早我就知道有人反对中医,说中医是伪科学。后来还听罗永浩讲,说同仁堂有一种药里面含有导致尿毒症之类的物质,卖了很多年,直到有人吃出了毛病。最近还有什么万人签名抵制中医。前些天更在论坛上读到,韩国要把中医改成了韩医申报世界遗产,虽然事后说明这是个炒作,但是我仍然觉得这是个搞笑的事情。我们自己对自己的文化遗产都不珍惜,反而要被别人抢了去。
反对中医的原因大概就在于“没有理论,基于经验”这几个字上。其实我觉得这也没什么,经验本身就是一种科学理论。世界上的事有多少能讲清楚为什么?试验本身就是一种科学的研究方法,爱迪生为了找到灯丝试验了多少材料?这和李时珍遍尝百草又有什么分别?牛顿力学定律算得上是有理论支撑吗?其实还不是牛顿一厢情愿的经验总结,苹果砸头得到的结论。到头来,还不是被别人证明在某些环境下并不适用。目前使用的理论就是解释万物的真理吗?自然也不是。
既然在科学上,人们并不苛求理论的完整,对于试验方式的探索也很宽容,那为什么对中医这么耿耿于怀呢?到底有没有人统计过死于中药的和死于吸烟的人数,到底应该先禁烟还是先禁中医?到底中医杀的人多还是救活的人多呢?中医让人稀里糊涂地活,西医让人明明白白地死,这话没错。
即便说中药可能有副作用,在盒子上面注明一下也就行了,决定权在于吃药的人。做什么事情没有风险?出门上街还可能被车撞死,难道就不出门了?让大家知道中药潜在的副作用就行了,吃与不吃是每个人的自由。
其实我倒是觉得,如果古代的中国能多一点中医的精神,近代艺术和科技上绝不至于落后西方国家。看看那些学究,一天到晚就知道死看书,一点动手的意识都没有。太缺乏中医的精神了。我实在不欣赏国画,也列不出什么近代发明创造,算起来混事的名号如何也轮不到中医啊。

鲁迅,立论

鲁迅,立论

网上找来鲁迅一篇小文,很有意思。
鲁迅:立论
  我梦见自己正在小学校的讲堂上预备作文,向老师请教立论的方法。
  “难!”老师从眼镜圈外斜射出眼光来,看着我,说:“我告诉你一件事——
  一家人家生了一个男孩,合家高兴透顶了。满月的时候,抱出来给客人看,——大概自然是想得一点好兆头。”
  “一个说:‘这孩子将来要发财的。’他于是得到一番感谢。
  “一个说:‘这孩子将来是要死的。’他于是得到一顿大家合力的痛打。
  “说要死的必然,说富贵的许谎。但说谎的得好报,说必然的遭打。你……”
  “我愿意既不说谎,也不遭打。那么,老师,我得怎么说呢?”
  “那么,你得说:‘啊呀!这孩子呵!您瞧!那么……。阿唷!哈哈!Hehe!he,he he he he!’”
                         一九二五年七月八日。

Displacement mapping简介

Displacement mapping简介


我很想把pillow做成像zbrush和mudbox那样的笔刷建模工具,因为这样的工具可以做出很逼真的细节。实现这个想法就要用到 displacement mapping。我习惯叫这个东西置换贴图,但是今天看到有人翻译成位移映射,似乎更准确。翻译一篇介绍,原文来自维基百科。
位移映射是同凹凸贴图,法线贴图,切线贴图相区别的另一种制造凹凸细节的技术,它使用一个高度贴图制造出几何物体表面上点的位置被替换到另一位置的效果。这种效果通常是让点的位置沿面法线移动一个贴图中定义的距离。它使得贴图具备了表现细节和深度的能力,且可以同时允许自我遮盖,自我投影和呈现边缘轮廓。而另一方面,这种技术是同类技术中消耗性能最大的,因为它需要额外的增加大量几何信息。
很多年来,位移映射是高端渲染器独有的功能,比如说 RenderMan,而那些实时的程序接口,比如说OpenGL和DirectX,则缺少对这个技术的支持。一个原因是,最初的实现方法需要对物体表面进行自适应细分来得到许多微小的面,这些面的尺寸投影到屏幕上刚好是一个像素的大小。
现在图形硬件已经支持Shader Model 3.0了,位移映射可以通过一种向量贴图的方式来实现,这个向量贴图并不像普通贴图那样改变物体表面的颜色,而是改变物体表面点的位置。它不像凹凸贴图,法线和切线贴图,因为这些技术都是在制造凹凸效果的假象,而位移应设是真正通过贴图的方式制造出凹凸的表面。它必须要配合细分算法,增加渲染的多边形数目来制造出细节的效果。

Brief of pillow in English

Brief of pillow in English

Pillow is a light weight application on which I' m working lately, the current aim is to make a simple modeller along the lines of commercial modeller silo. The project is at a very early stage implementing some basic modelling operations, such as "move", "rotate", "scale", "weld", "split" on objects and sub-objects like vertices, edges and faces, and also catmull-clark subdivision. Because pillow is under developing, there are problems, but it is still a good start point for me, 'cause as far as I know, lots of teams of identical applications take a long time to develop, normally in years, and pillow is only a 2-month job that I' m doing alone.
On history:
I got the idea of doing a modeller of myself in Oct 2004, at that time I was learning directx by myself, and I thought of actually making something to get familiar with the skills, so I decided to write this application. I set the silo modeller as my goal, for one thing, silo adapts a reasonable set of shortcut keys which I believe can speed up the progress of modelling, and also, silo is small in size. However, after I had the idea, I didn't have the time to concrete it until this summer, I got myself graduated. I have bunch of names for this application, first "cedar" and then "polygon studio" and "clayshop", and now I' m calling it "pillow".
On code:
Since I decided to practice directx with pillow, the first version is written with c# and managed directx. I also used a game engine called truevision3d, because functions like object-picking are out there already. But due to the huge data structures of game engine, the code's performance was very poor. So, then, I tried to code directly with directx. The current version is rewritten with c++ and opengl. The GUI library I use is wxwidget. I always care a lot about the user interface of my program. I don't think the appearance of products is of trifle. If the gorgeous design of apple computer was taken away, the company that never compatible with others would not survive in the market. However, I cannot find a good GUI library for my job, I need a cross platform, open source, skinable library with plenty of controls. While doing this application, I tried cegui, wxwidget, qt4, and picked up wxwidget finally.
The code is divided into 3 main layers, the ui layer undertakes the job of interacting with users, and displays the result of operations. The scene layer is in the middle, managing the 3d scene, converting the graphics operations to primitive operations on data structures. This part is actually the core of the whole program. The data structure is in the deepest layer which contains the data of the scene. The communication between the scene layer and the data layer is strictly defined as a set of commands; every command is tracked by a thing called history manager to enable users to restore at any time. As in the image, blue arrow is the flows of commands, the purple one is commands recording and the red ones are the data flows.
Currently, pillow doesn't support undo and redo. Although I already implement these operations, I didn't combine them with the ui. Because this part is easy to leak memory, I need to make sure other parts works fine before I add these functions.
when I was coding undo and redo part, I first thought of making commands, and every command has its inversion, and when I need to undo an operation, I simply call the inverse command. Yet, some operations, say calculating the average number, don't have commands in inversion. I could keep a record of the situation before the average happens, but this is a silly way. and then I thought up dividing the operations into layers, because no matter how complex a graphics command might be, it finally modifies the primitive data structures and the primitive operations on data structures can be simply defined as "new", "modify", "remove", so I only need to keep a record of these basic operations to hold the history of all the graphics operations. Actually, there are dozens of primitive operations defined in my code, more than just "new", "remove" and "modify".
So what is history manager? It is an undo queue and a redo stack, commands are pushed into the head of the queue, if they reach the end of the queue, and they are discarded. When the user wants to undo a step, a command will be popped and executed, at the same time, an inverse command be pushed into the redo stack. And if redo happens, just do everything in the backward.
How to prevent memory leak? My design is centralizing the management of all pointers; this is what I call data pool. It is actually a dynamic array to store pointers. Every function can use the data, but cannot new it or release it. There are two ways to release the data, first, if the remove operation needs to be recorded by the history manager, pass the pointer to the history manager, and as the record log is discarded by the history manager, the pointer is released. Second, if the operation does not need to be recorded, release it directly through the data pool. By adopting this, I can guarantee that, at any time, every data in the heap has at least one pointer stored in the data pool.
One more thing:
When I first showed people my idea of doing pillow, somebody asked what the unique feature of my polygon modeller is, since there are so many of them. I do want to do something special, but just before going creative, I need a base. And this is why I make pillow. I dreamed of making an application that combines the traditional sculpture progress with the cg making operations enabling people to create the shape more directly. I have already found some directions like the commercial software zbrush, mudbox and the teddy demo. So this is what I really wanna do in the future. Hope I can insist on doing this.
Some resources:
A tutorial on box modelling in pillow:
http://billconan.blogspot.com/2006/10/pillow-01a.html
A piece of flash showing how pillow works in action:
http://billconan.blogspot.com/2006/10/wink.html