柯內爾盒子 (Cornel Box)是普遍被拿來做全域照明測試的場景,1984年由柯內爾大學發展Radiosity演算法時所引進,自此之後,發展全域照明演算法的人們把柯內爾盒子當作測試標準。
我所實做的Progressive Radiosity是由Eric Chen所撰寫,它的演算法測試也用到柯內爾盒子,不過他發佈在網路上的程式碼並沒有繪圖這一部份,因此我將之修改為可在OpenGL上繪圖。
- 以下是我目前所能繪製的柯內爾盒子 (Cornel Box):
目標是將初始的Cornel Box逐漸Radiosity成全域照明。以下是我場景的資料:
Polygon個數: 18
Patch個數: 101
Element個數: 5740
Point個數: 6146
typedef struct { float x, y, z; } TPoint3f;
TPoint3f roomPoints[] = {
0, 0, 0,//0
216, 0, 0,
216, 0, 215,
0, 0, 215,
0, 221, 0,
216, 221, 0,//5
216, 221, 215,
0, 221, 215,
85.5, 220, 90,
130.5, 220, 90,
130.5, 220, 130,//10
85.5, 220, 130,
53.104, 0, 64.104,
109.36, 0, 96.604,
76.896, 0, 152.896,
20.604, 0, 120.396,//15
53.104, 65, 64.104,
109.36, 65, 96.604,
76.896, 65, 152.896,
20.604, 65, 120.396,
134.104, 0, 67.104,//20
190.396, 0, 99.604,
157.896, 0, 155.896,
101.604, 0, 123.396,
134.104, 130, 67.104,
190.396, 130, 99.604,//25
157.896, 130, 155.896,
101.604, 130, 123.396
};
typedef struct {
short verts[4]; /* vertices of the quadrilateral */
short patchLevel; /* patch subdivision level (how fine to subdivide the quadrilateral?) */
short elementLevel; /* element subdivision level (how fine to subdivide a patch?) */
float area; /* area of the quadrilateral */
TVector3f normal; /* normal of the quadrilateral */
TSpectra* reflectance; /* diffuse reflectance of the quadrilateral */
TSpectra* emission; /* emission of the quadrilateral */
} TQuad;
TQuad roomPolys[numberOfPolys] = {
{{4, 5, 6, 7}, 8, 8, 216*215, {0, -1, 0}, &lightGrey, &black}, /* ceiling */
{{0, 3, 2, 1}, 3, 8, 216*215, {0, 1, 0}, &lightGrey, &black}, /* floor */
{{0, 4, 7, 3}, 2, 8, 221*215, {1, 0, 0}, &red, &black}, /* wall */
{{0, 1, 5, 4}, 2, 8, 221*216, {0, 0, 1}, &green, &black}, /* wall */
{{2, 6, 5, 1}, 2, 8, 221*215, {-1, 0, 0}, &blue, &black}, /* wall */
{{8, 9, 10, 11}, 2, 1, 40*45, {0, -1, 0}, &black, &white}, /* light */
{{16, 19, 18, 17}, 1, 5, 65*65, {0, 1, 0}, &yellow, &black}, /* box 1 */
{{12, 13, 14, 15}, 1, 1, 65*65, {0, -1, 0}, &yellow, &black},
{{12, 15, 19, 16}, 1, 5, 65*65, {-0.866, 0, -0.5}, &yellow, &black},
{{12, 16, 17, 13}, 1, 5, 65*65, {0.5, 0, -0.866}, &yellow, &black},
{{14, 13, 17, 18}, 1, 5, 65*65, {0.866, 0, 0.5}, &yellow, &black},
{{14, 18, 19, 15}, 1, 5, 65*65, {-0.5, 0, 0.866}, &yellow, &black},
{{24, 27, 26, 25}, 1, 5, 65*65, {0, 1, 0}, &orange, &black}, /* box 2 */
{{20, 21, 22, 23}, 1, 1, 65*65, {0, -1, 0}, &orange, &black},
{{20, 23, 27, 24}, 1, 6, 65*130, {-0.866, 0, -0.5}, &orange, &black},
{{20, 24, 25, 21}, 1, 6, 65*130, {0.5, 0, -0.866}, &orange, &black},
{{22, 21, 25, 26}, 1, 6, 65*130, {0.866, 0, 0.5}, &orange, &black},
{{22, 26, 27, 23}, 1, 6, 65*130, {-0.5, 0, 0.866}, &orange, &black},
};




Comments on: "柯內爾盒子 (Cornel Box)" (1)
[…] 剛開始雖然知道場景是柯內爾盒子 (CORNEL BOX),然而我卻不知道各個點的相對位置,我使用MatLab將各點的座標給畫出來,只有單一角度可能看不出來此場景是在三維空間。 […]
讚讚