• Create Account

# glararan

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

### In Topic: Tessellation tiles gaps

24 November 2014 - 09:19 AM

That's not actually my problem like in video.. I don't have these problems with terrain

### In Topic: Tessellation tiles gaps

22 November 2014 - 04:23 PM

bump

### In Topic: Tessellation tiles gaps

31 October 2014 - 08:06 AM

So I should change TES shader. If I understand correct, I have to change following code:

```    // Calculate the normal
// This could be moved to a one-time pre-process step to create a normal map.
// This would be a good candidate for a compute shader.
// For deformable terrain, would need re-generating when terrain is modified
const ivec3 offset = ivec3(-1, 0, 1); // Texel offsets

float delta  = 2.0 * horizontalScale / textureSize(heightMap, 0).x; // Horizontal displacement in world coords
float left   = textureOffset(heightMap, Out.texCoords, offset.xy).r;
float right  = textureOffset(heightMap, Out.texCoords, offset.zy).r;
float top    = textureOffset(heightMap, Out.texCoords, offset.yz).r;
float bottom = textureOffset(heightMap, Out.texCoords, offset.yx).r;

vec3 x = normalize(vec3(delta, right - left, 0.0));
vec3 z = normalize(vec3(0.0, top - bottom, delta));
vec3 n = cross(z, x);
```

### In Topic: Terrain LOD tessellation cracks

02 June 2014 - 01:41 PM

Thanks.

### In Topic: Qt5 - QOpenGL terrain, trying get terrain coords by mouse

09 August 2013 - 06:57 AM

BUMP

I’m trying to get terrain coords from camera QMatrix4×4, but it returns incorrets values.

Im using in camera these properties:
viewMatrix, projectionMatrix and viewProjectionMatrix.

I tried to figure it out with this code:

1.         QMatrix4x4 inverted = m_camera->projectionMatrix() * m_camera->viewMatrix();
2.         inverted = inverted.inverted();
3.
4.         float posZ;
5.
6.         // m_funcs = QOpenGLFuncions_4_0_Core
7.         m_funcs->glReadPixels(mouse_position.x(), mouse_position.y(), 1, 1,GL_DEPTH_COMPONENT, GL_FLOAT, &posZ);
8.
9.         QVector4D clickedPointOnScreen(mouse_position.x(),mouse_position.y(), posZ, 1.0f);
10.         QVector4D clickedPointIn3DOrgn = inverted * clickedPointOnScreen;
11.
12.         terrain_pos = clickedPointIn3DOrgn.toVector3D();
13.
14.         qDebug()  << terrain_pos;

I’m with camera on position: 250.0f, 10.0f, 250.0f
And I’m getting: QVector3D(415.715, 99.3959, 6.45992) (cursor is in center ofQGLWidget screen, i calculated coords). It should be QVector3D(250.0f, 10.0f, 260f+-)

PARTNERS