~ | Fog parameter set to int

This commit is contained in:
RedShip
2025-01-15 19:05:53 +01:00
parent 159a0caf72
commit 2097a71090
7 changed files with 340 additions and 326 deletions

16
imgui.ini Normal file
View File

@ -0,0 +1,16 @@
[Window][Debug##Default]
Pos=60,60
Size=400,400
[Window][Camera]
Pos=60,60
Size=128,184
[Window][Material]
Pos=1561,418
Size=266,285
[Window][Fog settings]
Pos=1583,141
Size=251,265

View File

@ -6,7 +6,7 @@
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */ /* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/23 18:30:18 by ycontre #+# #+# */ /* Created: 2024/12/23 18:30:18 by ycontre #+# #+# */
/* Updated: 2025/01/10 18:58:38 by ycontre ### ########.fr */ /* Updated: 2025/01/15 18:58:12 by ycontre ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -51,7 +51,7 @@ struct GPUVolume
float g; float g;
bool enabled; int enabled;
}; };
class Sphere; class Sphere;

View File

@ -987,318 +987,318 @@ vt 0.65883 0.412179
vt 0.544646 0.412179 vt 0.544646 0.412179
vt 0.715921 0.408093 vt 0.715921 0.408093
vt 0.487555 0.408093 vt 0.487555 0.408093
mtllib Lowpoly_tree_sample.mtl mtllib obj/Lowpoly_tree_sample.mtl
usemtl Bark usemtl Bark
f 7/1/1 8/2/1 14/3/1 13/4/1 f 7 8 14 13
f 9/5/2 15/6/2 14/3/2 8/2/2 f 9 15 14 8
f 10/7/3 16/8/3 15/6/3 9/5/3 f 10 16 15 9
f 11/9/4 17/10/4 16/8/4 10/7/4 f 11 17 16 10
f 11/9/5 12/11/5 18/12/5 17/10/5 f 11 12 18 17
f 12/11/6 7/13/6 13/14/6 18/12/6 f 12 7 13 18
f 13/4/7 14/3/7 20/15/7 19/16/7 f 13 14 20 19
f 21/17/8 20/15/8 14/3/8 15/6/8 f 21 20 14 15
f 16/8/9 22/18/9 21/17/9 15/6/9 f 16 22 21 15
f 16/8/10 17/10/10 23/19/10 22/18/10 f 16 17 23 22
f 17/10/11 18/12/11 24/20/11 23/19/11 f 17 18 24 23
f 18/12/12 13/14/12 19/21/12 24/20/12 f 18 13 19 24
f 20/15/13 26/22/13 25/23/13 19/16/13 f 20 26 25 19
f 21/17/14 27/24/14 26/22/14 20/15/14 f 21 27 26 20
f 21/17/15 22/18/15 28/25/15 27/24/15 f 21 22 28 27
f 22/18/16 23/19/16 29/26/16 28/25/16 f 22 23 29 28
f 24/20/17 30/27/17 29/26/17 23/19/17 f 24 30 29 23
f 24/20/18 19/21/18 25/28/18 30/27/18 f 24 19 25 30
f 26/22/19 32/29/19 31/30/19 25/23/19 f 26 32 31 25
f 26/22/20 27/24/20 33/31/20 32/29/20 f 26 27 33 32
f 28/25/21 34/32/21 33/31/21 27/24/21 f 28 34 33 27
f 29/26/22 35/33/22 34/32/22 28/25/22 f 29 35 34 28
f 29/26/23 30/27/23 36/34/23 35/33/23 f 29 30 36 35
f 30/27/24 25/28/24 31/35/24 36/34/24 f 30 25 31 36
f 31/30/25 32/29/25 38/36/25 37/37/25 f 31 32 38 37
f 33/31/26 39/38/26 38/36/26 32/29/26 f 33 39 38 32
f 34/32/27 40/39/27 39/38/27 33/31/27 f 34 40 39 33
f 35/33/28 41/40/28 40/39/28 34/32/28 f 35 41 40 34
f 36/34/29 42/41/29 41/40/29 35/33/29 f 36 42 41 35
f 36/34/30 31/35/30 37/42/30 42/41/30 f 36 31 37 42
f 37/37/31 38/36/31 44/43/31 43/44/31 f 37 38 44 43
f 38/36/32 39/38/32 45/45/32 44/43/32 f 38 39 45 44
f 39/38/33 40/39/33 46/46/33 45/45/33 f 39 40 46 45
f 40/39/34 41/40/34 47/47/34 46/46/34 f 40 41 47 46
f 42/41/35 48/48/35 47/47/35 41/40/35 f 42 48 47 41
f 37/42/36 43/49/36 48/48/36 42/41/36 f 37 43 48 42
f 50/50/37 56/51/37 55/52/37 49/53/37 f 50 56 55 49
f 50/50/38 51/54/38 57/55/38 56/51/38 f 50 51 57 56
f 51/54/39 52/56/39 58/57/39 57/55/39 f 51 52 58 57
f 52/56/40 53/58/40 59/59/40 58/57/40 f 52 53 59 58
f 54/60/41 60/61/41 59/59/41 53/58/41 f 54 60 59 53
f 49/62/42 55/63/42 60/61/42 54/60/42 f 49 55 60 54
f 62/64/43 61/65/43 55/52/43 56/51/43 f 62 61 55 56
f 57/55/44 63/66/44 62/64/44 56/51/44 f 57 63 62 56
f 63/66/45 57/55/45 58/57/45 64/67/45 f 63 57 58 64
f 64/67/46 58/57/46 59/59/46 65/68/46 f 64 58 59 65
f 60/61/47 66/69/47 65/68/47 59/59/47 f 60 66 65 59
f 55/63/48 61/70/48 66/69/48 60/61/48 f 55 61 66 60
f 62/64/49 68/71/49 67/72/49 61/65/49 f 62 68 67 61
f 63/66/50 69/73/50 68/71/50 62/64/50 f 63 69 68 62
f 63/66/51 64/67/51 70/74/51 69/73/51 f 63 64 70 69
f 64/67/52 65/68/52 71/75/52 70/74/52 f 64 65 71 70
f 66/69/53 72/76/53 71/75/53 65/68/53 f 66 72 71 65
f 66/69/54 61/70/54 67/77/54 72/76/54 f 66 61 67 72
f 73/78/55 67/72/55 68/71/55 74/79/55 f 73 67 68 74
f 68/71/56 69/73/56 75/80/56 74/79/56 f 68 69 75 74
f 70/74/57 76/81/57 75/80/57 69/73/57 f 70 76 75 69
f 77/82/58 76/81/58 70/74/58 71/75/58 f 77 76 70 71
f 71/75/59 72/76/59 78/83/59 77/82/59 f 71 72 78 77
f 72/76/60 67/77/60 73/84/60 78/83/60 f 72 67 73 78
f 82/85/61 81/86/61 79/87/61 80/88/61 f 82 81 79 80
f 82/85/62 84/89/62 83/90/62 81/86/62 f 82 84 83 81
f 84/89/63 86/91/63 85/92/63 83/90/63 f 84 86 85 83
f 80/93/64 79/94/64 85/92/64 86/91/64 f 80 79 85 86
f 92/95/65 96/96/65 95/97/65 91/98/65 f 92 96 95 91
f 92/95/66 93/99/66 97/100/66 96/96/66 f 92 93 97 96
f 94/101/67 98/102/67 97/100/67 93/99/67 f 94 98 97 93
f 91/103/68 95/104/68 98/102/68 94/101/68 f 91 95 98 94
f 96/96/69 100/105/69 99/106/69 95/97/69 f 96 100 99 95
f 96/96/70 97/100/70 101/107/70 100/105/70 f 96 97 101 100
f 97/100/71 98/102/71 102/108/71 101/107/71 f 97 98 102 101
f 95/104/72 99/109/72 102/108/72 98/102/72 f 95 99 102 98
f 106/110/73 105/111/73 103/112/73 104/113/73 f 106 105 103 104
f 108/114/74 107/115/74 105/111/74 106/110/74 f 108 107 105 106
f 108/114/75 110/116/75 109/117/75 107/115/75 f 108 110 109 107
f 110/116/76 104/118/76 103/119/76 109/117/76 f 110 104 103 109
f 111/120/77 112/121/77 116/122/77 115/123/77 f 111 112 116 115
f 112/121/78 113/124/78 117/125/78 116/122/78 f 112 113 117 116
f 114/126/79 118/127/79 117/125/79 113/124/79 f 114 118 117 113
f 114/126/80 111/128/80 115/129/80 118/127/80 f 114 111 115 118
f 115/123/81 116/122/81 120/130/81 119/131/81 f 115 116 120 119
f 117/125/82 121/132/82 120/130/82 116/122/82 f 117 121 120 116
f 117/125/83 118/127/83 122/133/83 121/132/83 f 117 118 122 121
f 118/127/84 115/129/84 119/134/84 122/133/84 f 118 115 119 122
f 124/135/85 123/136/85 119/131/85 120/130/85 f 124 123 119 120
f 125/137/86 124/135/86 120/130/86 121/132/86 f 125 124 120 121
f 125/137/87 121/132/87 122/133/87 126/138/87 f 125 121 122 126
f 126/138/88 122/133/88 119/134/88 123/139/88 f 126 122 119 123
f 123/136/89 124/135/89 128/140/89 127/141/89 f 123 124 128 127
f 125/137/90 129/142/90 128/140/90 124/135/90 f 125 129 128 124
f 129/142/91 125/137/91 126/138/91 130/143/91 f 129 125 126 130
f 127/144/92 130/143/92 126/138/92 123/139/92 f 127 130 126 123
f 127/141/93 128/140/93 132/145/93 131/146/93 f 127 128 132 131
f 129/142/94 133/147/94 132/145/94 128/140/94 f 129 133 132 128
f 130/143/95 134/148/95 133/147/95 129/142/95 f 130 134 133 129
f 127/144/96 131/149/96 134/148/96 130/143/96 f 127 131 134 130
f 135/150/97 136/151/97 140/152/97 139/153/97 f 135 136 140 139
f 136/151/98 137/154/98 141/155/98 140/152/98 f 136 137 141 140
f 138/156/99 142/157/99 141/155/99 137/154/99 f 138 142 141 137
f 138/156/100 135/158/100 139/159/100 142/157/100 f 138 135 139 142
f 139/153/101 140/152/101 144/160/101 143/161/101 f 139 140 144 143
f 141/155/102 145/162/102 144/160/102 140/152/102 f 141 145 144 140
f 141/155/103 142/157/103 146/163/103 145/162/103 f 141 142 146 145
f 142/157/104 139/159/104 143/164/104 146/163/104 f 142 139 143 146
f 144/160/105 148/165/105 147/166/105 143/161/105 f 144 148 147 143
f 145/162/106 149/167/106 148/165/106 144/160/106 f 145 149 148 144
f 145/162/107 146/163/107 150/168/107 149/167/107 f 145 146 150 149
f 146/163/108 143/164/108 147/169/108 150/168/108 f 146 143 147 150
f 152/170/109 151/171/109 147/166/109 148/165/109 f 152 151 147 148
f 153/172/110 152/170/110 148/165/110 149/167/110 f 153 152 148 149
f 153/172/111 149/167/111 150/168/111 154/173/111 f 153 149 150 154
f 147/169/112 151/174/112 154/173/112 150/168/112 f 147 151 154 150
f 155/175/113 151/171/113 152/170/113 156/176/113 f 155 151 152 156
f 153/172/114 157/177/114 156/176/114 152/170/114 f 153 157 156 152
f 153/172/115 154/173/115 158/178/115 157/177/115 f 153 154 158 157
f 151/174/116 155/179/116 158/178/116 154/173/116 f 151 155 158 154
f 160/180/117 162/181/117 161/182/117 159/183/117 f 160 162 161 159
f 164/184/118 163/185/118 161/182/118 162/181/118 f 164 163 161 162
f 166/186/119 165/187/119 163/185/119 164/184/119 f 166 165 163 164
f 166/186/120 160/188/120 159/189/120 165/187/120 f 166 160 159 165
f 159/183/121 161/182/121 168/190/121 167/191/121 f 159 161 168 167
f 161/182/122 163/185/122 169/192/122 168/190/122 f 161 163 169 168
f 165/187/123 170/193/123 169/192/123 163/185/123 f 165 170 169 163
f 165/187/124 159/189/124 167/194/124 170/193/124 f 165 159 167 170
f 167/191/125 168/190/125 172/195/125 171/196/125 f 167 168 172 171
f 169/192/126 173/197/126 172/195/126 168/190/126 f 169 173 172 168
f 169/192/127 170/193/127 174/198/127 173/197/127 f 169 170 174 173
f 167/194/128 171/199/128 174/198/128 170/193/128 f 167 171 174 170
f 172/195/129 176/200/129 175/201/129 171/196/129 f 172 176 175 171
f 173/197/130 177/202/130 176/200/130 172/195/130 f 173 177 176 172
f 173/197/131 174/198/131 178/203/131 177/202/131 f 173 174 178 177
f 178/203/132 174/198/132 171/199/132 175/204/132 f 178 174 171 175
f 176/200/133 180/205/133 179/206/133 175/201/133 f 176 180 179 175
f 180/205/134 176/200/134 177/202/134 181/207/134 f 180 176 177 181
f 178/203/135 182/208/135 181/207/135 177/202/135 f 178 182 181 177
f 178/203/136 175/204/136 179/209/136 182/208/136 f 178 175 179 182
f 180/205/137 184/210/137 183/211/137 179/206/137 f 180 184 183 179
f 185/212/138 184/210/138 180/205/138 181/207/138 f 185 184 180 181
f 181/207/139 182/208/139 186/213/139 185/212/139 f 181 182 186 185
f 182/208/140 179/209/140 183/214/140 186/213/140 f 182 179 183 186
f 1/347/261 2/348/261 262/349/261 261/350/261 f 1 2 262 261
f 2/348/262 3/351/262 263/352/262 262/349/262 f 2 3 263 262
f 4/353/263 265/354/263 263/352/263 3/351/263 f 4 265 263 3
f 4/353/264 5/355/264 266/356/264 265/354/264 f 4 5 266 265
f 6/357/265 267/358/265 266/356/265 5/355/265 f 6 267 266 5
f 1/359/266 261/360/266 267/358/266 6/357/266 f 1 261 267 6
f 261/350/267 268/361/267 8/2/267 7/1/267 f 261 268 8 7
f 269/362/268 9/5/268 8/2/268 268/361/268 f 269 9 8 268
f 265/354/269 10/7/269 9/5/269 269/362/269 f 265 10 9 269
f 265/354/270 266/356/270 11/9/270 10/7/270 f 265 266 11 10
f 266/356/271 267/358/271 12/11/271 11/9/271 f 266 267 12 11
f 261/360/272 7/13/272 12/11/272 267/358/272 f 261 7 12 267
f 261/350/273 262/349/273 50/50/273 49/53/273 f 261 262 50 49
f 263/352/274 51/54/274 50/50/274 262/349/274 f 263 51 50 262
f 52/56/275 51/54/275 263/352/275 265/354/275 f 52 51 263 265
f 265/354/276 269/363/276 53/58/276 52/56/276 f 265 269 53 52
f 268/364/277 54/60/277 53/58/277 269/363/277 f 268 54 53 269
f 261/360/278 49/62/278 54/60/278 268/364/278 f 261 49 54 268
f 271/365/279 270/366/279 103/112/279 105/111/279 f 271 270 103 105
f 272/367/280 271/365/280 105/111/280 107/115/280 f 272 271 105 107
f 264/368/281 272/367/281 107/115/281 109/117/281 f 264 272 107 109
f 264/368/282 109/117/282 103/119/282 270/369/282 f 264 109 103 270
f 111/120/283 270/366/283 273/370/283 112/121/283 f 111 270 273 112
f 272/367/284 113/124/284 112/121/284 273/370/284 f 272 113 112 273
f 272/367/285 264/368/285 114/126/285 113/124/285 f 272 264 114 113
f 270/369/286 111/128/286 114/126/286 264/368/286 f 270 111 114 264
f 131/146/287 132/145/287 277/371/287 280/372/287 f 131 132 277 280
f 132/145/288 133/147/288 278/373/288 277/371/288 f 132 133 278 277
f 134/148/289 281/374/289 278/373/289 133/147/289 f 134 281 278 133
f 134/148/290 131/149/290 280/375/290 281/374/290 f 134 131 280 281
f 270/366/291 271/365/291 136/151/291 135/150/291 f 270 271 136 135
f 272/367/292 137/154/292 136/151/292 271/365/292 f 272 137 136 271
f 272/367/293 273/376/293 138/156/293 137/154/293 f 272 273 138 137
f 270/369/294 135/158/294 138/156/294 273/376/294 f 270 135 138 273
f 156/176/295 275/377/295 274/378/295 155/175/295 f 156 275 274 155
f 275/377/296 156/176/296 157/177/296 276/379/296 f 275 156 157 276
f 158/178/297 279/380/297 276/379/297 157/177/297 f 158 279 276 157
f 279/380/298 158/178/298 155/179/298 274/381/298 f 279 158 155 274
f 277/382/299 278/383/299 187/384/299 280/385/299 f 277 278 187 280
f 278/383/300 281/386/300 280/385/300 f 278 281 280
f 278/383/301 280/385/301 187/384/301 f 278 280 187
f 275/387/302 276/388/302 188/389/302 274/390/302 f 275 276 188 274
f 276/388/303 279/391/303 274/390/303 f 276 279 274
f 276/388/304 274/390/304 188/389/304 f 276 274 188
f 93/99/305 89/392/305 90/393/305 94/101/305 f 93 89 90 94
f 88/394/306 89/392/306 93/99/306 92/95/306 f 88 89 93 92
f 91/103/307 94/101/307 90/393/307 87/395/307 f 91 94 90 87
f 88/394/308 92/95/308 91/98/308 87/396/308 f 88 92 91 87
f 83/90/309 85/92/309 90/393/309 89/392/309 f 83 85 90 89
f 83/90/310 89/392/310 88/394/310 81/86/310 f 83 89 88 81
f 79/94/311 87/395/311 90/393/311 85/92/311 f 79 87 90 85
f 79/87/312 81/86/312 88/394/312 87/396/312 f 79 81 88 87
usemtl Tree usemtl Tree
f 189/215/141 190/216/141 191/217/141 f 189 190 191
f 192/218/142 189/215/142 191/219/142 f 192 189 191
f 193/220/143 192/218/143 191/221/143 f 193 192 191
f 194/222/144 193/220/144 191/223/144 f 194 193 191
f 190/224/145 194/222/145 191/225/145 f 190 194 191
f 195/226/146 196/227/146 197/228/146 f 195 196 197
f 196/227/147 198/229/147 197/230/147 f 196 198 197
f 198/229/148 199/231/148 197/232/148 f 198 199 197
f 199/231/149 200/233/149 197/234/149 f 199 200 197
f 200/233/150 195/235/150 197/236/150 f 200 195 197
f 189/215/151 195/226/151 190/216/151 f 189 195 190
f 192/218/152 196/227/152 189/215/152 f 192 196 189
f 193/220/153 198/229/153 192/218/153 f 193 198 192
f 194/222/154 199/231/154 193/220/154 f 194 199 193
f 190/224/155 200/233/155 194/222/155 f 190 200 194
f 195/226/156 189/215/156 196/227/156 f 195 189 196
f 196/227/157 192/218/157 198/229/157 f 196 192 198
f 198/229/158 193/220/158 199/231/158 f 198 193 199
f 199/231/159 194/222/159 200/233/159 f 199 194 200
f 200/233/160 190/224/160 195/235/160 f 200 190 195
f 201/237/161 202/238/161 203/239/161 f 201 202 203
f 204/240/162 202/241/162 201/237/162 f 204 202 201
f 205/242/163 202/243/163 204/240/163 f 205 202 204
f 206/244/164 202/245/164 205/242/164 f 206 202 205
f 203/246/165 202/247/165 206/244/165 f 203 202 206
f 207/248/166 208/249/166 209/250/166 f 207 208 209
f 209/250/167 208/251/167 210/252/167 f 209 208 210
f 210/252/168 208/253/168 211/254/168 f 210 208 211
f 211/254/169 208/255/169 212/256/169 f 211 208 212
f 212/256/170 208/257/170 207/258/170 f 212 208 207
f 201/237/171 203/239/171 207/248/171 f 201 203 207
f 204/240/172 201/237/172 209/250/172 f 204 201 209
f 205/242/173 204/240/173 210/252/173 f 205 204 210
f 206/244/174 205/242/174 211/254/174 f 206 205 211
f 203/246/175 206/244/175 212/256/175 f 203 206 212
f 207/248/176 209/250/176 201/237/176 f 207 209 201
f 209/250/177 210/252/177 204/240/177 f 209 210 204
f 210/252/178 211/254/178 205/242/178 f 210 211 205
f 211/254/179 212/256/179 206/244/179 f 211 212 206
f 212/256/180 207/258/180 203/246/180 f 212 207 203
f 213/259/181 214/260/181 215/261/181 f 213 214 215
f 216/262/182 213/259/182 215/263/182 f 216 213 215
f 217/264/183 216/262/183 215/265/183 f 217 216 215
f 218/266/184 217/264/184 215/267/184 f 218 217 215
f 214/268/185 218/266/185 215/269/185 f 214 218 215
f 219/270/186 220/271/186 221/272/186 f 219 220 221
f 220/271/187 222/273/187 221/274/187 f 220 222 221
f 222/273/188 223/275/188 221/276/188 f 222 223 221
f 223/275/189 224/277/189 221/278/189 f 223 224 221
f 224/277/190 219/279/190 221/280/190 f 224 219 221
f 213/259/191 219/270/191 214/260/191 f 213 219 214
f 216/262/192 220/271/192 213/259/192 f 216 220 213
f 217/264/193 222/273/193 216/262/193 f 217 222 216
f 218/266/194 223/275/194 217/264/194 f 218 223 217
f 214/268/195 224/277/195 218/266/195 f 214 224 218
f 219/270/196 213/259/196 220/271/196 f 219 213 220
f 220/271/197 216/262/197 222/273/197 f 220 216 222
f 222/273/198 217/264/198 223/275/198 f 222 217 223
f 223/275/199 218/266/199 224/277/199 f 223 218 224
f 224/277/200 214/268/200 219/279/200 f 224 214 219
f 225/281/201 226/282/201 227/283/201 f 225 226 227
f 228/284/202 225/281/202 227/285/202 f 228 225 227
f 229/286/203 228/284/203 227/287/203 f 229 228 227
f 230/288/204 229/286/204 227/289/204 f 230 229 227
f 226/290/205 230/288/205 227/291/205 f 226 230 227
f 231/292/206 232/293/206 233/294/206 f 231 232 233
f 232/293/207 234/295/207 233/296/207 f 232 234 233
f 234/295/208 235/297/208 233/298/208 f 234 235 233
f 235/297/209 236/299/209 233/300/209 f 235 236 233
f 236/299/210 231/301/210 233/302/210 f 236 231 233
f 225/281/211 231/292/211 226/282/211 f 225 231 226
f 228/284/212 232/293/212 225/281/212 f 228 232 225
f 229/286/213 234/295/213 228/284/213 f 229 234 228
f 230/288/214 235/297/214 229/286/214 f 230 235 229
f 226/290/215 236/299/215 230/288/215 f 226 236 230
f 231/292/216 225/281/216 232/293/216 f 231 225 232
f 232/293/217 228/284/217 234/295/217 f 232 228 234
f 234/295/218 229/286/218 235/297/218 f 234 229 235
f 235/297/219 230/288/219 236/299/219 f 235 230 236
f 236/299/220 226/290/220 231/301/220 f 236 226 231
f 237/303/221 238/304/221 239/305/221 f 237 238 239
f 240/306/222 238/307/222 237/303/222 f 240 238 237
f 241/308/223 238/309/223 240/306/223 f 241 238 240
f 242/310/224 238/311/224 241/308/224 f 242 238 241
f 239/312/225 238/313/225 242/310/225 f 239 238 242
f 243/314/226 244/315/226 245/316/226 f 243 244 245
f 245/316/227 244/317/227 246/318/227 f 245 244 246
f 246/318/228 244/319/228 247/320/228 f 246 244 247
f 247/320/229 244/321/229 248/322/229 f 247 244 248
f 248/322/230 244/323/230 243/324/230 f 248 244 243
f 237/303/231 239/305/231 243/314/231 f 237 239 243
f 240/306/232 237/303/232 245/316/232 f 240 237 245
f 241/308/233 240/306/233 246/318/233 f 241 240 246
f 242/310/234 241/308/234 247/320/234 f 242 241 247
f 239/312/235 242/310/235 248/322/235 f 239 242 248
f 243/314/236 245/316/236 237/303/236 f 243 245 237
f 245/316/237 246/318/237 240/306/237 f 245 246 240
f 246/318/238 247/320/238 241/308/238 f 246 247 241
f 247/320/239 248/322/239 242/310/239 f 247 248 242
f 248/322/240 243/324/240 239/312/240 f 248 243 239
f 249/325/241 250/326/241 251/327/241 f 249 250 251
f 252/328/242 249/325/242 251/329/242 f 252 249 251
f 253/330/243 252/328/243 251/331/243 f 253 252 251
f 254/332/244 253/330/244 251/333/244 f 254 253 251
f 250/334/245 254/332/245 251/335/245 f 250 254 251
f 255/336/246 256/337/246 257/338/246 f 255 256 257
f 256/337/247 258/339/247 257/340/247 f 256 258 257
f 258/339/248 259/341/248 257/342/248 f 258 259 257
f 259/341/249 260/343/249 257/344/249 f 259 260 257
f 260/343/250 255/345/250 257/346/250 f 260 255 257
f 249/325/251 255/336/251 250/326/251 f 249 255 250
f 252/328/252 256/337/252 249/325/252 f 252 256 249
f 253/330/253 258/339/253 252/328/253 f 253 258 252
f 254/332/254 259/341/254 253/330/254 f 254 259 253
f 250/334/255 260/343/255 254/332/255 f 250 260 254
f 255/336/256 249/325/256 256/337/256 f 255 249 256
f 256/337/257 252/328/257 258/339/257 f 256 252 258
f 258/339/258 253/330/258 259/341/258 f 258 253 259
f 259/341/259 254/332/259 260/343/259 f 259 254 260
f 260/343/260 250/334/260 255/345/260 f 260 250 255

View File

@ -48,7 +48,7 @@ struct GPUVolume
vec3 sigma_s; // scattering coefficient vec3 sigma_s; // scattering coefficient
vec3 sigma_t; // extinction coefficient vec3 sigma_t; // extinction coefficient
float g; // phase function parameter float g; // phase function parameter
bool enabled; int enabled;
}; };
layout(std430, binding = 1) buffer ObjectBuffer layout(std430, binding = 1) buffer ObjectBuffer
@ -167,7 +167,7 @@ vec3 pathtrace(Ray ray, inout uint rng_state)
hitInfo hit = traceRay(ray); hitInfo hit = traceRay(ray);
float t_scatter = 0.0; float t_scatter = 0.0;
if (volume.enabled && atmosScatter(hit, t_scatter, rng_state)) if (volume.enabled != 0 && atmosScatter(hit, t_scatter, rng_state))
{ {
calculateVolumetricLight(t_scatter, ray, color, light, transmittance, rng_state); calculateVolumetricLight(t_scatter, ray, color, light, transmittance, rng_state);
continue; continue;
@ -179,7 +179,7 @@ vec3 pathtrace(Ray ray, inout uint rng_state)
break; break;
} }
if (volume.enabled) if (volume.enabled != 0)
transmittance *= exp(-volume.sigma_t * hit.t); transmittance *= exp(-volume.sigma_t * hit.t);
GPUObject obj = objects[hit.obj_index]; GPUObject obj = objects[hit.obj_index];

View File

@ -2,8 +2,6 @@ hitInfo traceRay(Ray ray);
vec3 GetEnvironmentLight(Ray ray) vec3 GetEnvironmentLight(Ray ray)
{ {
return vec3(0.);
vec3 sun_pos = vec3(-0.5, 0.5, 0.5); vec3 sun_pos = vec3(-0.5, 0.5, 0.5);
float SunFocus = 1.5; float SunFocus = 1.5;
float SunIntensity = 1.; float SunIntensity = 1.;
@ -123,6 +121,6 @@ vec3 sampleLights(vec3 position, inout uint rng_state)
void calculateLightColor(GPUMaterial mat, hitInfo hit, inout vec3 color, inout vec3 light, inout uint rng_state) void calculateLightColor(GPUMaterial mat, hitInfo hit, inout vec3 color, inout vec3 light, inout uint rng_state)
{ {
color *= mat.color; color *= mat.color;
light += mat.emission * mat.color; // light += mat.emission * mat.color;
// light += sampleLights(hit.position, rng_state); light += sampleLights(hit.position, rng_state);
} }

View File

@ -6,7 +6,7 @@
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */ /* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/23 18:29:41 by ycontre #+# #+# */ /* Created: 2024/12/23 18:29:41 by ycontre #+# #+# */
/* Updated: 2025/01/10 18:58:57 by ycontre ### ########.fr */ /* Updated: 2025/01/15 18:58:34 by ycontre ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -16,7 +16,7 @@ Scene::Scene()
{ {
_camera = new Camera(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f), -90.0f, 0.0f); _camera = new Camera(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f), -90.0f, 0.0f);
_gpu_volume.enabled = false; _gpu_volume.enabled = 0;
_gpu_volume.sigma_a = glm::vec3(0.0001f); _gpu_volume.sigma_a = glm::vec3(0.0001f);
_gpu_volume.sigma_s = glm::vec3(0.0800f); _gpu_volume.sigma_s = glm::vec3(0.0800f);
_gpu_volume.sigma_t = _gpu_volume.sigma_a + _gpu_volume.sigma_s; _gpu_volume.sigma_t = _gpu_volume.sigma_a + _gpu_volume.sigma_s;

View File

@ -6,7 +6,7 @@
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */ /* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/13 16:16:24 by TheRed #+# #+# */ /* Created: 2024/10/13 16:16:24 by TheRed #+# #+# */
/* Updated: 2025/01/11 16:13:40 by tomoron ### ########.fr */ /* Updated: 2025/01/15 18:58:49 by ycontre ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -217,7 +217,7 @@ void Window::imGuiRender()
ImGui::Begin("Fog settings"); ImGui::Begin("Fog settings");
has_changed |= ImGui::Checkbox("Enable", &_scene->getVolume().enabled); has_changed |= ImGui::Checkbox("Enable", (bool *)(&_scene->getVolume().enabled));
ImGui::Separator(); ImGui::Separator();
if (ImGui::SliderFloat("Absorption", &_scene->getVolume().sigma_a.x, 0., 0.1)) if (ImGui::SliderFloat("Absorption", &_scene->getVolume().sigma_a.x, 0., 0.1))