Render.ru

Использование shadow.a у spotlight

workflow

Пользователь сайта
Рейтинг
2
#1
Здравствуйте.
У источника света Spotlight можно вывести тень, падающую на ноду Card через канал shadow.a в качестве маски.
Вопрос состоит в том, как спроецировать этот канал shadow.a на ноду Card так, чтобы сама нода оставалась прозрачной?
 

Григорий Чаленко

Куратор форума
Команда форума
Рейтинг
948
#2
Дело в том, что канал маски тени получается уже в результате рендеринга, в ноде ScanlineRender, передать эту маску назад, вверх по потоку нельзя (иначе получился бы бесконечный цикл).

Но можно сделать рендер в два прохода: первый для получения маски, а во втором рендере спроецировать полученный ранее канал на объект Card:

Код:
set cut_paste_input [stack 0]
version 9.0 v7
push $cut_paste_input
Camera2 {
translate {1.33687675 0.8131622076 1.802278996}
rotate {-18.99999237 34.80004501 3.611873808e-06}
name Camera1
selected true
xpos -138
ypos -14
}
set N10701270 [stack 0]
Spotlight {
inputs 0
cone_penumbra_angle 3
translate {0 0 0.8619999886}
cast_shadows true
samples 10
sample_width 2.65
depthmap_slope_bias 0.156
shadow_jitter_scale 15.7
shadow_mask mask.a
name Spotlight1
label "Creates shadow channel mask.a"
selected true
xpos -120
ypos -124
}
set N100b9d10 [stack 0]
push $N10701270
push $N10701270
Phong {
inputs 0
name Phong1
selected true
xpos 148
ypos -345
}
set N106cf1d0 [stack 0]
Sphere {
radius 0.04
translate {0 0 0.3}
name Sphere1
label "Casts shadow"
selected true
xpos 148
ypos -237
}
push $N100b9d10
push $N106cf1d0
Card2 {
control_points {3 3 3 6

1 {-0.5 -0.5 0} 0 {0.1666666865 0 0} 0 {0 0 0} 0 {0 0.1666666865 0} 0 {0 0 0} 0 {0 0 0}
1 {0 -0.5 0} 0 {0.1666666716 0 0} 0 {-0.1666666716 0 0} 0 {0 0.1666666865 0} 0 {0 0 0} 0 {0.5 0 0}
1 {0.5 -0.5 0} 0 {0 0 0} 0 {-0.1666666865 0 0} 0 {0 0.1666666865 0} 0 {0 0 0} 0 {1 0 0}
1 {-0.5 0 0} 0 {0.1666666865 0 0} 0 {0 0 0} 0 {0 0.1666666716 0} 0 {0 -0.1666666716 0} 0 {0 0.5 0}
1 {0 0 0} 0 {0.1666666716 0 0} 0 {-0.1666666716 0 0} 0 {0 0.1666666716 0} 0 {0 -0.1666666716 0} 0 {0.5 0.5 0}
1 {0.5 0 0} 0 {0 0 0} 0 {-0.1666666865 0 0} 0 {0 0.1666666716 0} 0 {0 -0.1666666716 0} 0 {1 0.5 0}
1 {-0.5 0.5 0} 0 {0.1666666865 0 0} 0 {0 0 0} 0 {0 0 0} 0 {0 -0.1666666865 0} 0 {0 1 0}
1 {0 0.5 0} 0 {0.1666666716 0 0} 0 {-0.1666666716 0 0} 0 {0 0 0} 0 {0 -0.1666666865 0} 0 {0.5 1 0}
1 {0.5 0.5 0} 0 {0 0 0} 0 {-0.1666666865 0 0} 0 {0 0 0} 0 {0 -0.1666666865 0} 0 {1 1 0} }
name Card1
label "Receives shadow"
selected true
xpos 568
ypos -165
}
set N10346790 [stack 0]
Scene {
inputs 3
name Scene1
selected true
xpos 158
ypos -179
}
push 0
ScanlineRender {
inputs 3
conservative_shader_sampling false
shutteroffset centred
motion_vectors_type distance
name ScanlineRender1
label "Renders with the shadow channel"
selected true
xpos 148
ypos -81
}
Project3D2 {
inputs 2
name Project3D1
label "Projects the shadow channel\nusing the original camera"
selected true
xpos 320
ypos -6
}
FillMat {
inputs 0
color {1 0.7 0.5 1}
name FillMat2
label "Color of the shadow"
selected true
xpos 447
ypos -72
}
MergeMat {
inputs 2
channels {rgba.red rgba.green rgba.blue mask.a}
also_merge all
operation mask
name MergeMat1
label "Masks the solid color\nby the shadow channel"
selected true
xpos 447
ypos -12
}
BlendMat {
name BlendMat1
label "Makes sure the transparency\nis applied correctly"
selected true
xpos 447
ypos 64
}
push $N10346790
Dot {
name Dot1
selected true
xpos 602
ypos 96
}
ApplyMaterial {
inputs 2
name ApplyMaterial1
selected true
xpos 447
ypos 141
}
push $N10701270
Scene {
inputs 3
name Scene2
selected true
xpos 236
ypos 121
}
CheckerBoard2 {
inputs 0
name CheckerBoard1
selected true
xpos 100
ypos 232
}
ScanlineRender {
inputs 3
conservative_shader_sampling false
shutteroffset centred
motion_vectors_type distance
name ScanlineRender2
selected true
xpos 226
ypos 255
}
 
Сверху