Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2017-07-28 Thread Trajce Nikolov NICK
Hi Dario,

my work supposed to be part of an opensource project but the development
has ended without a chance to implement this.

Have a look here,
http://3dcgtutorials.blogspot.mk/2013/09/instancing-with-openscenegraph-part-ii.html

Also, instead of using OpenGL code for the VertexAttribsDivisor Robert
added (If I remember correctly) OSG wraps for it.

Hope this helps,

Cheers!
Nick


On Tue, Jul 25, 2017 at 11:10 AM, Dario Frost  wrote:

>
> Trajce Nikolov NICK wrote:
> > Hi Roman,
> > Once I complete some working version I will post my code, no problem.
> Maybe Sebastian can provide some snips from his NodeVisitor as well ;-)
> >
> > Nick
> >
>
>
> Hi,
> I know I am bringing this topic back to life but I am stuck for a very
> similar problem.
>
> Where can I find the code Nick developed?
> I am having tons of problems with instancing and custom attributes
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=71312#71312
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2017-07-27 Thread Dario Frost

Trajce Nikolov NICK wrote:
> Hi Roman,
> Once I complete some working version I will post my code, no problem. Maybe 
> Sebastian can provide some snips from his NodeVisitor as well ;-)
> 
> Nick
> 


Hi,
I know I am bringing this topic back to life but I am stuck for a very similar 
problem.

Where can I find the code Nick developed?
I am having tons of problems with instancing and custom attributes

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=71312#71312





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2014-12-01 Thread Trajce Nikolov NICK
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 robert.osfi...@gmail.com
wrote:

 Hi All,

 On 24 November 2014 at 09:28, Sebastian Messerschmidt 
 sebastian.messerschm...@gmx.de 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
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2014-12-01 Thread Sebastian Messerschmidt

Hi Nick,

One way to improve this is to place your root somewhere near the 
center of your instanced geometry and subtract the center from your 
instances positions.
This way the coordinates to be multiplied stay small in relation (as the 
big precision loss due to View*Model is done on the CPU side (during 
cull) instead of multiplying big coordinates one the GPU with the inverse.
So decorate your CustomGeometry subgraph with a transform and modify 
your instances position accordingly.

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 
robert.osfi...@gmail.com mailto:robert.osfi...@gmail.com wrote:


Hi All,

On 24 November 2014 at 09:28, Sebastian Messerschmidt
sebastian.messerschm...@gmx.de
mailto:sebastian.messerschm...@gmx.de 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
osg-users@lists.openscenegraph.org
mailto:osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




--
trajce nikolov nick


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2014-12-01 Thread Trajce Nikolov NICK
Thanks Sebastian.I could of thought of this. Let me give  it a shot. Thanks
again!

Nick

On Mon, Dec 1, 2014 at 9:26 AM, Sebastian Messerschmidt 
sebastian.messerschm...@gmx.de wrote:

  Hi Nick,

 One way to improve this is to place your root somewhere near the center
 of your instanced geometry and subtract the center from your instances
 positions.
 This way the coordinates to be multiplied stay small in relation (as the
 big precision loss due to View*Model is done on the CPU side (during cull)
 instead of multiplying big coordinates one the GPU with the inverse.
 So decorate your CustomGeometry subgraph with a transform and modify your
 instances position accordingly.

 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 robert.osfi...@gmail.com
  wrote:

 Hi All,

 On 24 November 2014 at 09:28, Sebastian Messerschmidt 
 sebastian.messerschm...@gmx.de 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
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




  --
 trajce nikolov nick


 ___
 osg-users mailing 
 listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2014-12-01 Thread Trajce Nikolov NICK
Yeah, work well now. Thanks !!!

Nick

On Mon, Dec 1, 2014 at 9:45 AM, Trajce Nikolov NICK 
trajce.nikolov.n...@gmail.com wrote:

 Thanks Sebastian.I could of thought of this. Let me give  it a shot.
 Thanks again!

 Nick

 On Mon, Dec 1, 2014 at 9:26 AM, Sebastian Messerschmidt 
 sebastian.messerschm...@gmx.de wrote:

  Hi Nick,

 One way to improve this is to place your root somewhere near the center
 of your instanced geometry and subtract the center from your instances
 positions.
 This way the coordinates to be multiplied stay small in relation (as the
 big precision loss due to View*Model is done on the CPU side (during cull)
 instead of multiplying big coordinates one the GPU with the inverse.
 So decorate your CustomGeometry subgraph with a transform and modify your
 instances position accordingly.

 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 
 robert.osfi...@gmail.com wrote:

 Hi All,

 On 24 November 2014 at 09:28, Sebastian Messerschmidt 
 sebastian.messerschm...@gmx.de 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
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




  --
 trajce nikolov nick


 ___
 osg-users mailing 
 listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




 --
 trajce nikolov nick




-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2014-11-25 Thread Robert Osfield
Hi All,

On 24 November 2014 at 09:28, Sebastian Messerschmidt 
sebastian.messerschm...@gmx.de 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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2014-11-24 Thread Sebastian Messerschmidt

HI Trajce,

I implemented HW Instancing using the UBO and texture approach using the 
osgforest example as a guide.
The majority of the work in my project lied in developing a visitor 
making arbitrary geometry nodes instanceable.
I also experimented with geometry shader based billboard instancing, 
which worked nice for trees etc.
And I do remember some example featuring GPU culling and instancing, but 
I cannot find it in the mailing list right now




Hi Community

I found this blog 
http://3dcgtutorials.blogspot.de/2013/09/instancing-with-openscenegraph-part-ii.html 
and found it very interesting. Although the description is very well 
written the code samples seams incomplete and sort of outdated. Was to 
ask you if any of you have done some work with this and is willing to 
share hints, code snippets?


Thanks a bunch as always,
Nick

--
trajce nikolov nick


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2014-11-24 Thread Sebastian Messerschmidt

And again:

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.


Cheers
Sebastian


HI Trajce,

I implemented HW Instancing using the UBO and texture approach using 
the osgforest example as a guide.
The majority of the work in my project lied in developing a visitor 
making arbitrary geometry nodes instanceable.
I also experimented with geometry shader based billboard instancing, 
which worked nice for trees etc.
And I do remember some example featuring GPU culling and instancing, 
but I cannot find it in the mailing list right now




Hi Community

I found this blog 
http://3dcgtutorials.blogspot.de/2013/09/instancing-with-openscenegraph-part-ii.html 
and found it very interesting. Although the description is very well 
written the code samples seams incomplete and sort of outdated. Was 
to ask you if any of you have done some work with this and is willing 
to share hints, code snippets?


Thanks a bunch as always,
Nick

--
trajce nikolov nick


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2014-11-24 Thread Trajce Nikolov NICK
HI Sebastian,

thanks for the reply. I also have vegetation generated on the GPU, works
really fine - like 5mil trees on 60Hz. Now I want to try HW instancing for
moving models - your NodeVisitor is good idea to have any geometry
instantiable.

What was your start point? Did you also try the code from the blog I found
or you did it your self? For some reason the code on the blog is not
working and I am struggling to try to fix it since it has really nice
implementation and ideas I am learning now.

Nick

On Mon, Nov 24, 2014 at 10:28 AM, Sebastian Messerschmidt 
sebastian.messerschm...@gmx.de wrote:

  And again:

 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.

 Cheers
 Sebastian

  HI Trajce,

 I implemented HW Instancing using the UBO and texture approach using the
 osgforest example as a guide.
 The majority of the work in my project lied in developing a visitor making
 arbitrary geometry nodes instanceable.
 I also experimented with geometry shader based billboard instancing, which
 worked nice for trees etc.
 And I do remember some example featuring GPU culling and instancing, but I
 cannot find it in the mailing list right now


  Hi Community

  I found this blog
 http://3dcgtutorials.blogspot.de/2013/09/instancing-with-openscenegraph-part-ii.html
 and found it very interesting. Although the description is very well
 written the code samples seams incomplete and sort of outdated. Was to ask
 you if any of you have done some work with this and is willing to share
 hints, code snippets?

  Thanks a bunch as always,
 Nick

  --
 trajce nikolov nick


 ___
 osg-users mailing 
 listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




 ___
 osg-users mailing 
 listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2014-11-24 Thread Sebastian Messerschmidt

Am 24.11.2014 11:38, schrieb Trajce Nikolov NICK:

HI Sebastian,

thanks for the reply. I also have vegetation generated on the GPU, 
works really fine - like 5mil trees on 60Hz. Now I want to try HW 
instancing for moving models - your NodeVisitor is good idea to have 
any geometry instantiable.


What was your start point? Did you also try the code from the blog I 
found or you did it your self? For some reason the code on the blog is 
not working and I am struggling to try to fix it since it has really 
nice implementation and ideas I am learning now.

I started with the osgforest example


Nick

On Mon, Nov 24, 2014 at 10:28 AM, Sebastian Messerschmidt 
sebastian.messerschm...@gmx.de 
mailto:sebastian.messerschm...@gmx.de wrote:


And again:

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.

Cheers
Sebastian


HI Trajce,

I implemented HW Instancing using the UBO and texture approach
using the osgforest example as a guide.
The majority of the work in my project lied in developing a
visitor making arbitrary geometry nodes instanceable.
I also experimented with geometry shader based billboard
instancing, which worked nice for trees etc.
And I do remember some example featuring GPU culling and
instancing, but I cannot find it in the mailing list right now



Hi Community

I found this blog

http://3dcgtutorials.blogspot.de/2013/09/instancing-with-openscenegraph-part-ii.html
and found it very interesting. Although the description is very
well written the code samples seams incomplete and sort of
outdated. Was to ask you if any of you have done some work with
this and is willing to share hints, code snippets?

Thanks a bunch as always,
Nick

-- 
trajce nikolov nick



___
osg-users mailing list
osg-users@lists.openscenegraph.org  
mailto:osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




___
osg-users mailing list
osg-users@lists.openscenegraph.org  
mailto:osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



___
osg-users mailing list
osg-users@lists.openscenegraph.org
mailto:osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




--
trajce nikolov nick


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2014-11-24 Thread Trajce Nikolov NICK
Hi All,

just for the case of someone else will need it, I was able to manage fix
for the sample from the blog that do HW instancing with VertexAttribs and
VertexAttribDivisor. If any interested, please ping me. I will also send it
to the author.

Cheers,
Nick

On Mon, Nov 24, 2014 at 12:07 PM, Sebastian Messerschmidt 
sebastian.messerschm...@gmx.de wrote:

  Am 24.11.2014 11:38, schrieb Trajce Nikolov NICK:

 HI Sebastian,

  thanks for the reply. I also have vegetation generated on the GPU, works
 really fine - like 5mil trees on 60Hz. Now I want to try HW instancing for
 moving models - your NodeVisitor is good idea to have any geometry
 instantiable.

  What was your start point? Did you also try the code from the blog I
 found or you did it your self? For some reason the code on the blog is not
 working and I am struggling to try to fix it since it has really nice
 implementation and ideas I am learning now.

 I started with the osgforest example


  Nick

 On Mon, Nov 24, 2014 at 10:28 AM, Sebastian Messerschmidt 
 sebastian.messerschm...@gmx.de wrote:

  And again:

 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.

 Cheers
  Sebastian

   HI Trajce,

 I implemented HW Instancing using the UBO and texture approach using the
 osgforest example as a guide.
 The majority of the work in my project lied in developing a visitor
 making arbitrary geometry nodes instanceable.
 I also experimented with geometry shader based billboard instancing,
 which worked nice for trees etc.
 And I do remember some example featuring GPU culling and instancing, but
 I cannot find it in the mailing list right now


  Hi Community

  I found this blog
 http://3dcgtutorials.blogspot.de/2013/09/instancing-with-openscenegraph-part-ii.html
 and found it very interesting. Although the description is very well
 written the code samples seams incomplete and sort of outdated. Was to ask
 you if any of you have done some work with this and is willing to share
 hints, code snippets?

  Thanks a bunch as always,
 Nick

  --
 trajce nikolov nick


 ___
 osg-users mailing 
 listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




 ___
 osg-users mailing 
 listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




  --
 trajce nikolov nick


 ___
 osg-users mailing 
 listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2014-11-24 Thread Roman Grigoriev
Hi, Nick!
Long time ago I tried to implement model with moving parts instancing. For 
forests it works OK but when you have many moving parts you have to once 
collect matrices and after send it to TBO to render. Also there are a lot of 
state switches in model. Another difficulty is model picking and also bounding 
box calculation. So I gave up.
And if you implemented it now could you please drop a code to view it.


Thank you!

Cheers,
Roman

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=61815#61815





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2014-11-24 Thread Trajce Nikolov NICK
Hi Roman,

this is exactly what I am trying to achieve. Sebastian's hint for writing a
NodeVisitor to make any model instantiable is what I am trying to write
just about this moment. Once I complete some working version I will post my
code, no problem. Maybe Sebastian can provide some snips from his
NodeVisitor as well ;-)

Nick

On Mon, Nov 24, 2014 at 1:43 PM, Roman Grigoriev grigor...@gosniias.ru
wrote:

 Hi, Nick!
 Long time ago I tried to implement model with moving parts instancing. For
 forests it works OK but when you have many moving parts you have to once
 collect matrices and after send it to TBO to render. Also there are a lot
 of state switches in model. Another difficulty is model picking and also
 bounding box calculation. So I gave up.
 And if you implemented it now could you please drop a code to view it.


 Thank you!

 Cheers,
 Roman

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=61815#61815





 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2014-11-24 Thread Roman Grigoriev
Hi,Nick! Also for some speedup I've read that it's good to store matrices as 
position and quatertion, and resore ModelViewMatrix in vertex shader because 
vertex calcualtion is very fast on modern GPU, and scale is not aplicable to 
this calculations.  

Thank you!

Cheers,
Roman

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=61823#61823





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2014-11-24 Thread Robert Osfield
Hi Guys,

I have just checked osg::VertexAttribDivisor StateAttribute class that
wraps up glVertexAttribDivisor.  Assign this new StateAttribute to the
subgraphs/geometry that you want to set the divisor on.  This new class is
checked into svn/trunk.

I haven't yet written a test for the next class though... will need to do
that soon, but others are welcome to jump and write one :-)

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2014-11-24 Thread Trajce Nikolov NICK
Hi Roman,

yeah, I thought of doing it that way. Still fighting with my NodeVisitor to
convert any loaded model to instantiable DrawElements .

Nick

On Mon, Nov 24, 2014 at 4:05 PM, Roman Grigoriev grigor...@gosniias.ru
wrote:

 Hi,Nick! Also for some speedup I've read that it's good to store matrices
 as position and quatertion, and resore ModelViewMatrix in vertex shader
 because vertex calcualtion is very fast on modern GPU, and scale is not
 aplicable to this calculations.

 Thank you!

 Cheers,
 Roman

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=61823#61823





 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2014-11-24 Thread Trajce Nikolov NICK
Thanks Robert. Very cool !

Nick

On Mon, Nov 24, 2014 at 4:07 PM, Robert Osfield robert.osfi...@gmail.com
wrote:

 Hi Guys,

 I have just checked osg::VertexAttribDivisor StateAttribute class that
 wraps up glVertexAttribDivisor.  Assign this new StateAttribute to the
 subgraphs/geometry that you want to set the divisor on.  This new class is
 checked into svn/trunk.

 I haven't yet written a test for the next class though... will need to do
 that soon, but others are welcome to jump and write one :-)

 Robert.

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] hardware instancing with VertexAttribs and VertexAttribsDivisor

2014-11-24 Thread Trajce Nikolov NICK
Hi All,

I have it working based on the code from the mentioned blog. for 4K
dynamicly updated objects (a fully 3D model) I am getting 160fps. I will
try to put more thoughts on it how to optimize, perhaps cutting out the
matrix usage and use vec3 and quats instead, and want to try with latest
submission from Robert with the VertexAttribDisvisor StateAttribute now.
Will ping you with the findings . Stay tuned :-). And thanks for the
support so far

Cheers,
Nick

On Mon, Nov 24, 2014 at 4:53 PM, Trajce Nikolov NICK 
trajce.nikolov.n...@gmail.com wrote:

 Hi Roman,

 yeah, I thought of doing it that way. Still fighting with my NodeVisitor
 to convert any loaded model to instantiable DrawElements .

 Nick

 On Mon, Nov 24, 2014 at 4:05 PM, Roman Grigoriev grigor...@gosniias.ru
 wrote:

 Hi,Nick! Also for some speedup I've read that it's good to store matrices
 as position and quatertion, and resore ModelViewMatrix in vertex shader
 because vertex calcualtion is very fast on modern GPU, and scale is not
 aplicable to this calculations.

 Thank you!

 Cheers,
 Roman

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=61823#61823





 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




 --
 trajce nikolov nick




-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org