Re: [osg-users] 32bit DEPTH for RTT

2016-10-27 Thread Trajce Nikolov NICK
Hi Chris, I can not post code snippets due to the nature of the project. But in general it is what Glenn suggested in this thread - to have the light matrix (this is the one that is rendering from the light source origin into RTT) in view space against viewspace vertex in the shader. Here is

Re: [osg-users] 32bit DEPTH for RTT

2016-10-26 Thread Chris Hanson
Can you post the solution, for others in the future to benefit from? On Mon, Oct 24, 2016 at 8:04 AM, Trajce Nikolov NICK < trajce.nikolov.n...@gmail.com> wrote: > Got a help offline from a friend on this ... So glad there are so cool > people on this list ... > > Thanks all! > > Nick > > On

Re: [osg-users] 32bit DEPTH for RTT

2016-10-24 Thread Trajce Nikolov NICK
Got a help offline from a friend on this ... So glad there are so cool people on this list ... Thanks all! Nick On Fri, Oct 21, 2016 at 3:54 PM, Trajce Nikolov NICK < trajce.nikolov.n...@gmail.com> wrote: > Hi readers to this thread ;-), > > I am close to resolve this but the math involved is

Re: [osg-users] 32bit DEPTH for RTT

2016-10-21 Thread Trajce Nikolov NICK
Hi readers to this thread ;-), I am close to resolve this but the math involved is a bit tricky for me to understand it right. And suddenly I can not send screenshots or videos publicly - maybe on private email to those willing to help. The story now is this: The environment is ECEF terrain,

Re: [osg-users] 32bit DEPTH for RTT

2016-10-20 Thread Trajce Nikolov NICK
almost there .. the flickering is gone, just the shadow texture lookup coordinates are messed up when used view space matrix and vertex. This is the code for constructing the final matrix: osg::Matrixf lmvpm = lightMatrixInViewSpace * osg::Matrixf(camera->getProjectionMatrix()) *

Re: [osg-users] 32bit DEPTH for RTT

2016-10-20 Thread Glenn Waldron
Up vector doesn't really matter, so just pick one like: side = cross(view_vec, (0,0,1)); up = cross(side, view_vec); Glenn Waldron On Thu, Oct 20, 2016 at 12:00 PM, Trajce Nikolov NICK < trajce.nikolov.n...@gmail.com> wrote: > Just last question .. What the 'up' vector would be now for

Re: [osg-users] 32bit DEPTH for RTT

2016-10-20 Thread Trajce Nikolov NICK
Just last question .. What the 'up' vector would be now for making the light matrix in view space? On Thu, Oct 20, 2016 at 5:39 PM, Trajce Nikolov NICK < trajce.nikolov.n...@gmail.com> wrote: > Glenn, > > this worked ... :-) ... Thanks for the hint ... > > On Thu, Oct 20, 2016 at 5:02 PM, Trajce

Re: [osg-users] 32bit DEPTH for RTT

2016-10-20 Thread Trajce Nikolov NICK
Glenn, this worked ... :-) ... Thanks for the hint ... On Thu, Oct 20, 2016 at 5:02 PM, Trajce Nikolov NICK < trajce.nikolov.n...@gmail.com> wrote: > wops .. > > mx.makeLookAt(lightPosInViewSpace,lightPosInViewSpace+lightDirInViewSpace > ,up) > > On Thu, Oct 20, 2016 at 5:00 PM, Trajce Nikolov

Re: [osg-users] 32bit DEPTH for RTT

2016-10-20 Thread Trajce Nikolov NICK
wops .. mx.makeLookAt(lightPosInViewSpace,lightPosInViewSpace+lightDirInViewSpace ,up) On Thu, Oct 20, 2016 at 5:00 PM, Trajce Nikolov NICK < trajce.nikolov.n...@gmail.com> wrote: > Thanks Glenn, > > actually I was expecting this. I have the math to get the light direction > in view space, just

Re: [osg-users] 32bit DEPTH for RTT

2016-10-20 Thread Trajce Nikolov NICK
Thanks Glenn, actually I was expecting this. I have the math to get the light direction in view space, just the construction of the light matrix in view space hurts my head a bit ( I missed that part of the class :-) ) vec3 lightDirInViewSpace; vec3 lightPosInViewSpace;

Re: [osg-users] 32bit DEPTH for RTT

2016-10-20 Thread Glenn Waldron
There's your precision loss, you can't do that with ECEF coordinates or they will be truncated. Better idea: build your light matrix in view space on the CPU (instead of world space), and then use it on the view-space vertex in the shader. (You'll have to update it every time the camera moves, of

Re: [osg-users] 32bit DEPTH for RTT

2016-10-20 Thread Trajce Nikolov NICK
Hi Glenn, vec3 vVertex = vec3(gl_ModelViewMatrix * VertexMODEL); worldSpaceVertex = osg_ViewMatrixInverse * vec4( vVertex, 1.0 ); Part of VP On Thu, Oct 20, 2016 at 3:52 PM, Glenn Waldron wrote: > Nick, how did you calculate "worldSpaceVertex"? > > Glenn Waldron > > On

Re: [osg-users] 32bit DEPTH for RTT

2016-10-20 Thread Glenn Waldron
Nick, how did you calculate "worldSpaceVertex"? Glenn Waldron On Thu, Oct 20, 2016 at 9:13 AM, Trajce Nikolov NICK < trajce.nikolov.n...@gmail.com> wrote: > hehe .. ok :-) .. Maybe you give me a hint. > > I have F+ lighting (written by a friend of mine) and I have extended it so > local lights

Re: [osg-users] 32bit DEPTH for RTT

2016-10-20 Thread Trajce Nikolov NICK
hehe .. ok :-) .. Maybe you give me a hint. I have F+ lighting (written by a friend of mine) and I have extended it so local lights cast shadows (a bit of complex code - relatively actually, but for me it is ;-) ). Works well for flat terrains with reasonable sizes. I am trying to make it work

Re: [osg-users] 32bit DEPTH for RTT

2016-10-20 Thread Voerman, L.
yes? we use a variation on OpenSceneGraph\src\osgShadow\ParallelSplitShadowMap.cpp regards, Laurens. On Thu, Oct 20, 2016 at 2:35 PM, Trajce Nikolov NICK < trajce.nikolov.n...@gmail.com> wrote: > Hi Laurens, > > do you have experience with DEPTH32bit and shadowcomparation set to true - > for

Re: [osg-users] 32bit DEPTH for RTT

2016-10-20 Thread Trajce Nikolov NICK
Hi Laurens, do you have experience with DEPTH32bit and shadowcomparation set to true - for shadow mapping? On Thu, Oct 20, 2016 at 12:08 PM, Trajce Nikolov NICK < trajce.nikolov.n...@gmail.com> wrote: > Hi Voerman, > > Yes, GL_DEPTH_COMPONENT32 was what I was missing ... Thanks a lot! > >

Re: [osg-users] 32bit DEPTH for RTT

2016-10-20 Thread Trajce Nikolov NICK
Hi Voerman, Yes, GL_DEPTH_COMPONENT32 was what I was missing ... Thanks a lot! Trajce On Thu, Oct 20, 2016 at 9:25 AM, Voerman, L. wrote: > Hi Trajce, > maybe this sniplet helps? > _textureDepthBuffer = new osg::Texture2D; >

Re: [osg-users] 32bit DEPTH for RTT

2016-10-20 Thread Voerman, L.
Hi Trajce, maybe this sniplet helps? _textureDepthBuffer = new osg::Texture2D; _textureDepthBuffer->setTextureSize(_width+2.0f*_width*_guardBandPercentage, _height+2.0f*_height*_guardBandPercentage); _textureDepthBuffer->setSourceFormat(GL_DEPTH_COMPONENT);

[osg-users] 32bit DEPTH for RTT

2016-10-19 Thread Trajce Nikolov NICK
Hi Community, anyone with clue how to set RTT osg::Texture with 32bit DEPTH? Thanks a bunch as always! Cheers, Nick -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org