Open PenguinVEVO opened 2 years ago
Hey, I just saw your issue today...
All shaders works correctly here, in Linux. You are in Windows and, as it woks on DirectX, instead of OpenGL, you should change some parts of the code to make it work. If I don't remember wrong, instead of vec4
, you should use float4... but it would be better if you see this link: https://learn.microsoft.com/en-us/windows/uwp/gaming/glsl-to-hlsl-reference
I have changed the vector types from vec to float, and that has solved that issue, and I have also changed the file type from GLSL to HLSL using Visual Studio, but I have run into a new issue. After running the shader again in OBS, it now comes up with "error X3000: syntax error: unexpected token 'new'." It doesn't seem to like the "new" functions, and I don't know what to change it to. I wasn't able to find anything on this either.
In which shader you have that error?
I'm having that error in the Chromatic Aberration shader, as that's the one I'm currently trying to fix. All but two shaders work because of the vec4 problem.
This is the original code:
/* Chromatic Aberration
*/
#pragma shaderfilter set chromab_dist__description Distance
#pragma shaderfilter set chromab_dist__default 2
#pragma shaderfilter set chromab_dist__min 0
#pragma shaderfilter set chromab_dist__max 8
#pragma shaderfilter set chromab_dist__slider true
uniform float chromab_dist;
vec4 render(vec2 uv) {
vec3 new = vec3(0.0);
vec3 distance = vec3(1.0-(chromab_dist*0.01), 1.0-(chromab_dist*0.02), 1.0-(chromab_dist*0.03));
new.r = vec3(texture2D(image, (uv - vec2(0.50,0.50)) * distance[0] + vec2(0.50,0.50))).r;
new.g = vec3(texture2D(image, (uv - vec2(0.50,0.50)) * distance[1] + vec2(0.50,0.50))).g;
new.b = vec3(texture2D(image, (uv - vec2(0.50,0.50)) * distance[2] + vec2(0.50,0.50))).b;
return vec4(new, 1.0);
}
Look at the line that includes the "new" word. new
is a vec3
variable. As you say, error says unexpected token 'new'
... maybe you have to initialize it with vec3
before the name of the variable. Or float3
or whatever you are using instead of vec3
.
I tried to use these shaders with ShaderFilter Plus, but only two of the shaders worked. I always get an error like this:
Could not create the effect due to the following error: device_pixelshader_create (D3D11): Compiler warnings/errors for C:/Program Files/obs-studio/obs-plugins/64bit/ShaderFilter-Plus/obs-shaders/chromatic_aberration.glsl (Pixel shader, technique Draw, pass 0): C:\Program Files\obs-studio\obs-plugins\64bit\ShaderFilter-Plus\obs-shaders\chromatic_aberration.glsl (Pixel shader, technique Draw, pass 0)(12,1-4): error X3000: unrecognized identifier 'vec4'
Pass (0) <> missing pixel shader!
Only the "wave" and "quad_don_gilberto_manhatten_ruiz" shaders work. Am I missing something or is there a problem with the code?