mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-24 03:48:06 +01:00
[FXAA] Add mask output.
This commit is contained in:
parent
974a7e858f
commit
f1a77307e3
2 changed files with 24 additions and 7 deletions
|
@ -20,19 +20,32 @@ function Node_FXAA(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
|
||||
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
|
||||
|
||||
outputs[1] = nodeValue_Output("Mask", self, VALUE_TYPE.surface, noone);
|
||||
|
||||
attribute_surface_depth();
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
surface_set_shader(_outSurf, sh_FXAA);
|
||||
static processData = function(_outData, _data, _output_index, _array_index) {
|
||||
|
||||
var _dim = surface_get_dimension(_data[0]);
|
||||
_outData[0] = surface_verify(_outData[0], _dim[0], _dim[1]);
|
||||
_outData[1] = surface_verify(_outData[1], _dim[0], _dim[1]);
|
||||
|
||||
surface_set_target_ext(0, _outData[0]);
|
||||
surface_set_target_ext(1, _outData[1]);
|
||||
shader_set(sh_FXAA);
|
||||
DRAW_CLEAR
|
||||
BLEND_OVERRIDE
|
||||
gpu_set_tex_filter(true);
|
||||
shader_set_f("dimension", surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]));
|
||||
shader_set_2("dimension", _dim);
|
||||
shader_set_f("cornerDis", _data[2]);
|
||||
shader_set_f("mixAmo", _data[3]);
|
||||
|
||||
draw_surface_safe(_data[0]);
|
||||
gpu_set_tex_filter(false);
|
||||
surface_reset_shader();
|
||||
BLEND_NORMAL
|
||||
shader_reset();
|
||||
surface_reset_target();
|
||||
|
||||
return _outSurf;
|
||||
} #endregion
|
||||
return _outData;
|
||||
}
|
||||
}
|
|
@ -69,5 +69,9 @@ vec4 textureFXAA(sampler2D tex, vec2 uv) {
|
|||
}
|
||||
|
||||
void main() {
|
||||
gl_FragColor = textureFXAA( gm_BaseTexture, v_vTexcoord );
|
||||
vec4 base = texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
vec4 fxaa = textureFXAA( gm_BaseTexture, v_vTexcoord );
|
||||
|
||||
gl_FragData[0] = fxaa;
|
||||
gl_FragData[1] = vec4(abs(base.rgb - fxaa.rgb), 1.);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue