View Full Version : Graphics w/o vertices/voxels, a new rendering system by Tcll5850

02-14-2014, 08:15 PM
I'm actually coming here to see what help I can get from the big boys on this,
since nobody else I know is skilled enough to answer my Q's here... heh

I've got a thread on my forum that explains the idea:

and Google is pretty much useless as all the algorithm's found are for simple stuff...
I got lucky to find an algorithm for a circle that works like I need. (though it's slow as heck)

I graduated school with Algebra1 knowledge (they held me back because I'm slow),
but luckily I know a bit of basic college-level geometry/trigonometry (I literally just know it) to somewhat help me out.
so yea... I'm having quite a difficult time trying to wrap my head around this stuff.

may I PLEASE get some help on this.
thanks, and credit to you in return. :)

02-15-2014, 11:35 PM
Search under "procedural shaders" you will find a lot of information. For a sphere try rendering a quad with this fragment shader

#version 330
out vec4 vFragColor;

uniform vec3 Color;
uniform vec3 lightDir;

void main(void)
// calculate normal from texture coordinates
vec3 N;
N.xy = gl_PointCoord* 2.0 - vec2(1.0);
float mag = dot(N.xy, N.xy);
if (mag > 1.0) discard; // kill pixels outside circle
N.z = sqrt(1.0-mag);

// calculate lighting
float diffuse = max(0.0, dot(lightDir, N));

vFragColor = vec4(Color,1) * diffuse;