当我在android / iOS(使用openGL)下使用TbloomEffect
和TgloomEffect
(Delphi组件)时,它仅产生黑白输出:(在Windows( DX11),那么就可以了,我想这是delphi源代码中的错误,但是我在下面的原始GLSL代码中找不到错误,该代码是从原始delphi源代码中提取的:
TgloomEffect
使用:
varying vec4 TEX0;
vec4 _ret_0;
vec3 _TMP4;
float _TMP3;
vec3 _x0014;
vec3 _TMP15;
float _grey0022;
float _grey0028;
vec3 _TMP35;
uniform float _GloomIntensity;
uniform float _BaseIntensity;
uniform float _GloomSaturation;
uniform float _BaseSaturation;
uniform sampler2D _Input;
void main()
{
vec4 _color1;
vec3 _base;
vec3 _gloom;
vec3 _TMP10;
_color1 = texture2D(_Input, TEX0.xy);
_base = 1.0 - _color1.xyz/_color1.w;
_x0014 = (_base - 2.50000000E-001)/7.50000000E-001;
_TMP4 = min(vec3( 1.0, 1.0, 1.0), _x0014);
_TMP15 = max(vec3( 0.0, 0.0, 0.0), _TMP4);
_grey0022 = dot(_TMP15, vec3( 3.00000012E-001, 5.89999974E-001, 1.09999999E-001));
_TMP3 = _grey0022 + _GloomSaturation*(_TMP15.x - _grey0022);
_gloom = vec3(_TMP3, _TMP3, _TMP3)*_GloomIntensity;
_grey0028 = dot(_base, vec3( 3.00000012E-001, 5.89999974E-001, 1.09999999E-001));
_TMP3 = _grey0028 + _BaseSaturation*(_base.x - _grey0028);
_base = vec3(_TMP3, _TMP3, _TMP3)*_BaseIntensity;
_TMP4 = min(vec3( 1.0, 1.0, 1.0), _gloom);
_TMP35 = max(vec3( 0.0, 0.0, 0.0), _TMP4);
_base = _base*(1.0 - _TMP35);
_TMP10 = (1.0 - (_base + _gloom))*_color1.w;
_ret_0 = vec4(_TMP10.x, _TMP10.y, _TMP10.z, _color1.w);
gl_FragColor = _ret_0;
return;
}
和TBloomEffect
使用:
varying vec4 TEX0;
vec4 _ret_0;
vec3 _TMP5;
float _TMP4;
vec3 _TMP3;
vec3 _TMP14;
vec3 _x0015;
float _grey0021;
float _grey0027;
vec3 _TMP34;
uniform float _BloomIntensity;
uniform float _BaseIntensity;
uniform float _BloomSaturation;
uniform float _BaseSaturation;
uniform sampler2D _Input;
void main()
{
vec4 _color1;
vec3 _base;
vec3 _bloom;
vec3 _TMP11;
_color1 = texture2D(_Input, TEX0.xy);
_base = _color1.xyz/_color1.w;
_x0015 = (_base - 2.50000000E-001)/7.50000000E-001;
_TMP3 = min(vec3( 1.0, 1.0, 1.0), _x0015);
_TMP14 = max(vec3( 0.0, 0.0, 0.0), _TMP3);
_grey0021 = dot(_TMP14, vec3( 3.00000012E-001, 5.89999974E-001, 1.09999999E-001));
_TMP4 = _grey0021 + _BloomSaturation*(_TMP14.x - _grey0021);
_bloom = vec3(_TMP4, _TMP4, _TMP4)*_BloomIntensity;
_grey0027 = dot(_base, vec3( 3.00000012E-001, 5.89999974E-001, 1.09999999E-001));
_TMP4 = _grey0027 + _BaseSaturation*(_base.x - _grey0027);
_base = vec3(_TMP4, _TMP4, _TMP4)*_BaseIntensity;
_TMP5 = min(vec3( 1.0, 1.0, 1.0), _bloom);
_TMP34 = max(vec3( 0.0, 0.0, 0.0), _TMP5);
_base = _base*(1.0 - _TMP34);
_TMP11 = (_base + _bloom)*_color1.w;
_ret_0 = vec4(_TMP11.x, _TMP11.y, _TMP11.z, _color1.w);
gl_FragColor = _ret_0;
return;
}
这2个仅以黑白输出的GLSL代码有什么问题?
答案 0 :(得分:0)
由于delphi中的错误...
好的代码是:
varying vec4 TEX0;
vec4 _ret_0;
vec3 _TMP4;
vec3 _TMP3;
vec3 _x0014;
vec3 _TMP15;
float _grey0022;
float _grey0028;
vec3 _TMP35;
uniform float _GloomIntensity;
uniform float _BaseIntensity;
uniform float _GloomSaturation;
uniform float _BaseSaturation;
uniform sampler2D _Input;
void main()
{
vec4 _color1;
vec3 _base;
vec3 _gloom;
vec3 _TMP10;
_color1 = texture2D(_Input, TEX0.xy);
_base = 1.0 - _color1.xyz/_color1.w;
_x0014 = (_base - 0.25)/0.75;
_TMP4 = min(vec3( 1.0, 1.0, 1.0), _x0014);
_TMP15 = max(vec3( 0.0, 0.0, 0.0), _TMP4);
_grey0022 = dot(_TMP15, vec3( 0.3, 0.59, 0.11));
_TMP3 = vec3(_grey0022, _grey0022, _grey0022) + _GloomSaturation*(_TMP15 - vec3(_grey0022, _grey0022, _grey0022));
_gloom = _TMP3*_GloomIntensity;
_grey0028 = dot(_base, vec3( 0.3, 0.59, 0.11));
_TMP3 = vec3(_grey0028, _grey0028, _grey0028) + _BaseSaturation*(_base - vec3(_grey0028, _grey0028, _grey0028));
_base = _TMP3*_BaseIntensity;
_TMP4 = min(vec3( 1.0, 1.0, 1.0), _gloom);
_TMP35 = max(vec3( 0.0, 0.0, 0.0), _TMP4);
_base = _base*(1.0 - _TMP35);
_TMP10 = (1.0 - (_base + _gloom))*_color1.w;
_ret_0 = vec4(_TMP10.x, _TMP10.y, _TMP10.z, _color1.w);
gl_FragColor = _ret_0;
return;
}