nicer point render

This commit is contained in:
2019-09-14 01:58:16 -04:00
parent 4021466703
commit b8eabc74b9
2 changed files with 6 additions and 1 deletions

View File

@@ -3,9 +3,12 @@
uniform vec4 color; uniform vec4 color;
in vec4 v; in vec4 v;
in vec4 screen;
out vec4 fcolor; out vec4 fcolor;
const float scale = .2;
vec3 hsv2rgb(vec3 c) { vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
@@ -14,4 +17,5 @@ vec3 hsv2rgb(vec3 c) {
void main(){ void main(){
fcolor = color; fcolor = color;
fcolor.xyz *= smoothstep(scale, -scale, screen.z);
} }

View File

@@ -4,11 +4,12 @@ uniform mat4 proj;
in vec4 pos; in vec4 pos;
out vec4 v; out vec4 v;
out vec4 screen;
void main(){ void main(){
v = pos; v = pos;
/* stereographic projection */ /* stereographic projection */
vec4 vert = vec4(pos.xyz / (1 - pos.w), 1); vec4 vert = vec4(pos.xyz / (1 - pos.w), 1);
gl_Position = proj * vert; screen = gl_Position = proj * vert;
} }