[osg-users] Draw Instanced

Glenn Waldron gwaldron at gmail.com
Mon Apr 18 13:09:20 PDT 2016


Yes, it's here:
https://github.com/gwaldron/osgearth/blob/master/src/osgEarth/Instancing.vert.glsl


Glenn Waldron

On Mon, Apr 18, 2016 at 3:49 PM, sam <brkopac at gmail.com> wrote:

> Do you have an example of the shader that you used?
>
> On Mon, Apr 18, 2016 at 12:40 PM, Glenn Waldron <gwaldron at gmail.com>
> wrote:
>
>> That I do not know. But I do recall that my original DI implementation
>> tried to use UBOs, and I ditched them in favor of TBOs because of the size
>> limitations.
>>
>> Glenn Waldron
>>
>> On Fri, Apr 15, 2016 at 6:09 PM, sam <brkopac at gmail.com> wrote:
>>
>>> Would there be a big performance difference between using a
>>> TextureBuffer Object and a UniformBuffer object?
>>>
>>> Thanks, Sam
>>>
>>> On Fri, Apr 15, 2016 at 1:15 PM, sam <brkopac at gmail.com> wrote:
>>>
>>>> Doh! Thanks, Glenn. Unfortunately I still have some holes in the map
>>>> but its starting to look considerably better. I will definitely looking to
>>>> using a TextureBuffer.
>>>>
>>>> On Fri, Apr 15, 2016 at 12:50 PM, Glenn Waldron <gwaldron at gmail.com>
>>>> wrote:
>>>>
>>>>> Sam,
>>>>> I think you are not calling setNumElements() on your uniform array.
>>>>> You could also do that in the osg::Uniform constructor.
>>>>>
>>>>> Anyway, a uniform array of matrices is going to be limiting in terms
>>>>> of scale and speed -- I'd recommend a buffer object instead. (osgEarth uses
>>>>> an osg::TextureBuffer.)
>>>>>
>>>>>
>>>>> Glenn Waldron
>>>>>
>>>>> On Fri, Apr 15, 2016 at 2:35 PM, sam <brkopac at gmail.com> wrote:
>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>> I'm having some trouble getting my code to use hardware instancing.
>>>>>> I've referenced OSGEarth, DrawInstanced example, and a few different code
>>>>>> samples on the web. I've gotten pretty close but I seem to be at a bit of
>>>>>> an impasse.
>>>>>>
>>>>>> This screenshot shows what the map looks like with the default
>>>>>> rendering:
>>>>>>
>>>>>> http://imgur.com/fKvunfd
>>>>>>
>>>>>> This screenshot shows what the map looks like after I apply my
>>>>>> instance rendering code to it:
>>>>>>
>>>>>> http://imgur.com/zZCzurr
>>>>>>
>>>>>> The map is composed of a lot of little nodes. I figured instanced
>>>>>> rendering would be helpful in this case. The map has ~4000 individual
>>>>>> nodes. Two of the nodes are repeated 465 and 266 times. I have trimmed down
>>>>>> my code and it is posted here:
>>>>>>
>>>>>> http://pastebin.com/ifSVSzD6
>>>>>>
>>>>>> From what it looks like. Its rendering one copy of every nodes but
>>>>>> not anymore that that. I have commented out lines 215 to 224 as it doesn't
>>>>>> work at all. Any insight or help would be greatly appreciated.
>>>>>>
>>>>>> Thanks, Sam
>>>>>>
>>>>>> _______________________________________________
>>>>>> osg-users mailing list
>>>>>> osg-users at lists.openscenegraph.org
>>>>>>
>>>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> osg-users mailing list
>>>>> osg-users at lists.openscenegraph.org
>>>>>
>>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>>>
>>>>>
>>>>
>>>
>>> _______________________________________________
>>> osg-users mailing list
>>> osg-users at lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>>
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160418/2e3739f8/attachment-0003.htm>


More information about the osg-users mailing list