7f758a06a7
* display bokeh sample pattern, add bokeh shape, improve look draw sample pattern to texture and display in ui to see number of samples and their arrangment add bokeh shape controls remove adhoc 'sqrt' pattern since display makes existing pattern easier to understand and it looks nicer. switch to floating point color texture and leave lighting results in linear space until after dof is performed. provides better results and bright spots can make more noticeable bokeh shapes. change default values to use take more samples at reduced resolution so initial experience when loading the sample is better looking image * update screenshot, minor change to ui fix height of ui element so scrollbar not required by default layout update screenshot * fix typo in texturev atleast, i'm pretty sure that's a typo don't see a reason to set width twice
30 lines
699 B
Scala
30 lines
699 B
Scala
$input v_texcoord0
|
|
|
|
/*
|
|
* Copyright 2021 elven cache. All rights reserved.
|
|
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
|
|
*/
|
|
|
|
#include "../common/common.sh"
|
|
#include "parameters.sh"
|
|
|
|
SAMPLER2D(s_color, 0);
|
|
SAMPLER2D(s_blurredColor, 1);
|
|
|
|
void main()
|
|
{
|
|
vec2 texCoord = v_texcoord0.xy;
|
|
vec4 color = texture2D(s_color, texCoord);
|
|
vec4 dofColorSize = texture2D(s_blurredColor, texCoord);
|
|
vec3 dofColor = dofColorSize.xyz;
|
|
float sampleSize = dofColorSize.w;
|
|
|
|
float m = saturate(sampleSize-1.0);
|
|
color.xyz = mix(color.xyz, dofColor, m);
|
|
|
|
// this pass is writing directly out to backbuffer, convert from linear to gamma
|
|
color.xyz = toGamma(color.xyz);
|
|
|
|
gl_FragColor = color;
|
|
}
|