[osg-users] Limit rendering a texture up to a given pixel

Bruno Oliveira bruno.manata.oliveira at gmail.com
Fri Jun 30 09:59:22 PDT 2017


Yes I implemented something like that! Thanks !

2017-06-29 19:45 GMT+01:00 Christian Buchner <christian.buchner at gmail.com>:

>
> A uniform specific to each tile that defines the dimensions for the valid
> part of the tile? The shader would get the gl_FragCoord, compare it against
> the threshold and return a transparent color for pixels outside the valid
> bounds.
>
> Christian
>
>
> 2017-06-29 11:28 GMT+02:00 Bruno Oliveira <bruno.manata.oliveira at gmail.com
> >:
>
>> Hello,
>>
>>
>> I have a big image to be rendered (100k pixels each side), hence I am
>> partitioning that image in Image Tiles.
>>
>> Each tile has 256 x 256 pixels. Each tile consists of a osg::Geometry
>> quad, with a texture bound to it. I put all those tiles in an osg::Group.
>> I use a fragment shader that is global to all tiles (I apply it to the
>> osg::Group's StateSet). It is a very simple shader and consists only of a
>> texture lookup in each tile:
>>
>>     gl_FragColor = texture2D(texture, vec2(x, y));
>>
>> The problem now is that in the image limits, some extra pixels are
>> rendered (because my images' size is not multiple of 256). For instance, if
>> my image size is 1000 pixels in x, the last 24 pixels are not valid and
>> shall be transparent (because it will have 4 tiles = 256 * 4 pixels =
>> 1024). The last tile should only be rendered up to the pixel 232 ( 256 - 24
>> = 232)
>>
>> What is the best way of limiting my rendering up to that pixel, WITHOUT
>> defining a new shader for EVERY tile? ( I really want a single fragment
>> shader bound to the whole group for performance reasons)
>>
>> _______________________________________________
>> 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/20170630/cf334ff5/attachment-0003.htm>


More information about the osg-users mailing list