1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00
Files
occt/tests/opengl/data/shadows/pointlight
drochalo 48f8f1e6ea 0032173: Visualization, TKOpenGl - implement simple shadow mapping for a point light source
Modified shadowmap calculations to include multipass for point lights.
Added shader funtions to calculate point light shadows.
Added getter for default znear and zfar values in Graphic3d_Camera.
Added direction and up vector calulations on Graphic3d_CubeMap.
Added logical exception for opengles2.0 lack of support on some key features of cube shadow maps.
Added test case.
2024-03-05 16:16:19 +00:00

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
#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