Skip to content

Commit

Permalink
lab1 content
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyaoing committed Mar 18, 2023
1 parent 6322773 commit bd510d1
Show file tree
Hide file tree
Showing 30 changed files with 2,684 additions and 71 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
.cache
/target
/scenes
.vscode
/examples/acceleration-test
/cmake-build-debug
/cmake-build-release
.idea
.vscode
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ add_executable(Moer
src/ResourceLayer/Image.cpp
src/ResourceLayer/Mesh.cpp
src/ResourceLayer/FileUtil.cpp
)
src/FunctionLayer/Shape/Disk.cpp src/FunctionLayer/Shape/Disk.h src/FunctionLayer/Shape/Cone.cpp src/FunctionLayer/Shape/Cone.h src/FunctionLayer/Shape/Cylinder.cpp src/FunctionLayer/Shape/Cylinder.h src/FunctionLayer/Integrator/UVIntegrator.cpp src/FunctionLayer/Integrator/UVIntegrator.h src/FunctionLayer/Acceleration/BVH.cpp src/FunctionLayer/Acceleration/BVH.h)

target_include_directories(Moer PUBLIC ./externals)
target_include_directories(Moer PUBLIC ./src)
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ Moer-lite的框架基于Moer主干:https://github.com/NJUCG/Moer .
- 修改了Acceleration求交的接口,现在每个加速结构需要实现bool Acceleration::rayIntersect(Ray &ray, int *geomID, int *primID, float *u, float *v) const函数
- 2023-3-11
- 增加了Octree八叉树,实现八叉树需要你实现以下两个方法
- std::shared_ptr<OctreeNode> OctreeAcceleration::recursiveBuild
- bool OctreeAcceleration::rayIntersect
- std::shared_ptr<OctreeNode> Octree::recursiveBuild
- bool Octree::rayIntersect
- 增加了`examples/lab1-test0`测试场景,用于测试加速结构的效率
- 目前可以修改配置文件中scene的acceleration参数用来测试不同的加速结构,现在可选的参数有`embree`(default)、`linear`(没有任何求交加速)、`octree`(需要实现)
- 2023-3-18
lab1有关内容更新 具体请看实验手册

## TODO
- 对mesh和sphere实现表面采样(目前只有parallelogram可以配置为面光源)
Expand Down
File renamed without changes.
49 changes: 49 additions & 0 deletions examples/lab1-test/lab1-test-bvh/scene.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"output" : {
"filename" : "monkey-bvh.png"
},
"sampler" : {
"type" : "independent",
"xSamples" : 1,
"ySamples" : 1
},
"camera" : {
"type" : "pinhole",
"transform" : {
"position" : [0, 1, 5],
"up" : [0, 1, 0],
"lookAt" : [0, 0, 0]
},
"tNear" : 0.1,
"tFar" : 10000,
"verticalFov" : 45,
"timeStart" : 0,
"timeEnd" : 0,
"film" : {
"size" : [1200, 800]
}
},
"integrator" : {
"type" : "normal"
},
"scene" : {
"acceleration" : "bvh",
"shapes" : [
{
"type" : "triangle",
"file" : "models/Monkey.obj",
"material" : {
"type": "matte",
"albedo": [
0.8,
0.8,
0.8
]
}
}
],
"lights" : [

]
}
}
68 changes: 68 additions & 0 deletions examples/lab1-test/lab1-test-cone/scene.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"output" : {
"filename" : "cone-normal.png"
},
"sampler" : {
"type" : "independent",
"xSamples" : 1,
"ySamples" : 1
},
"camera" : {
"type" : "pinhole",
"transform" : {
"position" : [0, 1, 4],
"up" : [0, 1, 0],
"lookAt" : [0, 1, 0]
},
"tNear" : 0.1,
"tFar" : 10000,
"verticalFov" : 45,
"timeStart" : 0,
"timeEnd" : 0,
"film" : {
"size" : [600, 400]
}
},
"integrator" : {
"type" : "normal"
},
"scene" : {
"shapes" : [
{
"type": "cone",
"radius": 0.5,
"transform": {
"translate": [-1,1,0],
"rotate" : {
"axis" : [0,0,1],
"radian" : 1
}
}},
{
"type": "cone",
"radius": 1,
"phi_max" : 3,
"transform": {
"translate": [1,0,0],
"rotate" : {
"axis" : [0,1,0],
"radian" : 1
}
}
},{
"type": "cone",
"radius": 1,
"phi_max" : 5,
"transform": {
"translate": [1,1,0],
"rotate" : {
"axis" : [1,0,0],
"radian" : 3.14
}
}
}
],
"lights" : [
]
}
}
68 changes: 68 additions & 0 deletions examples/lab1-test/lab1-test-cylinder/scene.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"output" : {
"filename" : "cylinder-normal.png"
},
"sampler" : {
"type" : "independent",
"xSamples" : 1,
"ySamples" : 1
},
"camera" : {
"type" : "pinhole",
"transform" : {
"position" : [0, 1, 4],
"up" : [0, 1, 0],
"lookAt" : [0, 1, 0]
},
"tNear" : 0.1,
"tFar" : 10000,
"verticalFov" : 45,
"timeStart" : 0,
"timeEnd" : 0,
"film" : {
"size" : [600, 400]
}
},
"integrator" : {
"type" : "normal"
},
"scene" : {
"shapes" : [
{
"type": "cylinder",
"radius": 0.5,
"transform": {
"translate": [-1,1,0],
"rotate" : {
"axis" : [0,0,1],
"radian" : 3.14
}
}},
{
"type": "cylinder",
"radius": 1,
"phi_max" : 3,
"transform": {
"translate": [1,0,0],
"rotate" : {
"axis" : [0,1,0],
"radian" : 1
}
}
},{
"type": "cylinder",
"radius": 1,
"phi_max" : 5,
"transform": {
"translate": [1,1,0],
"rotate" : {
"axis" : [1,0,0],
"radian" : 3.14
}
}
}
],
"lights" : [
]
}
}
71 changes: 71 additions & 0 deletions examples/lab1-test/lab1-test-disk/scene.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"output" : {
"filename" : "disk-normal.png"
},
"sampler" : {
"type" : "independent",
"xSamples" : 1,
"ySamples" : 1
},
"camera" : {
"type" : "pinhole",
"transform" : {
"position" : [0, 1, 4],
"up" : [0, 1, 0],
"lookAt" : [0, 1, 0]
},
"tNear" : 0.1,
"tFar" : 10000,
"verticalFov" : 45,
"timeStart" : 0,
"timeEnd" : 0,
"film" : {
"size" : [600, 400]
}
},
"integrator" : {
"type" : "normal"
},
"scene" : {
"shapes" : [
{
"type": "disk",
"radius": 0.5,
"transform": {
"translate": [-1,1,0],
"rotate" : {
"axis" : [0,0,1],
"radian" : 3.14
}
}},
{
"type": "disk",
"radius": 1,
"inner_radius" : 0.5,
"phi_max" : 3,
"transform": {
"translate": [1,0,0],
"rotate" : {
"axis" : [0,1,0],
"radian" : 1
}
}
},{
"type": "disk",
"radius": 1,
"inner_radius" : 0.7,
"phi_max" : 5,
"transform": {
"translate": [1,1,0],
"rotate" : {
"axis" : [1,0,0],
"radian" : 3.14
},
"scale" : [2,2,2]
}
}
],
"lights" : [
]
}
}
Loading

0 comments on commit bd510d1

Please sign in to comment.