E
Elson Ng
Guest
Hi all, I have been trying to recreate the following illustration but I only managed to get the grayscale to work.
Here is what i am trying to achieve:
First - my background and objects in game are turned into grayscale by a shader in real time
Second - only pixels around my player are coloured
This is the grayscale shader i am using:
This is what i have at the moment:
I have passed all the objects other than the player through the grayscale shader and I also have
a lighting effect in a circle around my player.
How would I be able to achieve the second part? Any help would be greatly appreciated !! Thanks a lot in advance
Here is what i am trying to achieve:
First - my background and objects in game are turned into grayscale by a shader in real time
Second - only pixels around my player are coloured
This is the grayscale shader i am using:
Code:
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
const vec3 weight = vec3(0.2215, 0.7154, 0.0721);
void main()
{
vec4 irgba=texture2D(gm_BaseTexture,v_vTexcoord);
float luminance=dot(irgba.rgb, weight);
gl_FragColor=vec4(luminance,luminance,luminance,irgba.a);
}
This is what i have at the moment:
I have passed all the objects other than the player through the grayscale shader and I also have
a lighting effect in a circle around my player.
How would I be able to achieve the second part? Any help would be greatly appreciated !! Thanks a lot in advance
Last edited by a moderator: