2011年1月23日星期日

有些图案是artist随性的创作,有些是规律的,当中有对称的有pattern的,前者我做不了啦,后者倒是可以学学。
下面是这两天收集的blogs.
------
http://www.subblue.com/blog 上面很多用Pixel Bender做的fractal的效果, 他甚至"The images were rendered using a new fractal renderer I'm working on in Pixel Bender. I'll be releasing it once I'm happy with the final script."
然后好奇地查了一下:

Adobe Pixel Bender Tookit 我理解为是Image Processing工具.
Adobe Pixel Bender is a programming language that is used to create or manipulate image content. Using Pixel Bender you create a kernel, also known in this document as a shader. The shader defines a single function that executes on each of the pixels of an image individually.
In Flash Player and Adobe AIR, three types of effects can be easily created using a shader: drawing fill, blend mode, filter.
Note: Pixel Bender support is available starting in Flash Player 10 and Adobe AIR 1.5.

ActionScript is the programming language for the Adobe Flash Player and Adobe AIR run-time environments. It enables interactivity, data handling, and much more in Flash, Flex, and AIR content and applications.

他多次提到用了这里的技术http://iquilezles.org/www/, http://iquilezles.org/www/articles/mandelbulb/mandelbulb.htm, http://iquilezles.org/www/articles/ssao/ssao.htm, 原来还有http://iquilezles.org/prods/index.htm

还提到一个不错的forum, http://www.fractalforums.com/3d-fractal-generation/true-3d-mandlebrot-type-fractal.
-----------------
另一blog
http://blog.hvidtfeldts.net/index.php/2007/05/
他的作品http://structuresynth.sourceforge.net/ Structure Synth is a cross-platform application for generating 3D structures by specifying a design grammar. Even simple systems may generate surprising and complex structures. The design grammar approach was originally devised by Chris Coyne (for a 2D implementation see the popular Context Free Art).
用语法grammar生成模型结构.
http://www.contextfreeart.org/ Context Free is a program that generates images from written instructions called a grammar. The program follows the instructions in a few seconds to create images that can contain millions of shapes.

Context Free提到了用Anti-Grain Geometry(AGG)来做底层的2D graphics library. 原来AGG是很有名的2D rendering engine http://www.antigrain.com/about/index.html,Qt的2D Raster Engine在实现时候也考虑过AGG(http://labs.qt.nokia.com/2009/12/18/qt-graphics-and-performance-the-raster-engine/). AGG只是software rendering, 没有用到GL-based acceleration.

Cairo is a 2D graphics library with support for multiple output devices (貌似也叫back ends). Currently supported output targets include the X Window System, Quartz, Win32, image buffers, PostScript, PDF, and SVG file output. Experimental backends include OpenGL, XCB, BeOS, OS/2, and DirectFB, 还有Qt等.

Skia is a complete 2D graphic library for drawing Text, Geometries, and Images. 3x3 matrices w/ perspective;antialiasing, transparency, filters;shaders, xfermodes, maskfilters, patheffects.
New backend for GPUs: There is a new library, sitting along side skia. Next to src/ and include/ is gpu/. This stand-along library is an abstraction for drawing 2D primitives to a GPU. GrContext.h is the header you should read first. Skia can use this to redirect 100% of its drawing to the GPU, via subclasses in src/gpu. SkGpuCanvas and SkGpuDevice.
------
http://processing.org/ 貌似是一种很popular的create images, animations, and interactions的open source programming language. 是基于Java的,文档倒是很清晰.
还有几本本评价很高books,其一是:
Processing: A Programming Handbook for Visual Designers and Artists [Hardcover].

------

先学习一些math and formula, 生成一些经典的shape and fractal, 2D的话考虑用AGG/Cairo/Skia/Qt等来render比较方便, 3D的话当然需要用OpenGL来render.

2011年1月21日星期五

the main theme of this stage is bug fixing for me, but still sth can be learned from:
其中左边是一个(0,0) to (1,1)的方形square, 右边是一个(1,0) to (2,1)的方形square, 怎么判断三角形是在其中一个square里面,而不是跨过了两个squares呢,像那个红色的三角形? 运行三角形triangle刚好接触到两边界, 如那个大的green三角形.
下面只看横方向的坐标,纵向的Yaxis也类似:
bool isCrossSquare = (int)start.x != (int)end.x; 错的. 因为int是四舍五入, int(-0.2) = 0. bool isCrossSquare = floor(start.x) != floor(end.x); 对的.
当然还得考虑特殊情况,像上面的大绿色三角形:
floor(start.x) = 0, floor(end.x) = 1, 但end.x == floor(end.x)表示右边压界,所以例外。
还得考虑横跨了两个square并刚好压界.
完整的判断是:
bool isCrossSquare = (floor(start.x) != floor(end.x) && end.x != floor(end.x)) || (end.x - start.x > 1);
其中一个应用实例是判断uv layout有没有超出范围.

2011年1月20日星期四

今天有看到box filter这名词了, ptex的paper中提到用box filter做symmetric reductions of each texture(also use asymmetric reduction for anisotropic filtering), 于是又想回顾一下这些概念.

什么是filter (filter kernel)? hint: a pattern.
什么是convolution? 什么是image filtering?

Box filter这里的box好像是指这个filter的形状shape, 例如3*3, 而像Bicubic filter这filter的shape在一维来看是曲线,二维来看估计是圆形. (可能用box filter来跟bicubic filter来做比较不是十分合适,我的理解中box filter好像是指一类filter,只要它们的shape都是rectangle, 而bicubic filter好像是特地的一种, 但又可能不是,因为bicubic函数系数不一样得到的curve是不一样的?)

Box filter是系数都是positive, 于是起到的是模糊smooth的效果,而Bicubic filter的系数weight中山有negative的,于是能起到a slight sharpening effect.

在GPU中实现时候为了避免bicubic的计算,可以用look-up table的方法(在CPU中建float-precision texture). 具体看[1].
Reference:

下面是对box filter和bilinear filter的感性区别, box filter是求中间11号texel时候用包括自身在内的9个texel做平均(也可以理解为系数固定的线插interpolation), 而bilinear filter是图片放大or缩小or大小不变但是错位时候求自身texel时候对最近的4个做线插, 线插的系数跟自身texel离那4个texels的距离有关, bilinear filter常见于OpenGL (or GPU hardware) interpolation(texture filtering), 例如在magnification情况下一个texel占了多个pixels, 那每一pixel的color就找最近的4个Texels用bilinear interpolation,这类似于把image缩小,小的image的一个texel相当于在大的image的多个texel的线插.

2011年1月18日星期二

Motorcycle Graphs: Canonical Quad Mesh Partitioning.(摩托车图: 标准的四边形网格剖分:-)
A mesh is structured if it has no extraordinary vertices, and unstructured otherwise. The main subjects of this paper are structured partitions in which the quadrilaterals of a mesh (semi-regular mesh) are partitioned into a small number of structured submeshes.

Extraordinary vertices都是作为分界点, 假如user先选择两个extraordinary vertices然后连在一起,是不是会加快计算呢?

These are examples and resources about renderer:

Ray Tracing:
YafaRay: .
LuxRender: original based on PBRT in 2007.

Physically Based Rendering, Second Edition: From Theory To Implementation by Matt Pharr.

RenderMan compliant renderers:
Pixar RenderMan(PRman): RiSpec, the RenderMan Interface Specification. It is built around the REYES algorithm. The popular shading language is RSL developed by Pixar. OSL released by Sony is another story(check the OpenImageIO too).
Aqsis: Open source 3D solution adhering to the RenderMan interface standard by Pixar Animation Studios.
Pixie, a bit like a dead project since 2005.
3Delight, 6 months of free license.
From this pic, RenderMan is just an API to communicate with renderers(RenderMan is not a renderer, it is an interface description. But often renderman is used as a synonym for the render PRman itself). There are two main parts of RenderMan: 3D scene description language(.rib, RenderMan Interface Bytestream), and Programable shading language(.sl). Introduction to PRman.



2011年1月17日星期一

These are some of the papers and resources related to virtual texturing:


google: a sparse voxel octree data structure

Efficient sparse voxel octrees, NVIDA在google code上提供cuda实现.

Andreas Neu, Bachelor Thesis, Virtual Texturing, April 2010;
Albert Julian Mayer, Vertual Texturing, http://www.cg.tuwien.ac.at/research/publications/2010/Mayer-2010-VT/Mayer-2010-VT-Paper.pdf;