Script - Combine pass ported

This commit is contained in:
Emmanuel BENOîT 2017-11-10 21:24:47 +01:00
parent e0929d6ec4
commit 424dca64e9

View file

@ -19,13 +19,15 @@
(call scene-init) (call scene-init)
(call dof-init) (call dof-init)
(call bloom-init) (call bloom-init)
(call combine-init)
) )
(frame (frame
(profiling "Frame render" (profiling "Frame render"
(call scene-main) (call scene-render)
(call dof-main tx-scene-output tx-scene-depth) (call dof-render tx-scene-output tx-scene-depth)
(call bloom-main tx-scene-output) (call bloom-render tx-scene-output)
(call combine-render tx-dof-pass2 tx-bloom1)
) )
) )
@ -67,7 +69,7 @@
(input fog .00015) (input fog .00015)
) )
(fn scene-main () (fn scene-render ()
(profiling "Scene render" (profiling "Scene render"
(uniforms prg-scene-p1 0 $time) (uniforms prg-scene-p1 0 $time)
(uniforms prg-scene-p1 2 (uniforms prg-scene-p1 2
@ -170,7 +172,7 @@
(uniforms prog 4 $vp-width $vp-height $time) (uniforms prog 4 $vp-width $vp-height $time)
) )
(fn dof-main (in-image in-depth) (fn dof-render (in-image in-depth)
(profiling "Depth of Field" (profiling "Depth of Field"
(use-texture 1 in-depth dof-sampler) (use-texture 1 in-depth dof-sampler)
@ -257,7 +259,7 @@
(input bloom-blur-size 1.3) (input bloom-blur-size 1.3)
) )
(fn bloom-main (in-scene) (fn bloom-render (in-scene)
(profiling "BLOOOOM!" (profiling "BLOOOOM!"
# High pass # High pass
(use-texture 0 in-scene smp-bloom-input) (use-texture 0 in-scene smp-bloom-input)
@ -324,5 +326,78 @@
) )
################################################################################
# Combine
(fn combine-init ()
# Assets
(sampler smp-combine-input (sampling nearest))
(texture tx-combined rgba-nu8 $vp-width $vp-height)
(odbg tx-combined ldr-alpha "Combined output")
(framebuffer rt-combined tx-combined)
(program prg-combine "combine.f.glsl")
(uniforms-i prg-combine 0 0)
(uniforms-i prg-combine 1 1)
(uniforms prg-combine 2 $vp-width $vp-height)
(pipeline pl-combine prg-fullscreen prg-combine)
# Bloom parameters
(input bloom-strength .45)
(input bloom-attenuation .3)
# Vignette effect
(input vignette-shape-m 1)
(input vignette-shape-p 8)
(input vignette-shape-r 1)
(input vignette-aspect-ratio .5)
(input vignette-apply-base 0)
(input vignette-apply-max 1)
# Color grading
(input cg-lift-r 0)
(input cg-lift-g 0)
(input cg-lift-b 0)
(input cg-gain-r 1)
(input cg-gain-g 1)
(input cg-gain-b 1)
(input cg-gamma-r 0)
(input cg-gamma-g 0)
(input cg-gamma-b 0)
)
(fn combine-render (in-main in-bloom)
(profiling "Combine"
(use-pipeline pl-combine)
(use-framebuffer rt-combined)
(use-texture 0 in-main smp-combine-input)
(use-texture 1 in-bloom smp-combine-input)
(uniforms prg-combine 3
(get-input bloom-strength)
(get-input bloom-attenuation))
(uniforms prg-combine 4
(get-input vignette-shape-m)
(get-input vignette-shape-p)
(get-input vignette-aspect-ratio)
(get-input vignette-shape-r))
(uniforms prg-combine 5
(get-input vignette-apply-base)
(get-input vignette-apply-max))
(uniforms prg-combine 6
(get-input cg-lift-r)
(get-input cg-lift-g)
(get-input cg-lift-b))
(uniforms prg-combine 7
(get-input cg-gain-r)
(get-input cg-gain-g)
(get-input cg-gain-b))
(uniforms prg-combine 8
(get-input cg-gamma-r)
(get-input cg-gamma-g)
(get-input cg-gamma-b))
(fullscreen)
)
)
# vim: syntax=demo-srd # vim: syntax=demo-srd