[osg-users] Is OSG for iOS a good candidate for displaying PLY files?

2013-12-26 Thread aaron wetzler
Hi
I have asked some students under my supervision to display PLY files that they 
have created and are stored on a server.
The idea is they have built an app in iOS and then they connect to the server, 
download the PLY files and then display them on the iPhone\iPad.

They have no experience with computer graphics of any sort so I figured I would 
look for a good solution and point them in the right direction.
My question is this:
Can OSG be used easily within an XCode project that they have already coded?
Can OSG be used to read and display PLY files?


... 

Thank you!

Cheers,
aaron

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





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


Re: [osg-users] render depth buffer to image for one time

2011-07-02 Thread aaron wetzler
Sergey, thank you so much for your help. Its been very useful
and has helped me focus my attention on the right things. I have almost 
finished what I needed to do.

I have one last question:

I now have an RTT camera which I take its depth and color attachments from. The 
RTT camera is a slave to the master scene camera and takes its data from there 
also.

My problem is that when I just leave the natural settings of the master camera 
then it seems that the depth range changes according to the bounding box of the 
scene data.

[Image: http://forum.openscenegraph.org/files/capture2_125.png ]

The range in the above image it gives me is great but I dont want it to change. 
I want to fix that depth range and also be in control of it.  


In the next image I have set 
viewer.getCamera()-setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
 

I assumed this had to do with the near and far culling planes but it seems to 
affect the depth range also. 

[Image: http://forum.openscenegraph.org/files/capture1_105.png ]

So now my question is how do I set and fix the depth range to what I choose?


... 

Thank you!

Cheers,
aaron[img][/img]

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




Attachments: 
http://forum.openscenegraph.org//files/capture1_105.png
http://forum.openscenegraph.org//files/capture2_125.png


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


Re: [osg-users] render depth buffer to image for one time

2011-07-02 Thread aaron wetzler
I was being silly. I simply didnt pick the right values for the near and far 
planes.
This was my solution:

   
Code:
 
viewer.getCamera()-setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
 
double left,right,bottom,top,fovy,aspectratio,near,far;

viewer.getCamera()-getProjectionMatrixAsPerspective(fovy,aspectratio,near,far);

viewer.getCamera()-setProjectionMatrixAsPerspective(fovy,aspectratio,20,25);



... 

Thank you!

Cheers,
aaron

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





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


Re: [osg-users] render depth buffer to image for one time

2011-07-01 Thread aaron wetzler
Hi Sergey

I would like to understand exactly how the graphics pipeline works and am 
struggling to figure this out by digging through the code (are there free books 
that deal with OSG and its implementation details in-depth? I dont mean the QSG 
by Paul Martz...). Also, my understanding of OpenGL is lacking in some places 
especially in implementation details so perhaps this will help clear things up 
for me.

In the prerender example we have something like this:

0: camera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
1: camera-attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0), 
image);
2: camera-setPostDrawCallback(new MyCameraPostDrawCallback(image));
3: textureRect[tex_to_get]-setImage(0, image); 

As far as I understand this works as follows

0: This generates an FBO which has no data storage until I attach data storage 
to it (next step) ? Is this true? What happens then when I attach a color 
attachment but dont attach a depth buffer attachment? Does OSG automatically 
generate one for me? I ask because in regular OpenGL when you dont attach a 
depth attachment to an FBO then rendering to the FBO using 
glEnable(GL_DEPTH_TEST) produces incorrect results...

1: The image attached to the camera is the data storage for the FBO created in 
step 0. If this is the case then it means the FBO sits in RAM and not on the 
GPU. Is that true? 

2:Here we set a post render callback using the image as our input. As far as I 
understand this means that the image (which is sitting in RAM) is edited in 
place. That means that as long as we dont need the data for actual rendering 
then we are being efficient because we dont copy to the GPU. Which brings up 
the next line...

3: We specify that a texture has the image as its image. I dont entirely 
understand what this means. When we create the original texture then OpenGL 
allocates space on the GPU for that texture. By using setImage(0,image) then 
does that mean that whatever is in that image (which sits on RAM) must always 
be copied to the GPU texture  before the texture can be used at render time? 

All in all I feel quite confused and would like to understand how to do the 
above process efficiently.
Ideally I would like to : pass dynamic geometry to the GPU every frame and have 
that rendered to textures inside the GPU. Occassionally I would like to ask the 
GPU to send the RTT textures back to the CPU, update them on the CPU and then 
send them back to the GPU.
How should I be doing that in the most efficient way possible?



Thank you!

Cheers,
aaron

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





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


[osg-users] Displaying depth buffer

2011-06-27 Thread aaron wetzler
Hi,

I would like to render the depth buffer of my scene instead of the color buffer.

I would also like to be able to save the depth buffer and the colorbuffer to a 
file (i.e. bmp or jpg or whatever).

How can I do this?


Cheers,
aaron

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





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


Re: [osg-users] unable to save render-to-texture image

2011-06-27 Thread aaron wetzler
Hi loveRiceee

Did you manage to get this working?
Aaron


loveRiceee wrote:
 Hi,all
 
 I was trying to save a render-to-texture image file many ways, however, 
 failed each time.
 when i attach texture to camera.it works fine.
 but i attach image to camera. it doesn't work right.
 I saved the image data to .jpg, .png, .bmp format . but when i double-click 
 the saved image file, there's nothing but blank.and when i tried do the same 
 thing in the osg example osgprerender, the problem was still that.  i use 
 osgDB::writeImageFile(*image, d:\\data\\test.bmp); 
  why? Is there someone met this problem? How did you fix it?
 
 
 Code:
 
 osg::ref_ptrosg::Texture2D colorMap = new osg::Texture2D;
 colorMap-setTextureSize(width, height);
 colorMap-setInternalFormat(GL_RGBA);
 colorMap-setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR);
 colorMap-setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR);
 
 osg::ref_ptrosg::Texture2D depthMap = new osg::Texture2D;
 depthMap-setTextureSize(width,height);
 depthMap-setInternalFormat(GL_DEPTH_COMPONENT);
 depthMap-setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR);
 depthMap-setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR);
 
 osg::ref_ptrosg::Camera camera = new osg::Camera;
 camera-setClearColor(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f));
 camera-setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 camera-setReferenceFrame(osg::Transform::RELATIVE_RF);
 camera-setProjectionMatrixAsFrustum(-proj_right, proj_right, -proj_top, 
 proj_top, znear, zfar);
 //camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);
 camera-setProjectionMatrix(osg::Matrixd::identity());
 camera-setViewMatrixAsLookAt(bs.center()-osg::Vec3(0.0f,2.0f,0.0f)*bs.radius(),bs.center(),osg::Vec3(0.0f,0.0f,1.0f));
 camera-setViewMatrix(osg::Matrixd::identity());
 camera-setViewport(0, 0, width, height);
 camera-setRenderOrder(osg::Camera::PRE_RENDER);
 camera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
 camera-attach(osg::Camera::DEPTH_BUFFER, depthMap);
 camera-attach(osg::Camera::COLOR_BUFFER, colorMap);
 osg::ref_ptrosg::Image image = new osg::Image;
 image-allocateImage(width, height, 1, GL_RGBA, GL_FLOAT);
 image-setInternalTextureFormat(GL_RGBA);
 camera-attach(osg::Camera::COLOR_BUFFER, image.get());
 osg::ref_ptrosg::Geode geo = createCube(colorMap, depthMap);
 camera-addChild(modelNode.get());
 osg::ref_ptrosg::Group parent = new osg::Group;
 parent-addChild(geo.get());
 parent-addChild(camera.get());
 osgDB::writeImageFile(*image, test.bmp);
 //colorMap-setImage(0, image);
 return parent.get();
 
 
 
 ... 
 
 Thank you!
 
 Cheers,
 sun


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





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


Re: [osg-users] render depth buffer to image for one time

2011-06-27 Thread aaron wetzler
SOLUTION


For anyone who struggled with this here is my solution.
I really have no idea how correct it is but it works for me


Code:
  //Setup of the viewer and scenedata here

   osg::ref_ptrosg::Camera  osgCam = viewer.getCamera(); 

   osg::ref_ptrosg::Image   colorImage= new osg::Image; 
   osg::ref_ptrosg::Image   zImage = new osg::Image; 

   colorImage-allocateImage(1024, 768, 1, GL_RGBA, GL_UNSIGNED_BYTE); 
   zImage-allocateImage(1024, 768, 1, GL_DEPTH_COMPONENT , GL_UNSIGNED_BYTE); 

   osgCam-attach(osg::Camera::COLOR_BUFFER, colorImage.get()); 
   osgCam-attach(osg::Camera::DEPTH_BUFFER, zImage.get()); /* */ 

   viewer.frame();  

   Sleep(100);
   osgDB::writeImageFile(*colorImage.get(),color.bmp); 
   osgDB::writeImageFile(*zImage.get(),depth.bmp); 





Cheers,
aaron

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





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


Re: [osg-users] render depth buffer to image for one time

2011-06-27 Thread aaron wetzler
Thanks hybr and robertosfield for your comments. Both useful and I will use 
those tips.

Although my solution does work its not enough and Im now stuck on a couple of 
things. If you could point me in the right direction or to the right links that 
would be great

1)How do I render the depth image to the screen instead of rendering the color 
buffer? 
Whats the name of the function that lets me define which buffer I want rendered 
to the screen (or FBO for that matter)

2) I actually want to invert my depth image and edit its values. How do I do 
that before writing the image?

3) The dimensions I put in the allocateImage call i.e. (1024, 768)  have no 
effect on the size of the written image. How can I change that?


Looking forward to hearing from you

Aaron

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





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


Re: [osg-users] [osgPlugins] Export Blender to OSG

2011-06-03 Thread aaron wetzler
This is for anyone who is struggling to install osgExport on windows or mac 
for use with Blender.

The configuration which currently works for me uses Blender 2.49 (thanks 
Cedric!)

Windows 7

1)Download and install Blender 2.49
2)The scripts folder is in your hidden AppData folder.
So on my PC that is found at C:\Users\Aaron\AppData\Roaming\Blender 
Foundation\Blender\.blender\scripts
3)Download https://bitbucket.org/cedricpinson/osgexport/get/tip.zip
4)Copy the folder blenderExporter to the directory in step 2

If you run blender you will now see you have OpenSceneGraph (.osg) as an 
export option. 

Mac OSX Snow Leopard 

1)Download Blender 2.49
2)Drag the Blender executable to Applications or run it as is in its downloaded 
location
3)The folder we are looking for is in blender.app
So on my Mac for example the script folder is here
/Users/aw/Downloads/blender-2.49b-OSX-10.5-py2.5-intel/blender.app/Contents/MacOS/.blender/scripts
If you have put it in Applications then the above will be 
/Applications/blender.app/Contents/MacOS/.blender/scripts
4)Download https://bitbucket.org/cedricpinson/osgexport/get/tip.zip
5)Copy the folder blenderExporter to the directory in step 3

If you run blender you will now see you have OpenSceneGraph (.osg) as an 
export option. 

A note on Blender 2.57 :
I installed the script given by damyon here- 
http://forum.openscenegraph.org/viewtopic.php?p=39897#39897
but unfortunately it doesnt work with armatures and a number of other test 
files I tried so until that happens 2.57 isnt a viable option.

However if at some point it is fixed then one should note that currently the 
install location is slightly different. This might change again but basically 
instead of copying the folder blenderExporter to the scripts folder you need to 
copy the contents of the folder blenderExporter to the scripts/addons folder 
and then enable the script under User Preferences -Add-ons

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





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


Re: [osg-users] [osgPlugins] Export Blender to OSG

2011-05-30 Thread aaron wetzler
Hi Alberto

You are right. I found the osgExport and osgAnimation. Im currently really 
stuck on the osgExport though and would really like to be able to find a 
version of blender and a version of osgExport that work together.

Do you have any experience with this? Do you know which versions of both I 
could download for windows 7 that will work?

Thanks

Aaron

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





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


Re: [osg-users] osgexport for blender?

2011-05-29 Thread aaron wetzler

damyon wrote:
 Hi Alberto,
 
 Here is an updated script that should fix this crash.
 
 Cheers,
 Damyon


Hi Damyon
I have been struggling to install the exporter.
Could you tell me what the steps are for using the file you have attached above 
are in Blender 2.57 on Windows 7? 

The steps I took :
1)Downloaded  osgexport-no-mercurial-20100527_r6.tar.gz
2)Unzipped it onto my desktop. 
3)Went into Blender, User Preferences -Add-ons and clicked Install Add-on. 
Then in the file selection screen I found the osgExport.py file on my desktop 
and clicked install Add-on 
4)A new line appears with the running figure and a grey checkbox with the 
description Import-Export: Export OSG format (.osg) 
5)I tried clicking on the checkbox but it doesnt activate. 

What should I do?
Also, I thought I should have a folder called /.blender/scripts in my blender 
folder but I dont have anything there. The only folder I have is 2.57

Im really stuck and its really important for me because I need to export a hand 
armature that has been skinned in Blender into OSG for some research we are 
trying to do.

Any help will be appreciated!

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





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


Re: [osg-users] [osgPlugins] Export Blender to OSG

2011-05-29 Thread aaron wetzler
Hi,

I have the following task to do:

1. Import a mesh of a hand (.obj) into blender. Create an armature in Blender 
2. Skin the armature with the hand mesh.
3. Export this armature and mesh into OSG.
4. Alter the armature poses in OSG and output a set of jpgs or bmps of the 
depth maps of the resulting poses.

I have done 1 and 2 but dont know how to do 3 and 4. What format can I output 
from Blender that OSG will be able to understand? What part of OSG should I be 
using? OSGAnimation? 
I imagine step 3 is totally standard so thats the most critical part for me 
because I have no idea how to go about it.

I am a relative newbie to the world of meshes and animation and would really 
appreciate some help because I have been stuck on this for two weeks and I cant 
do it by myself.

Thanks!
Looking forward to hearing from the forum :)

Aaron

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





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


Re: [osg-users] osgexport for blender?

2011-05-29 Thread aaron wetzler
Hi Damyon
Thanks for your reply.
I didnt manage on windows so Im now trying on Mac OSX.

I did as you suggested and copied the folder osg and the file osgExport.py into 
/Applications/blender.app/contents/MacOS/2.57/scripts/addons
and once again the line for the osgExporter appears inside blender.

However, when I try to click on the checkbox to enable it it doesnt change. it 
doesnt respond at all.
I restarted Blender but that didnt help.

Am I missing a step? Do I have to do something else?

Thanks

Aaron

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





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