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.

Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
+1 303 859 9466



Johannes Schüth wrote:
Hi,

I basically got multiple images that i want to project onto the same world geometry.

By comparing the normal vector of the world geometry polygon and the direction vector of the projection source i want to calculate the angle in which the projected image 'shines' onto the polygon. This is no big deal. But here is my problem:

I want use this angle to decide whether one of the images should be projected onto the face. In fact i want to ensure that only the image that 'shines' most direct onto the face will be finally visible. In addition i want to use a fallback mechanism. 
If there is only one image that projects onto the face than it should be allowed to project onto the face although the angle might be very flat.

I found this conversion http://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg10267.html

Approach 1:

Just passing all textures and texture matrices to the shader
Problem: This requires a fixed amount of projections or the shader must be recompiled each time the amount of projective images changes.

Approach 2:

Multipass Shading:
Render the scene with a single projective texture
Render the scene again with the next projective texture and so on.
Combine each pass with osgPPU
Problems:
1. I have no idea to do this and where to start
2. I believe it is not possible to handle the conditional projection that i described above in this approach.

Maybe a neat solution for my problem. 

Thank you!

Cheers,
Johannes

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=16000#16000





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


  
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to