Thursday, February 29, 2024
HomeGame Developmentopengl - Tips on how to subdivide the octahedron right into a...

opengl – Tips on how to subdivide the octahedron right into a sphere correctly?

For my undertaking I’ve to tessellate an octahedron right into a sphere. I’m part-way there however the issue is just the corners appear to be drawing. How do I get the entire form to attract? Analysis shader under as a result of that is the place the issue is to my data.

TES (Tessellation Analysis Shader)

   // bilinearly interpolate vertex coordinate throughout patch
    vec3 t0 = (t01 - t00) * u + t00;
    vec3 t1 = (t00 - t10) * v + t10;
    vec3 t2 = (t10 - t01) * w + t01;
    vec3 vert = (t1 - t0 - t2) * v + t0;

    // retrieve management level place coordinates
    vec4 p00 = gl_in[0].gl_Position;
    vec4 p01 = gl_in[1].gl_Position;
    vec4 p10 = gl_in[2].gl_Position;

    // compute patch floor regular
    vec4 u_vec = p01 - p00;
    vec4 v_vec = p10 - p00;
    vec4 w_vec = p10 - p01;
    vec4 regular = normalize( vec4(cross(,, 0) );

    // bilinearly interpolate place coordinate throughout patch
    vec4 p0 = (p01 - p00) * w + p00;
    vec4 p1 = (p00 - p10) * v + p10;
    vec4 p = (p1 - p0) * u + p0;

As a bonus, that is the specified impact I am on the lookout for with the present code base
enter image description here

As per @Primary suggestion, I modified round a couple of values which appears to have lowered the distortions however the form continues to be not fairly the place I would like it to be.
enter image description here



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments

Arnavsijapati on Planet of Lana – Beta Demo
Jai Kishor Upadhyay on Planet of Lana – Beta Demo