belaf
March 2, 2021, 12:48pm
1
Is it possible to use postprocess vignette effect only on a texture?
I mapped out a texture to a mesh, and i want to feather the textures edges.
The best solution would be if the size of the feathered edges could be adjusted individually for each side,
but the built in vignette effect would be a huge progress too.
Thanks in advance!
Welcome aboard!
No, the vignette image processing effect applies as a post process to the whole screen.
However, I guess you could take the vignette code from the existing shader and use it in your own shader material:
#ifdef VIGNETTE
//vignette
vec2 viewportXY = gl_FragCoord.xy * vInverseScreenSize;
viewportXY = viewportXY * 2.0 - 1.0;
vec3 vignetteXY1 = vec3(viewportXY * vignetteSettings1.xy + vignetteSettings1.zw, 1.0);
float vignetteTerm = dot(vignetteXY1, vignetteXY1);
float vignette = pow(vignetteTerm, vignetteSettings2.w);
// Interpolate between the artist 'color' and white based on the physical transmission value 'vignette'.
vec3 vignetteColor = vignetteSettings2.rgb;
#ifdef VIGNETTEBLENDMODEMULTIPLY
vec3 vignetteColorMultiplier = mix(vignetteColor, vec3(1, 1, 1), vignette);
result.rgb *= vignetteColorMultiplier;
#endif
#ifdef VIGNETTEBLENDMODEOPAQUE
result.rgb = mix(vignetteColor, result.rgb, vignette);
#endif
#endif
Pryme8
March 2, 2021, 8:25pm
3
3 Likes