mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
Changed shadow cubemap calculation of up and direction vectors. Included point light range to shader calculations. Replaced use of define values in shaders for uniforms vectors with range parameters. Code cleanup.
59 lines
2.1 KiB
Plaintext
59 lines
2.1 KiB
Plaintext
puts "========"
|
|
puts "0032173: Visualization, TKOpenGl - implement simple shadow mapping for a point light source"
|
|
puts "Test shadow map from a point light source on multiple boxes."
|
|
puts "========"
|
|
|
|
pload MODELING VISUALIZATION
|
|
if { $::tcl_platform(os) == "Darwin" } { vcaps -core }
|
|
vclear
|
|
vinit View1
|
|
vrenderparams -shadingModel phong
|
|
# add geometry
|
|
box b1 20 0 0 10 10 10
|
|
box b2 -20 0 0 10 10 10
|
|
box b3 -50 -20 -25 100 5 50
|
|
box b4 0 10 0 5 5 5
|
|
box b5 0 0 5 3 3 3
|
|
box b6 0 0 -5 7 7 7
|
|
box b7 0 -5 -10 3 3 3
|
|
vdisplay -dispmode 1 b1 b2 b3 b4 b5 b6 b7
|
|
vfit
|
|
# add colors
|
|
vsetcolor b1 RED3
|
|
vsetcolor b2 GREEN3
|
|
vsetcolor b3 BLUE3
|
|
vsetcolor b4 ORANGE3
|
|
vsetcolor b5 YELLOW3
|
|
vsetcolor b6 SALMON3
|
|
vsetcolor b7 PURPLE3
|
|
# add light
|
|
vlight -clear
|
|
vlight pntlight1 -type POSITIONAL -pos 0 100 0 -intensity 1000 -castShadows 1 -range 1000
|
|
|
|
#dump single light phong
|
|
vviewparams -scale 8.0 -proj 0.0 1.0 0.0 -up 0.0 0.0 1.0 -at 0.0 0.0 0.0
|
|
vdump $imagedir/${casename}_single_pointlight_phong1.png
|
|
vviewparams -scale 8.0 -proj 0.5 1.0 0.0 -up 0.0 0.0 1.0 -at 0.0 0.0 0.0
|
|
vdump $imagedir/${casename}_single_pointlight_phong2.png
|
|
#dump single light pbr
|
|
vrenderparams -shadingModel pbr
|
|
vviewparams -scale 10.0 -proj 0.0 1.0 0.0 -up 0.0 0.0 1.0 -at 0.0 0.0 0.0
|
|
vdump $imagedir/${casename}_single_pointlight_pbr1.png
|
|
vviewparams -scale 10.0 -proj 0.2 1.0 0.0 -up 0.0 0.0 1.0 -at 0.0 0.0 0.0
|
|
vdump $imagedir/${casename}_single_pointlight_pbr2.png
|
|
|
|
#add second light
|
|
vlight pntlight2 -type POSITIONAL -pos 40 100 0 -intensity 1000 -castShadows 1
|
|
#dump double light phong
|
|
vrenderparams -shadingModel phong
|
|
vviewparams -scale 8.0 -proj 0.0 1.0 0.0 -up 0.0 0.0 1.0 -at 0.0 0.0 0.0
|
|
vdump $imagedir/${casename}_double_pointlight_phong1.png
|
|
vviewparams -scale 8.0 -proj 0.5 1.0 0.0 -up 0.0 0.0 1.0 -at 0.0 0.0 0.0
|
|
vdump $imagedir/${casename}_double_pointlight_phong2.png
|
|
#dump double light pbr
|
|
vrenderparams -shadingModel pbr
|
|
vviewparams -scale 10.0 -proj 0.0 1.0 0.0 -up 0.0 0.0 1.0 -at 0.0 0.0 0.0
|
|
vdump $imagedir/${casename}_double_pointlight_pbr1.png
|
|
vviewparams -scale 10.0 -proj -0.2 1.0 0.0 -up 0.0 0.0 1.0 -at 0.0 0.0 0.0
|
|
vdump $imagedir/${casename}_double_pointlight_pbr2.png
|