osgearth icon indicating copy to clipboard operation
osgearth copied to clipboard

Problems encountered using Vertical Scale?

Open oOoBinoOo opened this issue 1 year ago • 2 comments

Hello, when using VerticalScale, when the coefficient becomes larger, the earth will be enlarged, and there will be a vacancy around it. May I ask how to solve this problem? image

oOoBinoOo avatar Sep 21 '22 08:09 oOoBinoOo

<terrainshader>
    <uniform name="scale" value="20.0"/>
    <code>
        <![CDATA[
               #pragma vp_entryPoint applyScale
               #pragma vp_location vertex_view

               uniform float scale;
               vec4 oe_layer_tilec;
               vec3 oe_UpVectorView;
               float oe_terrain_getElevation(in vec2);

               void applyScale(inout vec4 vertexView)
               {
                   float e = oe_terrain_getElevation(oe_layer_tilec);
                   vertexView.xyz += oe_UpVectorView*e*(scale-1.0);
               }
             ]]>
    </code>
</terrainshader>

oOoBinoOo avatar Sep 21 '22 08:09 oOoBinoOo

This happens because the view frustum is computed on the CPU from the original geometry. But then, you are moving the vertices on the GPU in a shader. The CPU has no knowledge of this so it connect account for the shader's changes. There is nothing to address this in OpenSceneGraph or osgEarth.

gwaldron avatar Sep 21 '22 12:09 gwaldron