Hi Community,

me again on this. I have it working, however, it looks really bad when
using large coordinates (when placed on UTM or Geocentric). The model is
somewhat distorted due to precission issues. I know how to avoid this, like
working with double matrices, but when I pass double matrix on the vertex
shader it kills the performance - from 60Fps to ~1 fps. Bellow is the
vertex shader. Any hints?

Thanks a bunch as always

#version 150 compatibility

uniform mat4 osg_ModelViewProjectionMatrix;
uniform mat3 osg_NormalMatrix;
uniform vec3 lightDirection;

in vec3 vPosition;
in vec3 vNormal;
in vec2 vTexCoord;
in mat4 vInstanceModelMatrix;

smooth out vec2 texCoord;
smooth out vec3 normal;
smooth out vec3 lightDir;

void main()
{
gl_Position = /*osg_ModelViewProjectionMatrix*/
gl_ModelViewProjectionMatrix * vInstanceModelMatrix * vec4(vPosition, 1.0);
texCoord = vTexCoord;

mat3 instanceNormalMatrix = mat3(vInstanceModelMatrix[0][0],
vInstanceModelMatrix[0][1], vInstanceModelMatrix[0][2],
 vInstanceModelMatrix[1][0], vInstanceModelMatrix[1][1],
vInstanceModelMatrix[1][2],
 vInstanceModelMatrix[2][0], vInstanceModelMatrix[2][1],
vInstanceModelMatrix[2][2]);

normal = osg_NormalMatrix * instanceNormalMatrix * vNormal;
lightDir = lightDirection;
}

On Tue, Nov 25, 2014 at 12:06 PM, Robert Osfield <[email protected]>
wrote:

> Hi All,
>
> On 24 November 2014 at 09:28, Sebastian Messerschmidt <
> [email protected]> wrote:
>
>>  The example I was looking for was in the submissions, called:
>>
>> [osg-submissions] New example : culling and LODing performed on GPU side
>>
>> Unfortunately Robert didn't approve or merge the nescessary changes.
>> Maybe it went unnoticed.
>>
>
> I am still progressing through the submissions backlog and am delighted to
> say that this wee gem of an example is now checked into svn/trunk - look
> for osggpucull.  I haven't had a chance to spend the time understanding it
> yet, but the code is there.
>
> Robert.
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
trajce nikolov nick
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to