└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # Graphics-project 2 | ——复旦大学2023年春《计算机图形学》课程项目 3 | Computer Graphics Course (COMP130018.01, 2023 Spring) Project of Fudan University. 4 | A copy of MIT 6.837, including Curves-surfaces(assn1) and Ray-casting-tracing(assn4, assn5). 5 | ## Project1--曲线和曲面造型技术 6 | 分支切换 7 | 8 | ```bash 9 | git checkout Curves-surfaces 10 | ``` 11 | 12 | 环境搭建(linux) 13 | 14 | ```bash 15 | sudo apt-get install build-essential cmake 16 | sudo apt-get install freeglut3-dev xorg-dev libxrandr-dev libsdl2-de 17 | ``` 18 | 编译运行 19 | ```bash 20 | mkdir build 21 | cd build 22 | cmake .. 23 | ``` 24 | ```bash 25 | make 26 | cd .. 27 | build/a1 ./swp/circles.swp 28 | ``` 29 | 样例结果查看 30 | ```bash 31 | chmod a+x sample_solution/athena/a1 32 | sample_solution/athena/a1 swp/core.swp 33 | ``` 34 | ### Part1--曲线的绘制 35 | 测试: 36 | ```bash 37 | build/a1 ./swp/core.swp 38 | ``` 39 | 40 | ### Part2--曲面的绘制 41 | 测试: 42 | ```bash 43 | build/a1 ./swp/wineglass.swp 44 | ``` 45 | ```bash 46 | build/a1 ./swp/weird.swp 47 | ``` 48 | ### Expansion--曲面的闭合问题 49 | 测试: 50 | ```bash 51 | build/a1 ./swp/weirder.swp 52 | ``` 53 | 54 | 55 | ## Project--2 光照模型与光线追踪 56 | 57 | 分支切换 58 | 59 | ```bash 60 | git checkout Ray-casting-tracing 61 | ``` 62 | 63 | 环境搭建(linux) 64 | 65 | ```bash 66 | sudo apt-get install build-essential cmake 67 | sudo apt-get install freeglut3-dev xorg-dev libxrandr-dev libsdl2-de 68 | ``` 69 | 编译运行 70 | ```bash 71 | mkdir build 72 | cd build 73 | cmake .. 74 | ``` 75 | ```bash 76 | make 77 | cd .. 78 | //结果图片将保存到`test_out`文件夹下 79 | build/a2 -input data/scene01_plane.txt -output test_out/01.png -size 200 200 80 | ``` 81 | 样例结果查看(结果图片将保存到`sample_out`文件夹下) 82 | ```bash 83 | chmod u+x sample_solution/athena/a2 84 | sample_solution/athena/a2 -input data/scene01_plane.txt -output sample_out/01.png -size 200 200 85 | sample_solution/athena/a2 -input data/scene06_bunny_1k.txt -output sample_out/06.png -size 300 300 -bounces 4 86 | sample_solution/athena/a2 -input data/scene07_arch.txt -output sample_out/07.png -size 300 300 -shadows -bounces 4 87 | ``` 88 | 批量生成图片并测试 89 | 90 | ```bash 91 | chmod +x generate_images.sh 92 | ./generate_images.sh 93 | ``` 94 | 95 | ```bash 96 | chmod +x test_cases.sh 97 | ./test_cases.sh 98 | ``` 99 | 100 | 101 | 102 | ### Part1--Phong光照模型 103 | 104 | 测试: 105 | ```bash 106 | build/a2 -size 800 800 -input data/scene01_plane.txt -output test_out/a01.png -normals test_out/a01n.png -depth 8 18 test_out/a01d.png 107 | ``` 108 | 109 | ### Part2--光线投射 110 | 测试: 111 | ```bash 112 | build/a2 -size 800 800 -input data/scene01_plane.txt -output test_out/b01.png -normals test_out/b01n.png -depth 8 18 test_out/b01d.png 113 | ``` 114 | ```bash 115 | build/a2 -size 800 800 -input data/scene02_cube.txt -output test_out/a02.png -normals test_out/a02n.png -depth 8 18 test_out/a02d.png 116 | ``` 117 | ```bash 118 | build/a2 -size 800 800 -input data/scene03_sphere.txt -output test_out/a03.png -normals test_out/a03n.png -depth 8 18 test_out/a03d.png 119 | build/a2 -size 800 800 -input data/scene04_axes.txt -output test_out/a04.png -normals test_out/a04n.png -depth 8 18 test_out/a04d.png 120 | build/a2 -size 800 800 -input data/scene05_bunny_200.txt -output test_out/a05.png -normals test_out/a05n.png -depth 0.8 1.0 test_out/a05d.png 121 | ``` 122 | ### Part3--光线追踪与阴影投射 123 | ```bash 124 | build/a2 -size 800 800 -input data/scene02_cube.txt -output test_out/b02.png -normals test_out/b02n.png -depth 8 18 test_out/b02d.png 125 | build/a2 -size 800 800 -input data/scene05_bunny_200.txt -output test_out/b05.png -normals test_out/b05n.png -depth 0.8 1.0 test_out/b05d.png 126 | ``` 127 | ```bash 128 | build/a2 -size 800 800 -input data/scene06_bunny_1k.txt -bounces 4 -output test_out/a06.png -normals test_out/a06n.png -depth 8 18 test_out/a06d.png 129 | build/a2 -size 800 800 -input data/scene07_arch.txt -bounces 4 -shadows -output test_out/a07.png -normals test_out/a07n.png -depth 8 18 test_out/a07d.png 130 | ``` 131 | 132 | 133 | ### Expansion-- 抗锯齿的问题 134 | 135 | 测试: 136 | ```bash 137 | build/a2 -size 200 200 -input data/scene01_plane.txt -output test_out/c01.png -normals test_out/c01n.png -depth 8 18 test_out/c01d.png -jitter -filter 138 | ``` 139 | 140 | 141 | 142 | ——具体内容详见各分支的README中的实验报告部分 143 | --------------------------------------------------------------------------------