Hi,

On Wed, 2014-06-04 at 10:57 +0200, Marcel Weiler wrote:
> Hi all,
> 
> for instanced rendering I want to give the instanced Geometry core an 
> attribute that represents a per-instance position offset. I know how to 
> set the usual indices and positions, but how do I add custom vertex 
> attributes?
> I tried setting the property to binding location 1 using Snippet 
> geo->setProperty(offsets, 1) but this causes the following warning:
> Snippet
> WARNING: GeoVectorProperty::activate: Non-Generic attribute nr. 1 unknown!
>
> and this approach does not work (the instances are not rendered with an 
> offset).
> 
> I also tried misusing the colors property, but even though I set its 
> divisor to 1 it seemed to be advancing per vertex, not per instance.
> 
> Am I even on the right track here? 

yes, this should work.

> Or do I have to set some properties in the GeoInstancer?

no, just the base geometry and the number of instances.
e.g. from the CSM example

     core GeoInstancer
     {
       numInstances 4
       baseGeometry USE BaseGeometry
     }


first quick one (and sorry if you have), have you looked at/tried
Examples/CSM/Instancing/SimpleDivisor ?

If yes, there is something weird going on with the example. Using
                       vec4 vVertex = gl_Vertex + vec4(
                         gl_MultiTexCoord7);
results in wrongly scaled/projected instances. This can be fixed by
changing the vertex position computation to 
                       vec4 vVertex = gl_Vertex + vec4(
                         gl_MultiTexCoord7.xwz, 0.);

The example uses attribut 15, but I quickly tried 1 and 3 and it works
as expected.

If you can, could also send me a .osg dump of the subgraph containing
the instancing (off-list is fine) and I can have a further look.

kind regards
  gerrit



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to