wickeD

01-08-2015, 12:49 PM

Hi people!

This is my first thread, so please be patient ;) also I do not have much experience with openGL in general, but had to learn several parts for a project at my university. Thus, my problem may seem very basic for you.

I have written a tessellation shader, making use of PN-Triangles, to make too coarse meshes look more round and organic. There is a paper called "Curved PN triangles" describing the mathematical background, if anyone is interested. Basically, a given triangle is subdivided into many small triangles and the new vertices are placed on a baggy cubic surface, which is fitted to the original triangle's edges. Its basically a bezier surface patch, if I am not mistaking. My implementation tessellates the given triangles (or patches) depending on their distance from the camera. This all works great so far, but is very expensive for scenes with many primitives (I work with triangles only, as you might have already guessed ;)) .

Now I want to save some processing power by pre-computing the control points on the CPU and transferring it to the GPU once. Since my mesh does not deform or stuff, the control points do not change and thus must not be recomputed by the TCS in every frame. My problems are:

* How can I transfer the array with all my control points (and the control normals) to the GPU memory? The array would have numberFaces * 16 * 3 elements, because per triangle I need 10 float vec3 for the control points and 6 float vec3 for the control normals. Uniforms don't seem to be able to hold that much data, is a Texture buffer the right approach?

* How can I determine in the TES, which triangle (or patch) is processed? I need this information to address the right elements in my control points array. Is glPrimitiveID the right answer?

Well, I hope I could explain my problems understandingly and I really appreciate any help.

Regards,

wickeD

This is my first thread, so please be patient ;) also I do not have much experience with openGL in general, but had to learn several parts for a project at my university. Thus, my problem may seem very basic for you.

I have written a tessellation shader, making use of PN-Triangles, to make too coarse meshes look more round and organic. There is a paper called "Curved PN triangles" describing the mathematical background, if anyone is interested. Basically, a given triangle is subdivided into many small triangles and the new vertices are placed on a baggy cubic surface, which is fitted to the original triangle's edges. Its basically a bezier surface patch, if I am not mistaking. My implementation tessellates the given triangles (or patches) depending on their distance from the camera. This all works great so far, but is very expensive for scenes with many primitives (I work with triangles only, as you might have already guessed ;)) .

Now I want to save some processing power by pre-computing the control points on the CPU and transferring it to the GPU once. Since my mesh does not deform or stuff, the control points do not change and thus must not be recomputed by the TCS in every frame. My problems are:

* How can I transfer the array with all my control points (and the control normals) to the GPU memory? The array would have numberFaces * 16 * 3 elements, because per triangle I need 10 float vec3 for the control points and 6 float vec3 for the control normals. Uniforms don't seem to be able to hold that much data, is a Texture buffer the right approach?

* How can I determine in the TES, which triangle (or patch) is processed? I need this information to address the right elements in my control points array. Is glPrimitiveID the right answer?

Well, I hope I could explain my problems understandingly and I really appreciate any help.

Regards,

wickeD