Re: [osg-users] Item buffer for lines in OSG
OK, if you really need to know, in your app, what is visible and what isn't, then you probably have the right approach. -Paul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lars Karlsson Sent: Friday, May 23, 2008 11:52 AM To: osg-users Subject: Re: [osg-users] Item buffer for lines in OSG Hi Paul, The technique used in my application is a kind of deferred shading. I have to scan each pixel of the item ID buffer to detect edges that are visible in the current frame. Therefore, an edge that has at least one pixel rendered into the current frame, is deemed visible. In the next pass, I collect all visible edges into a vector, additionally process vector for effects, and then finally render effected lines to the color framebuffer. OcclusionQueryNodes? I took a look into the example, but I can't see how this Node could return a LIST of EDGES visible in the current frame? Sincerely, Lars Hi Lars -- It's not clear to me at all why you would want to do what you describe. Checking every pixel in your prerender buffer seems prohibitively expensive, unless we're talking about billions of vectors... Because your app is old, perhaps you should consider updating its rendering algorithm to take advantage of more modern hardware. Is it possible for your app to programmatically identify heavy portions of your scene graph? If so, I'd recommend parenting those heavy subgraphs to OcclusionQueryNodes, which will do the occlusion test and cull for you. Spatially organizing your data will help improve OSG's opportunities for culling as well. -Paul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lars Karlsson Sent: Thursday, May 22, 2008 3:45 PM To: osg-users@lists.openscenegraph.org Subject: [osg-users] Item buffer for lines in OSG Hi, apologies for a relatively long post I have an old OpenGL application which uses a so-called item buffer for lines. This buffer is based on the idea to associate, upon loading, unique IDs to all the lines in the 3D model, then (on each frame) to: - render all these lines (each with a different color) into this item buffer, with z-test on and lighting off (in order to preserve lines' colors), - scan the item buffer in order to detect the lines visible in the current frame. (Since the line colors are unique, a line is visible if it has at least one pixel in this item buffer.) Finally, I - render these lines (visible in the current frame) into the color framebuffer. Now, since my 3D models are getting big, I decided to use OpenSceneGraph 2.4 in order to optimize the processing using occlusion culling, state sorting and other nice features of scene graphs. However, where to start? OSG Quick Guide did not help, so any tips would be welcome. My first idea is to: - write my own plugin which reads an .osg 3D model and extracts the lines of the model into a separate data structure, because it seems that .osg file format does not enforce serialization of lines - associate unique IDs (which are in 1-1 mapping with unique colors) to the extracted lines - pre-render the model (z-buffer on, lighting off, with polygons in black) into a osg::Camera::FRAME_BUFFER_OBJECT - scan each pixel of the osg::Camera::FRAME_BUFFER_OBJECT to extract currently visible lines, and place them into a separate vector - render this vector (this means that I won't use the scene graph at all for final rendering) Any tips? Thanks, Lars ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-opensce negraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Item buffer for lines in OSG
Hi, apologies for a relatively long post I have an old OpenGL application which uses a so-called item buffer for lines. This buffer is based on the idea to associate, upon loading, unique IDs to all the lines in the 3D model, then (on each frame) to: - render all these lines (each with a different color) into this item buffer, with z-test on and lighting off (in order to preserve lines' colors), - scan the item buffer in order to detect the lines visible in the current frame. (Since the line colors are unique, a line is visible if it has at least one pixel in this item buffer.) Finally, I - render these lines (visible in the current frame) into the color framebuffer. Now, since my 3D models are getting big, I decided to use OpenSceneGraph 2.4 in order to optimize the processing using occlusion culling, state sorting and other nice features of scene graphs. However, where to start? OSG Quick Guide did not help, so any tips would be welcome. My first idea is to: - write my own plugin which reads an .osg 3D model and extracts the lines of the model into a separate data structure, because it seems that .osg file format does not enforce serialization of lines - associate unique IDs (which are in 1-1 mapping with unique colors) to the extracted lines - pre-render the model (z-buffer on, lighting off, with polygons in black) into a osg::Camera::FRAME_BUFFER_OBJECT - scan each pixel of the osg::Camera::FRAME_BUFFER_OBJECT to extract currently visible lines, and place them into a separate vector - render this vector (this means that I won't use the scene graph at all for final rendering) Any tips? Thanks, Lars ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Item buffer for lines in OSG
Hi Lars -- It's not clear to me at all why you would want to do what you describe. Checking every pixel in your prerender buffer seems prohibitively expensive, unless we're talking about billions of vectors... Because your app is old, perhaps you should consider updating its rendering algorithm to take advantage of more modern hardware. Is it possible for your app to programmatically identify heavy portions of your scene graph? If so, I'd recommend parenting those heavy subgraphs to OcclusionQueryNodes, which will do the occlusion test and cull for you. Spatially organizing your data will help improve OSG's opportunities for culling as well. -Paul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lars Karlsson Sent: Thursday, May 22, 2008 3:45 PM To: osg-users@lists.openscenegraph.org Subject: [osg-users] Item buffer for lines in OSG Hi, apologies for a relatively long post I have an old OpenGL application which uses a so-called item buffer for lines. This buffer is based on the idea to associate, upon loading, unique IDs to all the lines in the 3D model, then (on each frame) to: - render all these lines (each with a different color) into this item buffer, with z-test on and lighting off (in order to preserve lines' colors), - scan the item buffer in order to detect the lines visible in the current frame. (Since the line colors are unique, a line is visible if it has at least one pixel in this item buffer.) Finally, I - render these lines (visible in the current frame) into the color framebuffer. Now, since my 3D models are getting big, I decided to use OpenSceneGraph 2.4 in order to optimize the processing using occlusion culling, state sorting and other nice features of scene graphs. However, where to start? OSG Quick Guide did not help, so any tips would be welcome. My first idea is to: - write my own plugin which reads an .osg 3D model and extracts the lines of the model into a separate data structure, because it seems that .osg file format does not enforce serialization of lines - associate unique IDs (which are in 1-1 mapping with unique colors) to the extracted lines - pre-render the model (z-buffer on, lighting off, with polygons in black) into a osg::Camera::FRAME_BUFFER_OBJECT - scan each pixel of the osg::Camera::FRAME_BUFFER_OBJECT to extract currently visible lines, and place them into a separate vector - render this vector (this means that I won't use the scene graph at all for final rendering) Any tips? Thanks, Lars ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-opensce negraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org