glsl - OpenGL 4: Stitched tesselation patches dont fit together -


The issue is resolved, see below for improvement

Im I am trying to implement TDM's "Sespap" (see here) with rectangular patch, tocellation and custom level expansion. Unfortunately I can not get the correct gl_LessLevelOuter . There are some small holes between the patch

I made Skybox Red to emphasize the error.

I use glDrawArraysInstanced to attract 64 x 10 * 10 patch and rearrange them in the peak shader around the position of the camera:

< 330 cores in pre> #version vec3 in_Position; Out vc3 ex_Position; Layout (standard 140) Uniforms Uniforms {layout (line_comb) matte 4mvp; Layout (line_comb) mat4 vp; Vec3 CameraPos; Float time; VC3 Sun; }; Const float patch size = 10; Const int patchCount = 64; Zero main () {ex_Position = in_Position; Ex_Position.xz + = patchSize * vec2 (gl_InstanceID% patchCount-patchCount / 2, integer (gl_InstanceID / patchCount) -patchCount / 2); Ex_Position.xz + = patchSize * floor (cameraPos.xz / patchSize); }

Then I calculate the level of detail in the exhaustion control shader:

  #version 410 out of the main layout (corner = 4); Vec3 in ex_Position []; Out vec3 tc_Position []; Layout (standard 140) Uniforms Uniforms {layout (line_comb) matte 4mvp; Layout (line_comb) mat4 vp; Vec3 CameraPos; Float time; VC3 Sun; }; Const int maxLevel = 64; Const float maximum distance = 100; Int Gate Less (Wake 3p) {Float L = Distance (P, CameraPos); Return Int ((Maximum-Level-1) * (1.0-Clamp (L, 0, MaxDistance) / Max Distance)) + 1; } Zero main () {tc_Position [gl_InvocationID] = ex_Position [gl_InvocationID]; If (gl_InvocationID == 0) {vec3 d0 = ex_Position [0] + (exposition [1] -ex_Position [0]) / 2; Vec3 d1 = ex_Position [1] + (exposition [2] -ex_Position [1]) / 2; Vec3 D2 = Exposise [2] + (Exposise [3] -exposazas [2]) / 2; Vec3 D3 = Exposure [3] + (Exposition [0] -exposazas [3]) / 2; Gl_LessLevelOuter [0] = Milltail Level (D); Gl_LessLevelOuter [1] = Matching Level (D1); Gl_LessLevelOuter [2] = Friendly level (D2); Gl_LessLevelOuter [3] = getTessLevel (D3); Gl_LessLevelInner [0] = gl_LessLevelOuter [0]; Gl_LessLevelInner [1] = gl_LessLevelOuter [1]; }}  

I think the error is somewhere in the TCS shader, but I can not find the correct way to calculate the level of stress.

Correction

  Zero main () {tc_Position [gl_InvocationID] = ex_Position [gl_InvocationID]; If (gl_InvocationID == 0) {vec3 d0 = ex_Position [2] + (exposition [2] -ex_Position [1]) / 2; Vec3 d1 = ex_Position [0] + (exposition [1] -ex_Position [0]) / 2; Vec3 d2 = ex_Position [3] + (exposition [3] -ex_Position [0]) / 2; Vec3 D3 = Exposise [2] + (Exposure [3] -exposazas [2]) / 2; Gl_LessLevelOuter [0] = Milltail Level (D); Gl_LessLevelOuter [1] = Matching Level (D1); Gl_LessLevelOuter [2] = Friendly level (D2); Gl_LessLevelOuter [3] = getTessLevel (D3); Gl_LessLevelInner [0] = Blend (Glost LevelOnoutor [1], Glost Levelvalueer [2], 0.5); Gl_LessLevelInner [1] = Blend (Glost LevelOnuar [0], Glost LevelOnPureer [3], 0.5); }}  


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -