Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Best Way to Texture Merged Geometries?

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2017
    Posts
    5

    Best Way to Texture Merged Geometries?

    Hello!

    I am converting many cubes may or may not share faces into a single mesh (chunk rendering).

    I remove all indices of triangles that our not on the the outside faces of the combined cubes mesh. Can I remove all vertices that are not on the corners of the new mesh and still render the texture in a tiled format? Would I need to have separate textures for each side of the cube face, draw each face of the combined cubes mesh separate from each other, and then tile each face with side exclusive textures? (what is the capability and nature of GL_REPEAT?)

    Or should I keep all outer vertices in the combined mesh, buffer the same texture coordinates for each respective vertex buffered, and be satisfied with eliminating all inner vertices?

  2. #2
    Member Regular Contributor
    Join Date
    May 2016
    Posts
    443
    opengl only renders "primitives", not "vertices". for example, GL renders a triangle if you provide 3 vertices. your 3D mesh ("chunked" together or not) has to be made up of triangles, or other primitives. that means, if you want to chunk together 2 intersecting cubes, you have to calculate the edges where they intersect, and then subdivide intersecting primitives. those primitives who are within the geometry, can be removed (if everything is non-transparent), the other primitives remain. texturing isnt the problem, the problem is to calculate new vertices (including their texture coordinates) for subdivided primitives and to determine if a primitive is totally within the geometry, another thing to consider is to verify if the geometry is completely closed by primitives.

    https://www.khronos.org/opengl/wiki/...value_sampling
    https://www.khronos.org/opengl/wiki/...ing_parameters

    example: a triangulated cube's corner is a bit within the center of another triangulated cube's face (triangle). that means in order to "eliminate" corner the vertex within, you have to calculate 3 other vertices that cut off the corner vertex. not only that, to close the geometry again, you have to add (i think) 6 new faces. so if you goal is to improve performance, thats not really beneficial ...
    Last edited by john_connor; 11-20-2017 at 02:43 AM.

Posting Permissions

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