I'm trying to make a circular particle that looks like it's got a light shining on the top of it.
Here's what I'm trying to get it to look like:
Here's what it currently looks like:
Since I'm using GL_POINTS, I get the gl_PointCoord variable which should make things easier, except I don't know how to use it properly, which led to this mess:
varying lowp vec4 DestinationColor;
void main(void) {
lowp vec2 circCoord = 2.0 * gl_PointCoord - 1.0;
if (dot(circCoord, circCoord) > 1.0) {
discard;
}
gl_FragColor = mix(DestinationColor, vec4(1, 0.5, 0.2, 1), (1.0-gl_PointCoord.t)*(max(abs(gl_PointCoord.t-0.5),abs(gl_PointCoord.s-0.5)))); // the world's worst slowest math
}
I would highly appreciate any help, as I'm stuck thanks to my awful math skills.