Hi Johannes,
Hmm, I think it is not possible to use an array of texture samplers in a
shader. An array of any other values, should be possible. However, I would be
glad to hear, if I am wrong.
Your limitation number is the maximal number of texture units supported by your
GPU.
If you really want to have it for n, with n > max units, then you can either
split your rendering into several passes, #passes = #projections div #maxunits.
Other pretty simple way could be to do following:
1. Render you scene into a buffer and have as output only your normals and 3d
pixel positions (so you run only in screen space afterwards, same as for
deferred lighting)
2. foreach projection texture do (using osgPPU):
2.1. render osgPPU unit (so render screen sized quad). In the shader you
project your values using the coordinates and normals from the first pass
2.2 render into second output (MRT=2) a value stored there + 1 (so you
have something like a counter for every pixel, if it was updated or not)
3. run last pass with the pixel counter and a default projection textures as
input and project only then if pixel counter is equal 0
This should have the same effect as your condtional projection and could be
extended to as much projections as you want. However, the processing time might
be larger, then having bucket projection. But one advantage here is, that your
algorithm is in screen space only and you have to render your geometry only
once.
You can even incorporate stencil buffer to have your shader running only on
those pixels which are covered by the geometry, in order to speed up the whole
process.
I hope you got my idea ;)
cheers,
art
Jotschi wrote:
> Hi,
>
> i will try uniform arrays as soon as i get to it. But the approach sounds
> quite good.
> Thank you.
>
>
> Paul Martz wrote:
> > I believe you can use a uniform array of samplers. This means the number of
> > texture can be arbitrary and therefore you don't need to recompile your
> > shader based on number of textures.
> >
>
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=16950#16950
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org