[osg-users] [vpb] Terrain Deformation as per Road Profile
Hi, I am planning to use VPB for terrain deformation as per road profile. The road mesh has been generated separately and I shall put it on the terrain. The terrain generated by VPB must deform itself as per the road profile. Also additional geometry must be added to terrain geometry close to the road borders for smoothness as the terrain quad tile cells may be too big. This situation I have tried to visualize as shown in the two below images. Now the best approach I see is to let VPB generate the terrain tiles as OSG files. I know the road border points. I can figure out which terrain tile a segment of the road shall fall. Let’s say I know the road border points for the particular terrain quad tile as per figure 1. Now I need to tessellate or subdivide the Terrain tile cells that are falling on the road path. Thus I need to deform as well as increase the terrain mesh at the road borders. Question: What should be my best approach to achieve this? • I might use tessellation shaders approach, but it might tessellate everywhere I move camera not specifically at road borders. Maybe create a grayscale texture runtime that highlights the road surface & pass it to Tess shaders to tessellate at the road borders? • I might use old GluTess with winding order to cut holes in terrain where road goes. But those may create very long triangles if cell size is large. So please can anybody give me some pointers to approach this? I know this goes beyond VPB. By the way, each terrain tile also has its road cut piece. Thank you, Robert! Cheers, umesh -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=72531#72531 Attachments: http://forum.openscenegraph.org//files/2_990.jpg http://forum.openscenegraph.org//files/1_160.jpg ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Jittering/Flickering geometry problem
Hi Sebastian, Thanks for the prompt reply. As I had written earlier, I do not prefer to generate my road geometries at origin & translate far off where they are located (maybe that’s the last option that I shall use). I am under the impression that there might be other techniques to tackle this problem. I think, VirtualPlanetBuilder is generating the Terrain Tiles in the way you had written. But, FlightGear too has terrain & roads all over & they are rendered properly. Do the similar Projects use the same basic theory that you had written? It will be helpful if you can give additional insight into this. Cheers, umesh -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=70205#70205 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Jittering/Flickering geometry problem
Hello Robert, I created geometries mathematically for a very long road (>1500km). The vertex values are similar to as shown below, for example: osg::Vec3d bottom_left(-2849337.167, 42249.143, -1.0); osg::Vec3d bottom_right(-2849337.167, 42249.143, -1.0); osg::Vec3d top_right(-2849337.167, 42249.143, -1.0); osg::Vec3d top_left(-2849337.167, 42249.143, 1.0); As you can see, they are high values. The problem is the geometry is jittering during animation. I do not want to create the geometries at origin, & translate to the far location. How to solve this jittering/Flickering geometry problem in OSG? Any osg::Camera settings we can modify to solve it? Thank you!..as always to reply to queries. Cheers, umesh -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=70184#70184 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Secondary Color not working?
Hi, There seems to be a bug in OSG related to accessing secondary colors in vertex shader. I am using OSG 3.2.1. The same issue might also exist in OSG 3.4 too. Here’s how I found out the issue: I want to pass 8 attributes from my osg App to the shader. Then I need to retrieve those 8 attributes in vertex shader & perform my operations on them. Note: In Italics are Pseudo code, not actual syntax. I use primary color as… geometry.setColorArray(colors); geometry.setColorBinding(BIND_PER_VERTEX); …in my osg App to pass the first 4 parameters. I use secondary color… geometry.setSecondaryColorArray(secondcolors); geometry.setSecondaryColorBinding(BIND_PER_VERTEX); … to pass rest 4 parameters to shader. In shader, I access… texWeight[0] = gl_Color[0]; ... texWeight[4] = gl_SecondaryColor[0]; ... …to do my operations. But all (or some) of the 4 secondary color values are not proper or invalid. So as a work around, I am using … geometry.setTexCoordArray(0, secondcolors); ..and in shader … texWeight[8] = gl_MultiTexCoord0.s; orgl_TexCoord[0]. The above is working fine. To cross verify, I wrote the exact code in OpenGL and used: glSecondaryColorPointer( 4, GL_FLOAT, 0, &SecColorBuffer[0] ); In shader… texWeight[4] = gl_SecondaryColor[0];. This worked perfectly. I am using Nvidia GPU. Thus, I concluded that there’s maybe a bug in using SecondaryColor method in OSG. Thank you! Cheers, umesh -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=70183#70183 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [vpb] Roads as Shapefiles in VPB?
Hi Robert, How about osg Delaunay (Cutting terrain for road)? Or modifying the heightmap image itself (may be 2048X2048), modifying the pixels where the road falls with proper height value? VPB shall do the rest. Thank you! Cheers, umesh -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62121#62121 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [vpb] Roads as Shapefiles in VPB?
Hi Robert, After posting this, I quickly realized that SHP files might be doing some sort of "draping" rather than modifying the terrain. Anyway,It will not do the job I Feel now. There was osgTDS (Terrain Deformation s/w) sometime back. Now it seems to be out of shape. That was doing something similar to what I trying to achieve. Isn't it? I do not prefer osgEarth. VPB satisfies my needs good enough except with this road issue. Anything you can suggest to try out to modify Terrain to adjust to my 3D roads (using VPB/ osgTerrain etc)? I can try out your concepts. Please reply to this part if you have little spare time :) . Thank you! Cheers, umesh -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62120#62120 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [vpb] Roads as Shapefiles in VPB?
Hi All, I have road geometry (3D) that I might be able to convert to SHP file using shapelib library. If I load the shapefile for the road, shall I expect the terrain in VPB to be modified to accompany the road on top? My Aim: Wherever the road is present, the terrain must be flattened (go below the road). At least, VPB experts can be able to tell if this is feasible with existing SHP file support in VPB? Thank you! Cheers, umesh -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62117#62117 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Does OSG support reading RGB8/RGBA8 PNG image data?
Hi Robert & Eric Overall I feel (as Robert suggested earlier), just load the images & OSG shall automatically take care of the rest. Thank you! Cheers, umesh -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62037#62037 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Does OSG support reading RGB8/RGBA8 PNG image data?
Hi Robert, OSG supports and displays RGB, RGB8 etc correctly, agreed. But whether it is "packing" the RGB components properly, I need to analyze. I think now we are deviating from my simple question that I asked initially. I again give a short description: I had originally 32 Bit textures. I wrote the geometry with the texture data to IVE file. The IVE file size was 26 MB. Then I realized that I do not need true color textures, so I converted my images to 8 Bit images (RGBA8) reducing my image size from 4 mb to 1 mb (This can be easily done using Paint.Net Free App). Then I again wrote the data to IVE file expecting that now the IVE file size shall be far less as the image data has reduced. But the file size is same 26 MB. Thus I guess OSG stores the texture data in RGB or RGBA format only and not in the original file format (that is RGB8 or RGBA8 unsigned byte in my case). If I set RGBA8 in image->setInternalTextureFormat does not affect size or view. But if I set RGB in image->setPixelFormat instead of RGBA, I see 1 MB less size in the IVE file (now 25 MB). Maybe because now alpha componenet is not written. My final objective is if my texture sizes are less I should have more texture memory available in graphics memory to load additional textures. And i am trying to verify whether OSG loads OpenGL with actual texture size (in my case RGBA8) or uses always RGB/RGBA format only. The display anyway will not be affected but unnecessary texture memory will be allocated I guess. The discussion above is on OSG with OpenGL & not OSG with OpenGL ES. I am using OSG for our Simulation research & I do not doubt its capabilities. But since I am neither a novice nor a full expert in OSG I came across above doubts that someone in forum can answer/reply. Thank you! Cheers, umesh -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62024#62024 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Does OSG support reading RGB8/RGBA8 PNG image data?
Hi Robert, Thanks for the prompt response. I am not talking about compressed textures. By RGBA8 i mean typically R8G8B8A8. I believe that OpenGL also interprets in this way. Typically if we use an OpenGL App in which we have to read a PNG image that is in RGB8 format, we may use LibPNG library to read the data in the correct format, then it shall give a pointer to the data (let's say *Data). Then we shall use glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, Data). So technically OpenGL shall interpret as per input & render. I peeked into the osg::Texture and osg::Image classes, but could not make out whether they handle these data formats properly & pass on to OpenGL in the correct format as the image format (for example RGBA8).Again, OSG shall invoke LibPNG PlugIn for reading the data. It may need to tell that the data is in RGBA8 format. Or I might need to explicitly tell through osg::Image like (image->setImage(width, height, 1 ,GL_RGBA8,GL_RGBA,GL_UNSIGNED_BYTE, (unsigned char*)data,osg::Image::NO_DELETE)). If OSG does handle 8bit/32bit images properly then I should be able to save a lot of texture memory I believe. But I not able to figure out whether OSG does handle this correctly & pass on to OpenGL. Secondly, if it does correctly how shall I confirm this (may be as I posted earlier I need to see using an OpenGL debugger tool for texture memory usage). (I actually am working on OpenGL/OSG as I am a Graphics developer). Thank you! Cheers, umesh -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62006#62006 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Does OSG support reading RGB8/RGBA8 PNG image data?
Hi, I am still not able to make out whether OSG or its PlugIns automatically determine the size of RGB/RGBA components and load accordingly to OpenGL through glTexImage2D(). Technically it must do in that way. When we program using direct OpenGL we provide glTexImage2D with the correct format & data type & it shall load accordingly (at least thats what I guess). Lesser size textures are really useful when we program for any embedded application running OpenGL. I am involved in Desktop OpenGl now though, using OSG. Anybody has any insight on this please let me know. From My side I shall try to use gDebugger to compare the Texture memory size with earlier images & with 8 Bit images. That may tell whether graphics texture memory has reduced using 8 Bit format. Thank you! Cheers, umesh -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=61999#61999 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Does OSG support reading RGB8/RGBA8 PNG image data?
Hi, My PNG images were 32 Bit. Since they did not contain rich colors, I converted to 8 Bit PNG textures without any loss in image quality. Also the image size reduced significantly. I tried to read those images using readImageFile() as usual with OSG. they looked fine. Then I wrote my scene data to IVE format expecting that the file size shall be less than earlier as the images are 8 bit now. But the file size remained same. (image data are embedded in IVE). Thus I concluded that OSG considers only RGB/RGBA format & it does not bother other lesser size formats. If there is a way to tell OSG that this is my size & format, then perhaps it shall do accordingly, but how to tell it? Thank you! Cheers, umesh -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=61888#61888 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to use gDEBugger for OSG performance analysis
Hi Alistair, I am able to see the graphics profiling using gDEBugger now. Actually there are multiple GL Render Contex created. As i have attached the image, you can see around 15 Render contexes. I wonder how so many RC are created. I do not have so many render windows in my GUI (I am using a DLL that does the rendering, so I do not know how many RC being created). Simply speaking, if you take any OSG example like osgShadow.exe & run it, in gDEBugger their are two RC created. The default one (RC1) does not show anything. That's why I was confused & wrote in OSG forum. The second RC shows the contents. I know that RC generally means there is a window for rendering (leave alone render-to-texture). Can anyone tell why so many RCs are created. Also in gDEBugger there is an option "Add Render Context". What shall it do? Thank you! Cheers, umesh -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59485#59485 Attachments: http://forum.openscenegraph.org//files/rendercontexts_815.png ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How to use gDEBugger for OSG performance analysis
Hi Everyone, I have an App that loads various DLLs before opening a GUI. After giving some input from another App, this GUI invokes OSG DLLs for doing the rendering in that GUI, which has a OSG viewport. How to use gDEBugger for making performance analysis on such type of set up (that includes various DLLs & osg DLLs)? As fas as I know gDEBugger takes an exe & does the job. In my case, if I provide my EXE as input to gDEBugger, only it shows the CPU usage. Thank you! Cheers, Umesh -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59400#59400 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org