Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


glararan

Member Since 05 Aug 2013
Offline Last Active Nov 27 2014 10:39 AM

Topics I've Started

Tessellation tiles gaps

30 October 2014 - 05:47 PM

Hi there,

 

I'm looking for solution few months but still nothing. Last week I found new articles about this problematic. 2 articles saying there is problem with tessellation outer level. I set that settings for 0-3 to 7.0 but nothings changed.

 

What I tried for:

1) Set same height at neighbours... result: terrible!

Look:

8tp71LF.jpg

Red thing mean border between tile.

 

2) Draw another thing "neighbour-fixer?" Result? Some camera angles destroy effect "it's part of original tile". Check top right corner of green thing..

QqHhHAr.png

Another thing... its using a lot of vertices.. I mean it's bit inefficient sad.png but better than nothing.

 

3) Shader solution? I mean my shaders are written bad so there is bug but I don't know how to solve it.

 

So my real question is... Is third mark possible to fix this whole problem? Can be shaders written incorrect and can be written correct to fix this thing?

 

Original screen problem:

Eos2gx4.jpg

 

All images were posted with tess level outer I mentioned.

 

Width, height of map: 1024x1024

Tiles: 16 (256x256)

 

Articles:

http://gamedev.stackexchange.com/questions/70096/what-is-the-role-of-tessellation-in-terrain

https://developer.nvidia.com/sites/default/files/akamai/gamedev/files/sdk/11/TerrainTessellation_WhitePaper.pdf

http://stackoverflow.com/questions/23530807/glsl-tessellated-environment-gaps-between-patches

http://www.diva-portal.org/smash/get/diva2:566135/FULLTEXT01.pdf

 

 

Or do you have any other solution?

 

 

Vertex: http://pastebin.com/t2CrJ0f7

Geom: http://pastebin.com/C7JPGpeD

TCS: http://pastebin.com/rm5DgpPu

TES: http://pastebin.com/DsruCktp

 

Thanks for reply and help! smile.png


Terrain LOD tessellation cracks

02 June 2014 - 12:20 PM

Hi,

 

I have terrain based on level of detail. I'm using tessellation and I have cracks between each map. I have no idea how to fix this.

 

If someone have an idea please, share it with me. Thanks!

 

Below you can see cracks between map (red lines mean border of each map)

 

KjpGWDi.jpg


Flatten tool - angle

03 January 2014 - 03:30 PM

Hello,
 
I'm coming for advice how to make flatten tool with option angle.
 
What I have done?
Simple, I have whole function for making flat terrain, also in following picture you can see its working.
e8dffc91ec40d3ac150e75429b479a71.png

 

I'm using following formula to making terrain flatten:

// @change(float) = pow(0.2f, dt)
// @mapData[index](float): heightmap
// @y(float): height at cursor position
float changeFormula = change * mapData[index] + (1 - change) * y;

mapIndex[index] = changeFormula;

// sending mapIndex[index] to repaint

Now what I want to do with terrain?

Simple again... following picture for better describing

90c4a130e194940563ed105bbc8320ca.png

 

Biggest trouble for me is making formula, I don't know how to make it. If you are math genius tell me please what I need or if its very easy for you if you can solve it.

 

Thanks.


Qt5 - QOpenGL terrain, trying get terrain coords by mouse

06 August 2013 - 12:43 PM

Hello,

I looking for something what will return xyz position on my terrain.

I used gluUnProject, but it still returning “nan” values

gluUnProject:

  1. GLint viewport[4];
  2.         GLdouble modelview[16], projection[16], posX, posY, posZ;
  3.         GLfloat winX, winY, winZ;
  4.  
  5.        // m_funcs = QOpenGLFunctions_4_1_Core
  6.        m_funcs->glGetIntegerv(GL_VIEWPORT, viewport);
  7.        m_funcs->glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
  8.        m_funcs->glGetDoublev(GL_PROJECTION_MATRIX, projection);
  9.  
  10.         winX = mouse_position.x();
  11.         winY = static_cast<float>(viewport[3]) - mouse_position.y();
  12.  
  13.         m_funcs->glReadPixels(winX, winY, 1, 1, GL_DEPTH_COMPONENT,GL_FLOAT, &winZ);
  14.         gluUnProject(winX, winY, winZ, modelview, projection, viewport, &posX,&posY, &posZ);
  15.  
  16.         terrain_pos = QVector3D(posX, posY, posZ);

 

gluUnProject v2:

  1. GLint viewport[4];
  2.         GLdouble modelview[16], projection[16], posX, posY, posZ;
  3.         GLfloat winX, winY, winZ;
  4.  
  5.         int indexing = 0;
  6.  
  7.         // passing from own Camera class QMatrix4x4 modelView, projection and viewport
  8.         for(int i = 0; i < 4; i++)
  9.         {
  10.             viewport[i] = viewMatrix(0, i);
  11.  
  12.             for(int j = 0; j < 4; j++)
  13.             {
  14.                 modelview[indexing] = modelViewMatrix(i, j);
  15.                 projection[indexing] = mvp(i, j);
  16.  
  17.                 indexing++;
  18.             }
  19.         }
  20.  
  21.         winX = mouse_position.x();
  22.         winY = /*static_cast<float>(viewport[3]) -*/ mouse_position.y();
  23.  
  24.         m_funcs->glReadPixels(winX, winY, 1, 1, GL_DEPTH_COMPONENT,GL_FLOAT, &winZ);
  25.         gluUnProject(winX, winY, winZ, modelview, projection, viewport, &posX,&posY, &posZ);
  26.  
  27.         terrain_pos = QVector3D(posX, posY, posZ);

 

Every array and params have values in gluUnProject v2, so I don’t know why it returns nan :(

Then I tried to use some code from google, but it returns out range positions

  1. QMatrix4x4 mProjection = m_camera->viewMatrix() * m_camera->projectionMatrix();
  2.         QMatrix4x4 mInverse = mProjection.inverted();
  3.  
  4.         float in[4];
  5.         float winZ = 1.0f;
  6.  
  7.         in[0] = (2.0f * ((float)(mouse_position.x() - 0) / (this->width() - 0))) - 1.0f,
  8.         in[1] = 1.0f - (2.0f * ((float)(mouse_position.y() - 0) / (this->height() - 0)));
  9.         in[2] = 2.0f * winZ - 1.0f;
  10.         in[3] = 1.0f;
  11.  
  12.         QVector4D vIn(in[0], in[1], in[2], in[3]);
  13.  
  14.         QVector4D Vpos = vIn * mInverse;
  15.  
  16.         Vpos.setW(1.0f / Vpos.w());
  17.         Vpos.setX(Vpos.x() * Vpos.w());
  18.         Vpos.setY(Vpos.y() * Vpos.w());
  19.         Vpos.setZ(Vpos.z() * Vpos.z());
  20.  
  21.         terrain_pos = QVector3D(Vpos.x(), Vpos.y(), Vpos.z());

Is any better way to get heightmap xyz in Qt? Or its possible with Qt OpenGL and not with basic GL? Or why it doesnt work?

Using QGLWidget with QOpenGL headers and GL version 4.1

 

Pic from app: (I have debug mode, so I see QVector3D posX, posY, posZ returning nan)

34df6076f7cd758f8ba10f6ca928e875.png

 


PARTNERS