[osg-users] Problem installing OpenSceneGraph 2.6.0
Hi All, I’m having trouble installing osg 2.6 on a Linux box. I don’t have administrative privilege on that machine so I have to install osg into my directory. Using ccmake I specify the directory where I want to install osg and generate make files. Make command executes without any problems. Make install works without any problems until it hits osgviewer. Here is the error massage: CMake Error at applications/osgviewer/cmake_install.cmake:41 (FILE): file INSTALL cannot find file /scratch/nikolski/osg/osg2.6/bin/ osgviewer to install. Call Stack (most recent call first): applications/cmake_install.cmake:37 (INCLUDE) cmake_install.cmake:38 (INCLUDE) I looked into specified directory (/scratch/nikolski/osg/osg2.6/ bin/). All other binaries are there except osgviewer. I remade the whole thing again and made sure that osgviewer was in the bin directory. Make install after running for a while produced the same error message. I looked into the bin directory and osgviewer wasn’t there anymore. I use cmake version 2.6. (I have Fedora Core 7, x86_64 in case it helps). I had no problems installing osg 2.5 on the same Machine. Did anyone have a similar problem, or does anyone have any ideas about what can cause it? Thank you in advance for your time, Denis ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Default vertex shader
Hello Jean-Sebastien, I followed your advice. Everything works well. Thanks a lot for clarifying those things and for your help. Denis On Jul 23, 2008, at 4:58 AM, Jean-Sébastien Guay wrote: Hello Denis, When I added vertex shader, the object was not shadowed properly (with the same exact fragment shader). I suspect I'm doing something wrong with the texture coordinates in a vertex shader. I looked in ShadowMap.cpp, it has only fragment shaders. Do you know where can I find default vertex shader? When you start using a shader for one part of the pipeline (vertex or fragment) you need to do everything that that part of the pipeline used to do (and which is needed by your rendering). In the case of shadows, you'll notice that the code in ShadowMap.cpp adds an osg::TexGen that calculates some texture coordinates for texture unit 1. But that's the fixed pipeline, so you will need to calculate texture coordinates for unit 1 as glTexGen would in your vertex shader now that it has replaced the fixed-function vertex processing. Something like this should work, though you should probably have finer control over when these are calculated or not: gl_TexCoord[1].s = dot( ecPosition, gl_EyePlaneS[1] ); gl_TexCoord[1].t = dot( ecPosition, gl_EyePlaneT[1] ); gl_TexCoord[1].p = dot( ecPosition, gl_EyePlaneR[1] ); gl_TexCoord[1].q = dot( ecPosition, gl_EyePlaneQ[1] ); Note that ecPosition is: vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; I also assume you're transforming your texture coordinates for texture unit 0 properly: gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; Just assigning gl_MultiTexCoord0 to gl_TexCoord[0] will work until you try to use a texture matrix (osg::TexMat)... I highly recommend you get/read the Orange Book, as this is all given there. You can also download the ShaderGen program from 3DLabs (now hosted on http://mew.cx/glsl since 3DLabs removed it from their site) which can generate shaders that emulate the fixed pipeline. Note that for speed, you should probably only use the features you need in your shaders, so I am not recommending that you generate a shader that does *all* of what the fixed pipeline would do... Just use what ShaderGen produces as a guide. Hope this helps, J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ 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
[osg-users] How to apply shadows to a scene with different shaders
Hi all, Thanks to Jean-Sebastien for quick response about custom shaders with osg ShadowMap. I’m trying to compute shadows in a scene and apply them to each object. Most of the objects have different shaders. I have to smuggle information about shadows into each object’s shader. The only way I can see how to do this is to compute shadows of the scene into texture and pass the texture to each shader. I thought that the easiest way would be to use osg ShadowMap. I tried modifying ShadowMap’s shaders. It worked but in that case one shader is applied to the whole scene. Is there a way to get Shadow texture from osg ShadowMap and pass it to another shader? Am I going in a right direction? Should I use osg ShadowMap to get shadow texture and pass it to different shaders or something else? Thank you for your time, Denis ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Default vertex shader
Hello Jean-Sebastien, Check the top of the shader in src/osgShadow/ShadowMap.cpp, there is a bunch of uniforms with names that start with osgShadow_. You can use those same variable names in other shaders, and you will then have access to the same data (as long as the shader is on a node in the subgraph under the ShadowedScene node). The sampler is the shadow map itself, and the others are parameters. So you can use the same code and just combine it with whatever else you want to do. Thanks for clarifying those things. I followed your suggestion and I was able to access all the osgShadow_ uniforms when I added only fragment shader. When I added vertex shader, the object was not shadowed properly (with the same exact fragment shader). I suspect I'm doing something wrong with the texture coordinates in a vertex shader. I looked in ShadowMap.cpp, it has only fragment shaders. Do you know where can I find default vertex shader? Thank you for your time, Denis ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] question about custom shaders with osgShadow
Hi all, Is there a way to use custom shaders with osgShadow? I’m using 2.5 version of osg. I have a shader that computes a procedural texture, which is applied to an object. I wanted to use osgShadow::ShadowMap to get shadow applied to the same object, but I cannot find a way to pass the shadow texture to my shader. It looks like the shadow example shows how to use different shadow techniques only with fixed graphics pipeline functionality. Osg ShadowMap works great if I don’t use shaders. I know that one way to do shadow maps would be to set up a camera from the point of view of the light to render the world into a texture and send the texture to the shader. The osg ShadowMap code does the same thing, but I couldn’t find a way to get texture from it nor substitute the shader that it uses without changing osg ShadowMap. I looked at the documentation, source code, and on the web but I didn’t find anything that could help. Am I missing something? Could anyone push me in the right direction? Thank you in advance for your time! Denis ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org