Results 1 to 3 of 3

Thread: Terrain tessellation in chunks?

  1. #1
    Member Contributor
    Join Date
    Dec 2011
    Posts
    64

    Terrain tessellation in chunks?

    Hi,

    Is there any possible "very fast" way to create mapchunks for tessellation?

    I have some pre-alpha ver, but it's laggy, because I'm using glTexImage2D to port heightmap to shader. There it's laggy problem.
    Do you know anyone better solution? Or it's very old technique using map chunks? And what I'm doing? 3D Map Editor, that's why is better use more chunks than one big map for more textures.

    Program class hiearchy:
    -> MapChunk
    -> MapTile(16x16 MapChunk) -> MapTile::draw call MapChunk::draw Vertex Array Object ==> glDrawArrays
    -> World (max 64x64 MapTile, currently using one MapTile) -> World::draw foreach MapTile do MapTile::draw
    -> MapView (QGLWidget) -> MapView:aintGL call World::draw
    -> MainWindow setCentralWidget

    Thanks for any reply!

  2. #2
    Member Contributor
    Join Date
    Dec 2011
    Posts
    64
    No one have any idea?

    When I use 4x4 MapChunk its still good, but 8x8 is little laggy, 16x16 ultra laggy.

    Function which lagging it is:
    Code :
    void Material::bind()
    {
        m_shader->bind(); // QOpenGLShaderProgramPtr == typedef QSharedPointer<QOpenGLShaderProgram> QOpenGLShaderProgramPtr; its binding shader...
     
        foreach(const GLuint unit, m_unitConfigs.keys())
        {
            const TextureUnitConfiguration& config = m_unitConfigs.value(unit);
     
            // Bind the texture
            m_funcs->glActiveTexture(GL_TEXTURE0 + unit); // m_funcs = QOpenGLFunctions, its in Qt.. working as normal glActiveTexture BUT there come slow down
            config.texture()->bind();
     
            // Bind the sampler
            config.sampler()->bind(unit);
     
            // Associate with sampler uniform in shader (if we know the name or location)
            if(m_samplerUniforms.contains(unit))
                m_shader->setUniformValue(m_samplerUniforms.value(unit).constData(), unit); // BIGGEST SLOW DOWN because it sending a lot uniforms, any idea how to post uniform with multi values fast?
        }
    }

  3. #3
    Member Contributor
    Join Date
    Dec 2011
    Posts
    64
    BUMPING!

    I have new result from debugging.

    Big enemy is still same = uniform. But not caused by textures, it slowed because each chunk in (16*16 = 256) use mapData[MAP_WIDTH / 16 * MAP_HEIGHT / 16 * sizeof(float)] which is binded to texture (glTexImage2D) and there is main problem, sending 256 uniforms per 16ms is alot! Have you any idea with better solution how to send through uniform 256 mapData (256 mean each chunk) (mapData == buffer with height).

Similar Threads

  1. Tessellation shaders: more control over the actual tessellation?
    By Ailurus in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 12-17-2015, 03:57 PM
  2. Only read specific chunks of a buffer
    By Moe in forum OpenCL
    Replies: 6
    Last Post: 11-19-2010, 05:08 PM
  3. Reliability of Custom PNG Chunks
    By glBomb in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-24-2007, 08:47 AM
  4. Breaking Rendering Chunks into Objects
    By camoguard in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-06-2007, 10:03 AM
  5. GS tessellation for terrain meshes
    By Mars_999 in forum OpenGL: Advanced Coding
    Replies: 17
    Last Post: 12-09-2006, 01:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean