demotool/test/fx-combine.srd

121 lines
2.8 KiB
Text
Raw Normal View History

################################################################################
# Combine
(fn combine-init ()
# Assets
(sampler smp-combine-input (sampling nearest))
(sampler smp-combine-bloom
(sampling linear)
(mipmaps nearest)
(lod 0 100))
(texture tx-combined rgba-nu8 $vp-width $vp-height)
(odbg tx-combined ldr-alpha "Combined output")
(if $use-compute (
(program prg-combine "combine.c.glsl")
(pipeline pl-combine prg-combine)
)(
(framebuffer rt-combined tx-combined)
(program prg-combine "combine.f.glsl")
(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)
# Input overrides
(ui-overrides
(section "Post-processing"
(section "Bloom"
(section "Output"
(float "Strength" bloom-strength
(min 0) (max 1) (slider))
(float "Attenuation / level" bloom-attenuation
(min 0) (max 1) (slider))
)
)
(section "Color grading"
(color-grading "Lift"
cg-lift-r cg-lift-g cg-lift-b
(base -.1) (unit .1))
(color-grading "Gain"
cg-gain-r cg-gain-g cg-gain-b
(base 0) (unit 1))
(color-grading "Gamma"
cg-gamma-r cg-gamma-g cg-gamma-b
(base -.9) (unit .9))
)
)
# FIXME: overrides for vignette
)
)
(fn combine-render (in-main in-bloom)
(profiling "Combine"
(uniforms-i prg-combine 0 0)
(uniforms-i prg-combine 1 1)
(use-pipeline pl-combine)
(if (not $use-compute) (
(uniforms prg-combine 2 $vp-width $vp-height)
(use-framebuffer rt-combined)
))
(use-texture 0 in-main smp-combine-input)
(use-texture 1 in-bloom smp-combine-bloom)
(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))
(if $use-compute (
(image 0 tx-combined 0)
(compute $vp-width $vp-height 1)
)(
(viewport 0 0 $vp-width $vp-height)
(fullscreen)
))
)
)
# vim: syntax=demo-srd