Re: [osg-users] help for warping

2016-11-16 Thread Gianni Ambrosio
Warping done with MVP matrix, thanks anyway.

Gianni

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





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


Re: [osg-users] help for warping

2016-11-07 Thread Gianni Ambrosio
If I have to clarify something please ask.

Gianni

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





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


[osg-users] help for warping

2016-11-03 Thread Gianni Ambrosio
Hi All,
I'm struggling with a warping implementation to show a 3D scene to a curved 
screen.

I gave a look at osgdistortion example and implemented a RTT camera just like 
in that example.
So now I have a render to texture camera that generates a texture of the 3D 
scene. Then a HUD camera with a geode as child where its geometry is attached 
to the texture.

I have a csv file that describes the screen shape as mesh of points. The file 
contains the following data: x,y,z,u,v.
Each line represents the x,y,z patial coordinates of a screen point.

For a different project that uses Unity and C#, a colleague implemented the 
warping basically in this way:


Code:

Vector2[] uvs = new Vector2[mesh.vertices.Count()];
for (int i = 0; i < mesh.vertices.Count(); i++) {
Vector3 pos = camera.WorldToViewportPoint(mesh3d.vertices[i]);
uvs[i] = new Vector2(pos.x, pos.y);
}
mesh.uv = uvs;



I didn't find a WorldToViewportPoint method in OSG but I find some references 
on the web to implement it.

On the other hand it seems the osgdistortion example is implemented differently.

One more thing I have to say is that projectors and curved screen are fixed 
while the observer is sitting on a moving platform. So I have to correct the 
camera frustum first.

Anyway, could you please suggest and explain me how to implement the warping 
considering that it would be also nice to use a shader to improve performance 
(if possible)?

Cheers,
Gianni

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





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