[osg-users] Value of a variable in shaders?

Werner Modenbach Werner.Modenbach at texion.eu
Fri Sep 28 01:22:41 PDT 2018


Hi Marlin,

in case you want to know the value of a variable (not uniform) of a shader
there is no way (to my knowledge) inspecting it like in a debugger.
The usual workaround is visualizing things by coloring the output pixels.
If you want to "see" the "value" of a normal vector you can just take it
as a
color and set it in the fragment shader as the output color.
Be creative when "debugging" other values: Bools or thresholds go black
and white etc.
If you have to "debug" values in vertex or geometry shaders, just pass
colors to the fragment shader.

I hope this helps a little.

- Werner -

Am 28.09.2018 um 08:40 schrieb Robert Osfield:
> Hi Marlin,
>
> On Thu, 27 Sep 2018 at 19:30, Rowley, Marlin R
> <marlin.r.rowley at lmco.com <mailto:marlin.r.rowley at lmco.com>> wrote:
>
>     Is there a way to examine variable values in shader code? I can’t
>     figure out this problem that we are having unless I can see the
>     values in the shaders.
>
>
> To pass data into shaders you have use a combination of uniforms
> (osg::Unfiorm), textures (osg::Textre*) and vertex attributes.  With
> recent 3.4.x onwards you also have the option of passing in constants
> via #prama(tic) shader composition system that passes #define values
> into the compilation of shaders.
>
> Shaders are a big topic so it's impossible for me to give you a full
> guide, there are plenty of reosurces online about GLSL shaders, within
> the OSG search for uses of osg::Program, osg::Shader, osg::Uniform.
>
> Robert.
>  
>
>
> _______________________________________________
> 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/20180928/1c7f269c/attachment.html>


More information about the osg-users mailing list