利用者:Brecht/RenderDesign

提供: wiki
< 利用者:Brecht
2009年8月30日 (日) 20:41時点におけるwiki>Brechtによる版
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

About

Here I'm gathering some ideas for high level design of the render engine. What I'm discussing here is not very far from the existing code, but there are no clear separations between the various parts in the code. Shuffling things around a bit and making the interfaces and functionality of various modules clear should help bring out the design better and show how it can be extended.

Interfaces

This is an overview of some interfaces, very simplified to give an idea of what they do. In practice these would be bigger, but listing those things would obscure the intention.

Engine

render(scene, result)

This corresponds to the render API. This design is only about the Blender render engine, and in particular the part that does the actual rendering. Compositing, sequencer, fields, etc sit at a higher level and may call render(scene, result) repeatedly.

DataBase

camera
geometry
lights
materials
textures

raytree
pointclouds
shadowbuffers
...

Result

layers
	passes
		pixels

Camera

pos, dir = sample(x, y)
x, y = project(pos)

ShadeInput

material
geom
p, dp/dxyz
view
uv, duv/dxyz
..

ShadeOutput

mask
passes
	col

Material

col = bxdf(di|sp|tr|em, dir)
dir = bxdf_sample(di|sp|tr|em)
shade(shi, shr)

Various types of these may be BlenderMaterial, NodeMaterial, SLMaterial. What the right interface is, that's still unclear to me, because of the passive materials vs. active shaders, so both interfaces are here now.

Integrator

Not sure how this fits yet, is for example z-buffering part of an integrator? That seems kind of strange, but on the other hand an mlt integrator may want to sample the camera and so have full control over which pixel gets written to when. Also closely related to how a material is defined.

Texture

col = sample(p, dp/dxyz)

Environment

col = sample(dir, ddir/dxyz)

Geometry

rasterize(buffer)
shi = shi_from_raster(id)

raytree_insert(raytree)
shi = shi_from_ray(id)

geom = split_dice()

Examples: MeshGeometry, StrandGeometry, VolumeGeometry.

Light

i = intensity(pos)
lpos = sample()

RayTree

build(geomlist)
id = intersect(ray)

PointCloud

build(geomlist)
col = lookup(pos, nor)

This would be for AAO, SSS or other things that need it.

ShadowBuffer

build(geomlist)
i = intensity(pos)