Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Graphics w/o vertices/voxels, a new rendering system by Tcll5850

  1. #1
    Junior Member Newbie Tcll5850's Avatar
    Join Date
    Feb 2014

    Question Graphics w/o vertices/voxels, a new rendering system by Tcll5850

    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.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Search under "procedural shaders" you will find a lot of information. For a sphere try rendering a quad with this fragment shader
    Code :
    #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;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts