Preet,

Perhaps the problem is lack of precision in your BillboardRotate uniform
(double -> float).

Maybe you can try a different approach: transform your vertex into View
space (or Clip space) and then apply the ModelPosition offsets there. Just
an idea.

Glenn Waldron / @glennwaldron


On Sun, Jan 20, 2013 at 5:35 PM, Preet <[email protected]> wrote:

> Hiya,
>
> This is somewhat related to my last thread (maybe I should have just
> explained the situation from the beginning).
>
> I'm trying to create a shader that does billboarding for hundreds of
> objects at once (where using AutoTransform is too slow). I merge all these
> objects together to reduce the number of draw calls, and pass along
> specific vertex attribute data (specifically model-space relative vertex
> data when I want the billboard center to be the model's center) and
> uniforms (camera vectors) to do the required billboard transform in the
> shader.
>
> This kind of works, but the result is 'jittery' compared to AutoTransform.
> I don't know whether its the way I specify the uniform update callback or
> if its related to reduced shader precision (the coordinates I used are all
> close to the origin though, so I hope that's not the case) or something
> else entirely.
>
> I created a minimal example that reproduces the issue [1]... (just
> copy->past->compile). The example shows a square billboarded with
> AutoTransform working perfectly, and my not so great example directly
> behind it.
>
> [1] https://gist.github.com/4582261
>
> * Does anyone know why my example billboard implementation causes that
> jitter/delay?
>
> * Or, has anyone created a better shader that can do billboarding for
> batched geometry (and if so, could they maybe share how)?
>
>
> Preet
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to