@@ -1138,12 +1138,22 @@ float remap_noise(vec3 idx)
11381138(def cloud-strength 6.5 )
11391139
11401140
1141- (bufimg/tensor->image (rgba-array->bufimg (render-noise 640 480 constant-scatter no-shadow (cloud-transfer " remap_noise" 0.01 ) remap-clamp (remap-noise " noise" 0.45 0.9 cloud-strength) noise-shader) 640 480 ))
1141+ (bufimg/tensor->image
1142+ (rgba-array->bufimg
1143+ (render-noise 640 480
1144+ constant-scatter no-shadow (cloud-transfer " remap_noise" 0.01 )
1145+ remap-clamp (remap-noise " noise" 0.45 0.9 cloud-strength) noise-shader)
1146+ 640 480 ))
11421147
11431148
11441149; ; ## Octaves of 3D noise
11451150
1146- (bufimg/tensor->image (rgba-array->bufimg (render-noise 640 480 constant-scatter no-shadow (cloud-transfer " remap_noise" 0.01 ) remap-clamp (remap-noise " octaves" 0.45 0.9 cloud-strength) (noise-octaves (octaves 4 0.5 )) noise-shader) 640 480 ))
1151+ (bufimg/tensor->image
1152+ (rgba-array->bufimg
1153+ (render-noise 640 480 constant-scatter no-shadow (cloud-transfer " remap_noise" 0.01 )
1154+ remap-clamp (remap-noise " octaves" 0.45 0.9 cloud-strength)
1155+ (noise-octaves (octaves 4 0.5 )) noise-shader)
1156+ 640 480 ))
11471157
11481158
11491159; ; ## Mie scattering
@@ -1178,7 +1188,8 @@ void main()
11781188
11791189
11801190(tabular " Shader function for scattering phase function"
1181- (fact (first (render-pixel [vertex-test] [(mie-scatter ?g) (mie-probe ?mu)])) => (roughly ?result 1e-6 ))
1191+ (fact (first (render-pixel [vertex-test] [(mie-scatter ?g) (mie-probe ?mu)]))
1192+ => (roughly ?result 1e-6 ))
11821193 ?g ?mu ?result
11831194 0 0 (/ 3 (* 16 PI))
11841195 0 1 (/ 6 (* 16 PI))
@@ -1191,20 +1202,28 @@ void main()
11911202 (first (render-pixel [vertex-test] [(mie-scatter 0.76 ) (mie-probe (cos theta))])))
11921203
11931204
1194- (let [scatter (tc/dataset {:x (map (fn [theta] (* (cos (to-radians theta))
1195- (+ 0.75 (* 0.25 (scatter-amount (to-radians theta))))))
1196- (range 361 ))
1197- :y (map (fn [theta] (* (sin (to-radians theta))
1198- (+ 0.75 (* 0.25 (scatter-amount (to-radians theta))))))
1199- (range 361 )) })]
1205+ (let [scatter
1206+ (tc/dataset {:x (map (fn [theta]
1207+ (* (cos (to-radians theta))
1208+ (+ 0.75 (* 0.25 (scatter-amount (to-radians theta))))))
1209+ (range 361 ))
1210+ :y (map (fn [theta]
1211+ (* (sin (to-radians theta))
1212+ (+ 0.75 (* 0.25 (scatter-amount (to-radians theta))))))
1213+ (range 361 )) })]
12001214 (-> scatter
12011215 (plotly/base {:=title " Mie scattering" :=mode " lines" })
12021216 (plotly/layer-point {:=x :x :=y :y })
12031217 plotly/plot
12041218 (assoc-in [:layout :yaxis :scaleanchor ] " x" )))
12051219
12061220
1207- (bufimg/tensor->image (rgba-array->bufimg (render-noise 640 480 (mie-scatter 0.76 ) no-shadow (cloud-transfer " remap_noise" 0.01 ) remap-clamp (remap-noise " octaves" 0.45 0.9 cloud-strength) (noise-octaves (octaves 4 0.5 )) noise-shader) 640 480 ))
1221+ (bufimg/tensor->image
1222+ (rgba-array->bufimg
1223+ (render-noise 640 480 (mie-scatter 0.76 ) no-shadow (cloud-transfer " remap_noise" 0.01 )
1224+ remap-clamp (remap-noise " octaves" 0.45 0.9 cloud-strength)
1225+ (noise-octaves (octaves 4 0.5 )) noise-shader)
1226+ 640 480 ))
12081227
12091228
12101229; ; ## Self-shading of clouds
@@ -1228,7 +1247,14 @@ float shadow(vec3 point)
12281247}" ))
12291248
12301249
1231- (bufimg/tensor->image (rgba-array->bufimg (render-noise 640 480 (mie-scatter 0.76 ) (shadow " remap_noise" 0.01 ) (cloud-transfer " remap_noise" 0.01 ) remap-clamp (remap-noise " octaves" 0.45 0.9 cloud-strength) (noise-octaves (octaves 4 0.5 )) noise-shader) 640 480 ))
1250+ (bufimg/tensor->image
1251+ (rgba-array->bufimg
1252+ (render-noise 640 480
1253+ (mie-scatter 0.76 ) (shadow " remap_noise" 0.01 )
1254+ (cloud-transfer " remap_noise" 0.01 ) remap-clamp
1255+ (remap-noise " octaves" 0.45 0.9 cloud-strength)
1256+ (noise-octaves (octaves 4 0.5 )) noise-shader)
1257+ 640 480 ))
12321258
12331259; ; ## Tidy up
12341260(GL11/glBindTexture GL12/GL_TEXTURE_3D 0 )
0 commit comments