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 3 of 3

Thread: Terrain tessellation in chunks?

  1. #1
    Intern Contributor
    Join Date
    Dec 2011
    Posts
    54

    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
    Intern Contributor
    Join Date
    Dec 2011
    Posts
    54
    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
    Intern Contributor
    Join Date
    Dec 2011
    Posts
    54
    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).

Tags for this Thread

Posting Permissions

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