Re: [osg-users] reflection / refraction clip plane
Hi all Here comes my follow up. As you can see in the code snipped above, the clipping plane of the refraction camera is looking in the opposite direction. Since the clipping is done on the graphics card, and the primitives are still in world coordinates, the refraction clipping plane has to be multiplied with the transposed camera matrix. Code: // this is what happens in cull: osg::Matrixd l_ViewMatrix = l_MainCamera-getViewMatrix(); osg::Matrixd l_ProjMatrix = l_MainCamera-getProjectionMatrix(); osg::Vec4d l_PlaneNormalCoeff(0.0, 0.0, -1.0, -m_Height); osg::Matrixd l_CameraMatrix = l_ViewMatrix * l_ProjMatrix; osg::Matrixd l_InvCameraMatrix = osg::Matrixd::inverse(l_CameraMatrix); double* l_MV = l_InvCameraMatrix.ptr(); osg::Matrixd l_InvCameraMatrixTransposed; l_InvCameraMatrixTransposed.set( l_MV[0], l_MV[4], l_MV[8], l_MV[12], l_MV[1], l_MV[5], l_MV[9], l_MV[13], l_MV[2], l_MV[5], l_MV[10], l_MV[14], l_MV[3], l_MV[6], l_MV[11], l_MV[15] ); l_PlaneNormalCoeff = l_InvCameraMatrixTransposed * l_PlaneNormalCoeff; m_RefractionClipPlane-setClipPlane(l_PlaneNormalCoeff); The problem I encounter is the following. All the stuff doesn't have any effect. The fact of setting a new Clip Plane in the RefractionClipPlane object doens't do anything. So I end up having a clip plane for the reflection camera and a clip plane for the refraction camera with both show into opposite directions . According to the theory, this should work... I read something about Positional State attribute and that there are issues when setting multiple clipping planes. I don't get the point there, and maybe need some more insight (say explanation). I thought by having two distinct render cameras, they should be able to have their own clipping planes? Regards Daniel -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56392#56392 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Crash when loading a model
robertosfield wrote: You used Windows :-) True but it is needed ;) robertosfield wrote: Seriously, though it could well be a VisualStudio build and linkage issue, check that you built your application with all the same settings as the OSG was built as this is a very common gotcha with VisualStudio - it can't mix different types of libs such as debug/release etc. That was the problem. Compiled in Debug and used Release libs. Thanks everyone. Kevin -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56393#56393 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] question about CUDA with OSG
Hi Kim, Since you are not telling us what a Big Size of Terrain actually means, we cannot see where the problem lies. Usually this is due to a poor structure of the scene graph, missing LODs, etc. It also could be shader bound, e.g. your fragment shaders/tesselation shaders are simply doing too much. CUDA can help with mathematically problems that can be solved using parallel algorithms. But usually it won't help with rendering performance. There are some cases where it might help. For instance when your rendering is CPU bound in a way that you have to do a lot of computations before you can actually render the scene. So improving the performance is a vague term, as you don't provide more information on where your bottleneck lies. cheers Sebastian Hi, First of all I am not familiar with Osg and CUDA I implemented fIight simulation program with osg but If I use big Size of Terrain, The performance(fame rate) of application is not good So I wanna try to apply CUDA to my osg application for improving the performance So what do u guys think about it? Is it possible to improve the performance With Cuda? and could u let me know How to implement to my osg application? Thank you so much in advance for any help :) Cheers, Kim -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56391#56391 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] error happened when I use opengl in osg (Robert Osfield)
thanks,I will have a try ,I want to use opengl in osg just because someone has impliment the function I need,if I can not do so ,I will try the convert the code in osg.___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] question about CUDA with OSG
Hi Kim, I agree with Sebastian. However, if you are still interested in use CUDA in an OSG application, you can explore osgCompute library ( http://www.basementmaik.com/doc/osgcompute/html/). In addition, in the osgCompute webpage you can find http://www.cg.informatik.uni-siegen.de/data/Publications/2009/orthmann09osgcompute.pdf. Maybe it is useful in order to give you a general idea. Cheers, Carlos On 18 September 2013 08:43, Sebastian Messerschmidt sebastian.messerschm...@gmx.de wrote: Hi Kim, Since you are not telling us what a Big Size of Terrain actually means, we cannot see where the problem lies. Usually this is due to a poor structure of the scene graph, missing LODs, etc. It also could be shader bound, e.g. your fragment shaders/tesselation shaders are simply doing too much. CUDA can help with mathematically problems that can be solved using parallel algorithms. But usually it won't help with rendering performance. There are some cases where it might help. For instance when your rendering is CPU bound in a way that you have to do a lot of computations before you can actually render the scene. So improving the performance is a vague term, as you don't provide more information on where your bottleneck lies. cheers Sebastian Hi, First of all I am not familiar with Osg and CUDA I implemented fIight simulation program with osg but If I use big Size of Terrain, The performance(fame rate) of application is not good So I wanna try to apply CUDA to my osg application for improving the performance So what do u guys think about it? Is it possible to improve the performance With Cuda? and could u let me know How to implement to my osg application? Thank you so much in advance for any help :) Cheers, Kim -- Read this topic online here: http://forum.openscenegraph.**org/viewtopic.php?p=56391#**56391http://forum.openscenegraph.org/viewtopic.php?p=56391#56391 __**_ osg-users mailing list osg-users@lists.**openscenegraph.org osg-users@lists.openscenegraph.org http://lists.openscenegraph.**org/listinfo.cgi/osg-users-** openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org __**_ osg-users mailing list osg-users@lists.**openscenegraph.org osg-users@lists.openscenegraph.org http://lists.openscenegraph.**org/listinfo.cgi/osg-users-** openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- -- Carlos Reig Matut LSyM - Instituto IRTIC Universidad de Valencia Ph. +34 96 354 3639 -- ext. 43639 http://irtic.uv.es/lsym ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] reflection / refraction clip plane
Hi Daniel, I'm afraid I don't have any ideas to what might be amiss. In terms of clip plans/position state and how many clip planes you can have active at any one time, I can provide some clarity. For each osg::Camera that isn't set up as a nested render the OSG's rendering backend sets up a RenderStage per Camera. Each RenderStage has it's own list of positional state (clip planes, eye linear texgen, lights) that it applies with a single modelview matrix prior to the rendering the main of the contents of the RenderStage. This means each Camera can use it's own GL_CLIP_PLANE0. GL_CLIP_PLANE1 etc without it's result interfering with other Camera's RenderStage. Robert. On 18 September 2013 07:10, Daniel Schmid daniel.sch...@swiss-simtec.chwrote: Hi all Here comes my follow up. As you can see in the code snipped above, the clipping plane of the refraction camera is looking in the opposite direction. Since the clipping is done on the graphics card, and the primitives are still in world coordinates, the refraction clipping plane has to be multiplied with the transposed camera matrix. Code: // this is what happens in cull: osg::Matrixd l_ViewMatrix = l_MainCamera-getViewMatrix(); osg::Matrixd l_ProjMatrix = l_MainCamera-getProjectionMatrix(); osg::Vec4d l_PlaneNormalCoeff(0.0, 0.0, -1.0, -m_Height); osg::Matrixd l_CameraMatrix = l_ViewMatrix * l_ProjMatrix; osg::Matrixd l_InvCameraMatrix = osg::Matrixd::inverse(l_CameraMatrix); double* l_MV = l_InvCameraMatrix.ptr(); osg::Matrixd l_InvCameraMatrixTransposed; l_InvCameraMatrixTransposed.set( l_MV[0], l_MV[4], l_MV[8], l_MV[12], l_MV[1], l_MV[5], l_MV[9], l_MV[13], l_MV[2], l_MV[5], l_MV[10], l_MV[14], l_MV[3], l_MV[6], l_MV[11], l_MV[15] ); l_PlaneNormalCoeff = l_InvCameraMatrixTransposed * l_PlaneNormalCoeff; m_RefractionClipPlane-setClipPlane(l_PlaneNormalCoeff); The problem I encounter is the following. All the stuff doesn't have any effect. The fact of setting a new Clip Plane in the RefractionClipPlane object doens't do anything. So I end up having a clip plane for the reflection camera and a clip plane for the refraction camera with both show into opposite directions . According to the theory, this should work... I read something about Positional State attribute and that there are issues when setting multiple clipping planes. I don't get the point there, and maybe need some more insight (say explanation). I thought by having two distinct render cameras, they should be able to have their own clipping planes? Regards Daniel -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56392#56392 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg+osm
You should take a look at osgEarth (http://osgearth.org). If you are just looking to rasterize the OSM and overlay it on some terrain you can use something like MapServer or GeoServer to do the rasterization and expose it as a WMS service that osgEarth can access. You can also use MapBox.com to generate rasterized OSM maps and access them in osgEarth. If you need access to the raw vector data from OSM you also might be able to use the pbf files directly in osgEarth if you use GDAL 1.10, it looks like it has an OGR driver for it (http://www.gdal.org/ogr/drv_osm.html). If that works then you can use the OGR driver for osgEarth and apply any styling you want from simple vector rendering to extrusion of building polygons. Jason On Tue, Sep 17, 2013 at 3:40 PM, Preet prismatic.proj...@gmail.com wrote: On Tue, Sep 17, 2013 at 11:09 AM, Айдар Ильдарович e...@inbox.ru wrote: Hello! I use OpenSceneGraph 3.0.1 in my research. Please, help me, how to use and to load files of OpenStreetMap (extension o5m, pbf, osm) in osgviewer. You can't do this directly. The files have to be opened and parsed using another library and then you need to decide how to set up your scene graph based on your needs. How would OpenSceneGraph know what you want to do with an OpenStreetMap node or way and other such elements? ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] reflection / refraction clip plane
Hello Daniel, what kind of graphics card are you using? ATI/AMD? And are you using a vertex shader for your terrain? I had a similiar problem with reflections in osgOcean. The solution was to add the line gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex; to my vertex shader. On nVidia cards this line seems to be added automatically if it is missing. Thank you! Cheers, Marcel -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56404#56404 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] reflection / refraction clip plane
Hi all I was unsuccesful with the ClipPlanes, so I decided to write a Vertex/Fragment Shader pair that handles the clipping by doing a fragment abort upon testing the vertex world height with a clipping height uniform. Like this I was finally able get the control I wanted. Thank you! Cheers, Daniel -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56405#56405 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Flexibility of osgPango vs osgText
Hello all, Until now I have been using osgText for rendering text to the screen, which has been working fairly well for the most part. However, I have found that I need more sophisticated text rendering, such as having certain words in bold or italicized that are in line with the regular text. Is this possible to do with the baseline osgText? Will osgPango do this better/easier? I want to be able to measure the pixel size of text rendering after I generate it, so I can make it bigger or smaller to fit the area of the screen I'm targeting. I'm using the SourceSansPro series of fonts in my application, and there are different font files for each style (Italics, Bold, etc.) Thanks for any direction you can provide. Eric ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Graphics Context and Window Handle
Hi forum, I think Graphics Context actually encapsulates information on the way in which scene objects are drawn and rendering states are applied. OSG uses the osg::GraphicsContext class to represent the abstract graphics context. In one of the functions that i am writing now, takes a osg::GraphicsContext class object as parameter and from this i need to derive a OS specific window handle and i am not sure how to do it. I did not find any example to it either. Right now i am doing it in the following manner and i think it is not correct. Code: #ifdef _WIN32 #include osgViewer/api/Win32/GraphicsHandleWin32 #elif defined(__GNUC__) #include osgViewer/api/X11/GraphicsHandleX11 #elif defined( __APPLE__) #include osgViewer/api/Carbon/GraphicsHandleCarbon #endif .. .. bool Context::setupDeviceAndContext(osg::GraphicsContext ctx) { ... #ifdef defined(_WIN32) osgViewer::GraphicsHandleWin32 *windowsContext = NULL; #elif defined( __GNUC__) osgViewer::GraphicsHandleX11 *linuxContext = NULL; #elif defined( __APPLE__ ) osgViewer::GraphicsHandleCarbon *osxContext = NULL; #endif //platform dependent casting for the OpenCL context creation #ifdef defined(_WIN32) windowsContext = dynamic_castosgViewer::GraphicsHandleWin32*(ctx); if(NULL == windowsContext) { osg::notify(osg::FATAL) Win32 Graphics Context Casting is unsuccessful std::endl; return false; } #elif defined(__GNUC__) linuxContext = dynamic_castosgViewer::GraphicsHandleX11*(ctx); if(NULL == linuxContext) { osg::notify(osg::FATAL) X11 Graphics Context Casting is unsuccessful std::endl; return false; } #elif defined(__APPLE__) osxContext = dynamic_castosgViewer::GraphicsHandleCarbon*(ctx); if(NULL == osxContext) { osg::notify(osg::FATAL) MACOSX Graphics Context Casting is unsuccessful. std::endl; return false; } #endif } . I need this OS specific Window Handle to create a context property for OpenCL device as follows: Code: cl_context_properties contextProperties[] = { #ifdef defined(_WIN32) CL_CONTEXT_PLATFORM, (cl_context_properties) _m_clPlatform, CL_GL_CONTEXT_KHR, (cl_context_properties) windowsContext-getWGLContext(), CL_WGL_HDC_KHR, (cl_context_properties) windowsContext-getHDC(), #elif defined(__GNUC__) CL_CONTEXT_PLATFORM, (cl_context_properties) _m_clPlatform, CL_GL_CONTEXT_KHR, (cl_context_properties) linuxContext-getContext(), CL_GLX_DISPLAY_KHR, (cl_context_properties) linuxContext-getDisplay(), #elif defined(__APPLE__) CGLContextObj glContext = CGLGetCurrentContext(); // get the current GL context CGLShareGroupObj shareGroup = CGLGetShareGroup(glContext); // share group CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE, (cl_context_properties) shareGroup, #endif 0 }; You do not need to worry about the OpenCL stuff here. I just need to know how to derive OS specific window handles from osg::GraphicsContext ? Is it the proper way to do it as i am doing right now ? I am having trouble in this manner because OpenCL context creation is giving me undefined behavior. If i am correct , then i have to concentrate some where else in the code. I really need your hint over this issue. Cheers, Sajjadul -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56407#56407 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org