Hello, my friend iyad needs some helo with his glsl code, here is what he asked me to ask the issue here:
"I have this shader which is just a prewitt operator, I feed it the depth texture, the goal was to outline objects, and it works great when the camera is close to surface, but breakes otherwise
is there a way to create true stencil outliunes in upbge, and access them in shader?
if not how can this one be fixed, to get something similar to Unity’s “Edge Detect Effect Normals” post processing effect
i think it cannot be done at the filter level.
but someone comments in the video below:
“”"
To get an outline around an object in front of another object, couldn’t you just take the difference between the depth values of the pixels and see if it’s above a certain threshold? All you would have to do is change your second if statement to something like:
if (abs(depth.r - new_depth.r) >= .01)
This would make some objects have outlines around parts in front of it (a character’s arm would have an outline if it were in front of its body), but I don’t think this behavior would be a problem.
“”"
Also if i put yellow plane below monkey, monkey outline will be for 50% so it’s not 100% working but nice results, only had a cellshader before and that shaded every cell, ill keep an eye on this because this outline thingy is very usefull.
I dont know what that last error message means but its not a shader error so it works.
the filter do what it should do: blur the outline in a cheap way. It was your idea
play with the LOD_BIAS and BLUR_SIZE to control the amount of blur.