[quote=“rasteron”]Thanks for sharing 1vank I’m looking for something like this as well.
One question though, how do you make the outline more of a solid color, like in toon effect?[/quote]
This is not feature, this is bug xD A lot of blur
vec4 blurredMask = GaussianBlur(3, vec2(0.0, 1.0), vec2(0.008, 0.008), 2.0, sNormalMap, vScreenPosInv);
blurredMask = blurredMask + GaussianBlur(3, vec2(1.0, 0.0), vec2(0.008, 0.008), 2.0, sNormalMap, vScreenPosInv);
blurredMask = blurredMask + GaussianBlur(3, vec2(0.0, 1.0), vec2(0.004, 0.004), 2.0, sNormalMap, vScreenPosInv);
blurredMask = blurredMask + GaussianBlur(3, vec2(1.0, 0.0), vec2(0.004, 0.004), 2.0, sNormalMap, vScreenPosInv);
If you want to fully solid color change shader
void PS()
{
vec3 rgb = texture2D(sDiffMap, vScreenPos).rgb;
vec3 mask = texture2D(sNormalMap, vScreenPosInv).rgb;
vec4 blurredMask = GaussianBlur(3, vec2(0.0, 1.0), vec2(0.008, 0.008), 2.0, sNormalMap, vScreenPosInv);
blurredMask = blurredMask + GaussianBlur(3, vec2(1.0, 0.0), vec2(0.008, 0.008), 2.0, sNormalMap, vScreenPosInv);
blurredMask = blurredMask + GaussianBlur(3, vec2(0.0, 1.0), vec2(0.004, 0.004), 2.0, sNormalMap, vScreenPosInv);
blurredMask = blurredMask + GaussianBlur(3, vec2(1.0, 0.0), vec2(0.004, 0.004), 2.0, sNormalMap, vScreenPosInv);
if (mask.rgb == vec3(1.0, 1.0, 1.0))
gl_FragColor = vec4(rgb, 1.0);
else if (GetIntensity(blurredMask.rgb) > 0.01)
gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
else
gl_FragColor = vec4(rgb, 1.0);
}
Edit:The object is cloned to another scene to receive his mask may be exist a different method