Re: [osg-users] How to add shadows to deferred shading?

2013-10-13 Thread michael kapelko
Hi. Do you mean this: vec4 p_worldspace4 = texture2DRect(posMap, gl_FragCoord.xy); vec4 shadowTexCoord = shadowViewProjection * p_worldspace4; float depth = texture2D(shadowMap, shadowTexCoord.x/2 + 0.5, shadowTexCoord.y/2 + 0.5).z; float visibility = 1.0; if (p_worldspace.z depth) visibility

Re: [osg-users] How to add shadows to deferred shading?

2013-10-13 Thread Marcel Pursche
Hi, this line seems to be wrong: Code: float depth = texture2D(shadowMap, shadowTexCoord.x/2 + 0.5, shadowTexCoord.y/2 + 0.5).z; it should be Code: float depth = texture2D(shadowMap, vec2(shadowTexCoord.x/2 + 0.5, shadowTexCoord.y/2 + 0.5)).x; Additionally you compare the depth from

[osg-users] File reading and node traversal problem.

2013-10-13 Thread Murat KIRTAY
Dear All, I am getting my hands dirty with osg, and I have faced below problem and could not find a solution on the previous posts, forums etc. *Problem:* when reading a osg file via osgDB::readNodeFile( fileNameStr ) in order to create a node (osg::Node), while traversing this node with

Re: [osg-users] How to add shadows to deferred shading?

2013-10-13 Thread michael kapelko
Hi. I finally came up with the projected shadow map (not shadows yet): http://youtu.be/geTIxhqT4x4 This is my final pass fragment shader: http://goo.gl/LNtYNh It's simply the projected shadow map for each fragment. Although, when I output shadowTexCoord.z: gl_FragColor = vec4(shadowTexCoord.z /

Re: [osg-users] File reading and node traversal problem.

2013-10-13 Thread Trajce Nikolov NICK
Hi Murat, maybe you post your code snippet of the traversal so we see what might be wrong there Cheers, Nick On Sun, Oct 13, 2013 at 5:16 PM, Murat KIRTAY muratk...@gmail.com wrote: Dear All, I am getting my hands dirty with osg, and I have faced below problem and could not find a

Re: [osg-users] How to add shadows to deferred shading?

2013-10-13 Thread Marcel Pursche
Hi, you write the depth in your first texture component(accessed from the shader with .r, .x or .s). But you read it from the third component of your texture(.z). I know it looks confusing at first to read the depth from .x, but this is actually right. Thank you! Cheers, Marcel

Re: [osg-users] How to add shadows to deferred shading?

2013-10-13 Thread michael kapelko
Hi. My shadow pass fragment shader looks like this: http://goo.gl/R5r7Z1 So all xyzw contain the depth fragment. I tried .x too. My current problem is in interpreting shadowTexCoord.z The shadow projection matrix setup is: http://goo.gl/ly2u7F Does that mean my shadowTexCoord.z should be in the

[osg-users] osgAnimation - Seperate animations from keyframe ranges

2013-10-13 Thread Paul Pocock
Hi all - I have grouped my animations in one long sequence using 3ds 2010 but would like to seperate these out in OSG as named seperate animations based on a start stop key frame value . Is this possible to do using osgAnimation? Best Regards Paul

Re: [osg-users] How to add shadows to deferred shading?

2013-10-13 Thread michael kapelko
I've decided to assign colors to different shadowTexCoord.z values. That's my final pass fragment shader now: http://goo.gl/n6FrVB Turns out shadowTexCoord.z is in the range (-51.85;-50.80) for the scene for some reason. And, as you see from this video: http://youtu.be/_NQLCXYveHYshadowTexCoord.z