[osg-users] CMake 2.6a build system and OpenSceneGraph - problems with long paths?
Hi, I've been trying to build OpenSceneGraph 2.8.0 from source, using Visual C++ 2008. I noticed a strange effect with the CMake 2.6a build system that results in some examples not getting built. I've placed OpenScenegraph in a subdirectory of the default Visual Studio 2008 projects folder and selected the a build subdirectory for generating the binaries (and project files) separately from source. D:\Documents and Settings\Christian Buchner\My Documents\Visual Studio 2008\Projects\SON\dependencies\openscenegraph-2.8.0\OpenSceneGraph Some examples with the longest filenames are not getting built. The EXE files are missing, yet the .obj files are being created. Visual C++ reports a Compiling... phase, but omits the Linking... phase. So I would expect th .EXE files to be generated in the following folder D:\Documents and Settings\Christian Buchner\My Documents\Visual Studio 2008\Projects\SON\dependencies\openscenegraph-2.8.0\OpenSceneGraph\build\bin But in my case the following examples have not been built (naturally leading to a failure to build the INSTALL project) osganimationskinning osganimationtimeline osgmultiplerendertargets osgmultitexturecontrol osgpackeddepthstencil osgwidgetperformance Now the questions are - who is to blame and how can we fix it? - myself for making too long paths? - CMake ? - Visual Studio 2008 (Standard) ? - Windows ? If anyone has run into similar problems and/or knows a remedy, please let me know. In the mean time I will such things as shortening the path, for example by renaming dependencies to deps and build to bld. I would definitely like to stay in the default location for Visual Studio projects - and I also want to keep my Windows user name ;-) Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] CMake 2.6a build system and OpenSceneGraph - problems with long paths?
I have to correct myself. I was using cmake 2.6.2 (installed from cmake-2.6.2-win32-x86.exe). Shortening the directory names did in fact solve the build problem for me. Maybe it should be put in some sort of OpenSceneGraph FAQ (or the platform specific Wiki page) that path names approaching 130...140 characters are possibly going to mean trouble in the win32 build process. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OSG WIN32 debug build using VC++ 2008 - plugin load failure due to missing manifest
Hi everyone, I've been building OpenScenegraph 2.8.0 in both the debug and release versions on Windows using VC++ 2008 SP1. I am doing application development - and therefore I am often using a debug build of my application. This debug build also links against the debug build of OpenSceneGraph. When plugins are used, e.g. a plugin to load compressed TIFF files, however these plugins fail to load in debug mode - and thus the textures cannot be loaded. It appears that in debug mode no manifest file is embedded in the generated plugin DLLs. So these fails to load the Visual C++ 2008 debug runtime DLLs because they are installed as Side by Side assemblies in the Assembly Cache. When I copy these DLLs manually into the system's search PATH, I get a dialog box stating that the runtime has been loaded in an improper way and the application bails out. If anyone familiar with Win32 and CMAKE builds could look into this problem, I would be grateful. Thanks Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG WIN32 debug build using VC++ 2008 - plugin load failure due to missing manifest
I found that the reader plugin for compressed TIFF fails in debug mode, but PNG and BMP work. So I've switched to these formats for the time being. I will check if the dependency walker tool produces any useful output in the TIFF case. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] any existing Camera Manipulator with TUIO support? Who is willing to share?
By the way, how many months (years) out is any officially supported Multi Touch feature in OSG? Have there been any Multi-Touch contributions into OSG accepted so far? Well, anything that's in the trunk (and not in some third party contrib folder) can be considered official. Of course then it has to build on every platform and ideally not add any extra dependencies to OSG. It would certainly be nicer to integrate multi touch more deeply with the event handling system instead of hacking the camera/matrix manipulators individually (adding support for an alternative control system to each one). Unfortunately my understanding of the event underpinnings of OSG are pretty superficial. Also in our application we had to restrict the freedom of motion for the camera manipulator. We disallow placing the camera in a head down position or at nonzero bank angles. And that may not satisfy everyone's needs. So when I create and submit a patch, it might not be for everybody. And the chances of it getting accepted might converge towards zero ;) ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Quad buffered stereo?
Hello osg-appreciating fellows, so my boss had this awesome idea to use 3D shutter goggles with our OpenSceneGraph application - and unfortunately I am the clueless implementer ;) So I looked into hardware support and found that the professional nVidia Quadro range would support this gimmick for OpenGL applications (whereas the consumer cards only allow this in DirectX games on Vista and Seven). So great news about the hardware support - but the application does need to use a quad buffered stero frame buffer. Now the question is how I would enable an OpenSceneGraph application to use a quad buffered stereo view mode - and if possible in windowed mode (our app isn't currently full screen). Is this even possible? Is there any osg sample that uses a quad buffered framebuffer already? If anyone could shed some light on this issue, I would be eternally grateful. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Quad buffered stereo?
Thanks, so we will likely order the hardware first and move forward from there. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Modifying editing eye separation and eye mapping in a realized OSG Viewer?
Hi I am using OpenSceneGraph 2.8.2 with great success to display a stereoscopic simulation on a polarized 3D display. I had intended to allow the user to interactively edit parameters such as eye separation and the eye mapping (a swap eyes function). However I am having trouble making the viewer or the camera use the new parameters I have tried setDisplaySettings() passing a modified eye mapping in the DisplaySettings object to the Viewer, to the Camera and on the osg::State associated with the Camera. However my changes were not reflected in the rendered image. There must be something I've missed. Is it possible at all to change these parameters in a realized (and running) osg::Viewer ? Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Modifying editing eye separation and eye mapping in a realized OSG Viewer?
Okay, I got smarter. ;) The renderer duly ignores the Horizontal eye mapping settings in Quad Buffer, Anaglyph, Interlaced modes and only evaluates the parameter in the HORIZONTAL_SPLIT mode. Likewise it only takes the Vertical eye mapping setting in VERTICAL_SPLIT mode. So basically I have to try a negative eye separation distance in the other modes because I really need these eyes to flip in the other modes, too. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] wglShareLists() on Intel 945GM, 965GM does not include ARB shaders - ouch.
Hi, I am having a peculiar problem in my application. The OpenGL Intel graphics drivers for the GPUs mentioned in the subject seem to have a bug where a wglShareLists() on windows (for OpenGL context sharing) does not carry over any ARB fragment and vertex shaders. This leads to OSG trying to apply shader handles in the new context that are only valid on the original context. Is there a way to force a osg::FragmentProgram and osg::VertexProgram to re-load the shaders (as if it was a different graphics context)? Would this be a case that might be considered for an implementation of a workaround in the osg shader code? I might be willing to supply a patch if this has a chance of getting included. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Blueberry3D high detail terrain solution for OpenSceneGraph
Most Impressive. I would like to see this technology to get used in Flight Simulators Not the military and professional ones - but those that everyone can buy off the shelf at the local software store. Have the 3D buildings and trees been planted with an automated process or was this edited by hand? Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Camera control like in Google Earth - how to do that?
Hi everybody. So far my 3D simulation and visualization uses the trackball manipulator for controlling the camera. Is there anything built into OpenSceneGraph that mimicks the way that one can control the camera in Google Earth? Has anyone succeeded building such type of camera control with OpenSceneGraph? Would anyone know about any patent issues with the way Google do it? Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Embedding OSG in QT 4.5.0 with QGLWidget + QGraphicsScene / drawBackground() - need a little help.
Hi, I think I have understood the osgviewerQT sample. This creates a QGLWidget overloads its paintGL() function and calls into osgviewer::frame() to let OSG do the rendering and all is good - i.e. we see the OSG scene displayed inside a window managed by QT. I am now trying to do something more advanced and let QT render semi-transparent widgets on top of the openGL scene. In the relevant QT examples this is done by assigning a QGraphicsScene to the QGLWidget instead of overloading the QGLWidget's paintGL() function. The relevant QT examples are called boxes (in the demos folder of QT) as well as openglcanvas sample ( see the article http://doc.trolltech.com/qq/qq26-openglcanvas.html ) The QGraphicsScene has a drawBackground() function where we are inside an openGL context created and maintained by QT. Trolltech (Nokia) say that you can do your own OpenGL 3D rendering here, but you're supposed to revert all changes you make to the OpenGL state when you're done rendering, so that QT can draw its widgets on top successfully (also using OpenGL, mind you). Apparently simply calling osgviewer::frame() here is doomed to failure as the openGL states of OSG and those maintained of QT will clash seriously. Unfortunately my experience with OSG's state management is poor. How would I achieve to save all OpenGL state, then make OSG set up its needed OpenGL state from scratch, render its frame, and then restore QT's previous OpenGL state? Would it be easier to let OSG render everything to texture using a separate OpenGL context and just render this texture inside drawBackground()? Any help with this will be greatly appreciated. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Embedding OSG in QT 4.5.0 with QGLWidget + QGraphicsScene / drawBackground() - need a little help.
Success - I found a solution to this. The solution was to store and restore the matrix stack as well as the openGL state, and to call getState()-reset() on the osgViewer::GraphicsWindowEmbedded object. I now have an OSG Viewer running on QT 4.5 with overlaid semi-transparent Qt controls and widgets. I am planning to put together an osgViewerQTAdvanced sample with a few interactive features (buttons to click on, etc). This code will be submitted to osg-submissions when done. I am also planning to use this method in an engineering product in my day job. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Embedding OSG in QT 4.5.0 with QGLWidget + QGraphicsScene / drawBackground() - need a little help.
I would suggest using a different name than osgViewerQTAdvanced, because the fact that you're using GraphicsWindowEmbedded tells me that it's not really that advanced, just eye candy... You're missing out on OSG's multithreading capabilities by using GraphicsWindowEmbedded. Maybe I can even merge this into the existing osgviewerQT sample, using a command line option to trigger the new eyecandy. For my purpose I actually need everything to be single threaded, as the other CPU core is supposed to run some kind of time critical simulation (undisturbed). I have run into another problem. With my current approach the scene loses all lighting after the first frame has been drawn. All polygons appear in flat shading. I have currently no idea what is causing this. At first I was not noticing this because I rendered cow.osg which uses a metallic effect (environment maps?). But on other scenes the loss of lighting is apparent. I am currently investigating. If I can't find the cause, I will have to come back to this list. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Embedding OSG in QT 4.5.0 with QGLWidget + QGraphicsScene / drawBackground() - need a little help.
This suggests that when pushing and popping state in order for Qt to draw its widgets, something is not pushed/popped correctly, probably GL_LIGHTING, GL_LIGHT0-GL_LIGHT7 or something like that? Perhaps glShadeModel? ... Hi yes indeed, something was killing off the GL_LIGHTING and GL_LIGHT0 flag. And it was something rather unusual. Turns out the embeddedGraphicsView somehow calls into SceneView for rendering. SceneView is marked as deprecated in the DoxyGen documentation - maybe because it's the old single threaded rendering path? Near the end of SceneView::draw() we find the following peculiarity. // re apply the defalt OGL state. state-popAllStateSets(); state-apply(); This resets the state to the OpenGL default - and turns off my lighting ! This is the only place in all of OpenSceneGraph() that popAllStateSets is being used - I did a full search. So I wonder what I should do about that. And why does this not also screw up all other code samples that make use of the embeddedGraphicsView - like e.g. the regular osgviewerQT ? Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Embedding OSG in QT 4.5.0 with QGLWidget + QGraphicsScene / drawBackground() - need a little help.
Boy, that code looks surprisingly similar to mine, except for this center part: // Make sure that OSG's state is prepared based on the last state // recorded (if available). The first frame is different. osg::State *state = getCamera()-getGraphicsContext()-getState(); state-reset(); state-apply(m_lastStateSet.get()); // Run a frame: this is where the action happens. frame(); // Store the OSG state for restoration in the next frame. getCamera()-getGraphicsContext()-getState()-captureCurrentState(*m_lastStateSet); Maybe the additional getState() + reset() / apply() and captureCurrentState() will solve my lights problem. I will try. Thanks a bunch! ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Minimal OSG installation
I've seen this error before. The issue could be that you put the Visual C++ 2008 (SP1?) runtime into the program folder. The only way to do this properly is to run the Visual C++ 2008 (SP1) redistributable from the application's installer. This will take care of placing the DLL in the WinSXS folder (Side by Side assembly cache). Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OT: Visual Studio 2008 and deploying an OSG application
The VC 2008 redist and manifest may have to be put separately into plugins directory. A word of warning though: memory allocated by a plugin may not be freed by the main application because the VC runtime is loaded into memory twice. It may be safer to install the VC 2008 redist from the redistributable setup - it causes less headache. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OT: Visual Studio 2008 and deploying an OSG application
Hmm. Sorry, I missed that you stated: and I already copied the files into the plugins directory as well Would it help to add the osg Plugins directory to the PATH variable? ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Not OT: Visual Studio 2008 and deploying an OSG application
If you're still deploying the VC 2008 runtime as private assemblies (both manifest and directory Microsoft.VC90.CRT copied to both the OSG top level folder, as well as the OSG plugins folder) - you might want to a note I found attached to the following MSDN article http://msdn.microsoft.com/en-us/library/ms235291.aspx Could it be that the plugin is allocating memory that the viewer is then releasing or vice versa? This would explain the crashing, because the runtime is effectively loaded twice (given that the plugin DLLs have an embedded manifest, which may or may not be CMAKE option to enable and disable) snip: Note is quoted here Installing Microsoft.VC90.CRT as private assembly in several folders is not a good idea! If you install Microsoft.VC90.CRT in more than one folder, you have to keep in mind that there may be more than one instance (*) of the runtime-library in memory if you embed a manifest in a DLL. This results in many problems. In example you cannot allocate memory in one instance and free this in a different one. The best way is to create a dependency manifest in only one place (the executable). And build the extension DLL without a manifest. (/manifest:no as linker option). (*) This behavior occurs only, if the runtime is not installed in WinSxS end snip -- Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Doxygen documentation still at 2.8.0
I just noticed that the OpenSceneGraph Doxygen documentation has not been recreated after the 2.8.1 release. I am not sure if there would be any significant changes to 2.8.1, considering that it is a bugfix release only. http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/ Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Advice sought for rendering coins in OSG. Lots of coins.
Hi, I was going to start a hobby (i.e. noncommercial) project to simulate an electromechanical coin arcade game. This would include rendering potentially hundres of coins that physically interact (think 500...1000 coins). For the physics simulation I am going for the free bullet physics package. For rendering I intend to use OSG. One problem with GPUs is that round shapes map badly to triangle meshes. One needs a lot of triangles to make the coins appear sufficiently round. Lots of vertices may conflict with the idea of rendering many coins simultaneously. I could go down the route of using a mesh based 3D model combined with LOD techniques. However this may incur some performance issues on architectures like Intel GMA that have pixel shaders in hardware but do all their vertex processing on the CPU. Also I would really like to include a 3D relief for the coin imprinting (embossment), either by using simple bump mapping or more advanced pixel shader based techniques like parallax mapping or relief mapping. To get simulated (fake) reflections I need to apply some kind of environment mapping. Considering that I will have to use pixels shaders anyway, I was thinking that this can a pixel shader could just as well be used to also render a geometric primitive like for example a cylinder. The pixel shader would have to do some calculatios like does the view ray intersect with the primitive? and what is the surface normal?... very much like in raytracing. The only vertex based geometry needed would be a billboard that fully covers the visible extents of the geometric primitive (or alternatively a box that wraps around the visible extents of the primitive) To get started with this I could use a few pointers and suggestions. 1) Does anyone here know some open sourced OSG based code that renders primitives like spheres, cylinders, cones or the like within a GLSL pixel shader? I know there have been projects in academia that did just this, but is there anything open sourced? 2) Would anyone know a nicely done (in terms of documentation, clarity) parallax mapping or relief mapping implementation in GLSL and OSG? I've found a lot of conference papers on this (Siggraph etc) but almost no source code. It's often 10 times harder to start something from scratch than to modify someone's existing code. So thanks a lot for any pointers and help, Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Advice sought for rendering coins in OSG. Lots of coins.
Out of interest are you simulating a penny push machine? Yes. These sucked the life out of my wallet on my last trip to Shanghai and Hangzhou. Playing with virtual currency would be cheaper. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Advice sought for rendering coins in OSG. Lots of coins.
You could take a look at the draw instanced support in OSG, good for drawing lots of things. I believe this instancing capability might require Geforce 8 class hardware. I was thinking along the lines of how the osgforest sample replicates thousands of trees from the same billboard drawable. However I would also need to add per instance rotation, not jus a simple displacement. BRDFs could be used to render a high fidelity coin on just a couple I think BRDFs are a little over my head. I think they would not add a true relief, just different reflectivity at different locations on the coin surface. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Advice sought for rendering coins in OSG. Lots of coins.
Out of interest are you simulating a penny push machine? Here is a first youtube video of my progress so far. http://www.youtube.com/watch?v=74C61A-wzaA This is based on the osgBullet sample code found on the OpenSceneGraph Wiki on Support/Tutorials. A few things to note: - No shiny coins with imprint yet, just a simple cylindrical model exported from Blender. - things get slow with more than 70 coins on this (slightly outdated) machine. The bottleneck is definitely physics, not rendering. May have to experiment with CUDA acceleration to achieve 500 coins and more. - The coins slide apart when stacked on top, as if the whole setup was on a vibrating ground plate. I need to get in touch with the guys on the bullet physics forums to see if this can be solved. I will be back when I've got the shiny coins done... and hundreds of them! Thanks for all your suggestions so far. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Advice sought for rendering coins in OSG. Lots ofcoins.
Hi Paul, Is your app explicitly setting this down to fewer samples for performance reasons? Assuming dt, is the time between 2 frames, I call stepSimulation(dt, 20, 0.005); // 200 ticks per second, minimum 10 FPS assumed I will be taking the physics related discussion to the proper forums, because I think it is off-topic for osg-users. I describe some of my settings and assumptions in the post linked below. http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9t=3623start=0 Thanks for your interest, Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Dynamically generating smooth camera rides?
Forgive my laziness - are there any utility classes within OSG that let the camera go on a smooth ride to a specific location and eyepoint vector from the current location? I mean smooth in the sense of the camera accelerating and braking, instead of making a simple constant linear movement and rotation. If there is no ready made solution for camera paths - how difficult would it be to dynamically create a key frame animation for the camera for abitrary start and stop locations? Ideally I'd like the user to be able to quickly observe some points of interests within in my 3D simulation, without instantaneously zapping the camera to the new position. There should be some kind of whoosh effect where the camera travels from the current location to the destination quickly, within about second. This may have the advantage that the user will be able to maintain a sense of orientation in space which would be lost by switching to the destination camera position instantly. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Dynamically generating smooth camera rides?
Thanks, your and Paul Martz kind pointers should get me started. I did check try the Virtual Rome site also, but the graphics loaded kind of slow through my HSDPA connection. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Looking for GLSL Parallax Occlusion Mapping
For a parallax sample using GLSL there are probably a lot of samples on ATI or Nvidia developper site, but maybe you'll find some interesting demo on ozone3d: n Strangely that preview for Parallax Bump Mapping demo says Source Code: [YES] but when you go to the detail page and download the demo ( ParallaxMapping_Demo.zip ) there is no source code to be seen. I am also looking for this rendering technique to make some realistic rendering of coins with an embossed imprint. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OsgQt viewer very very slow
I think the QtOsgwidget is currently single threaded, meaning that any performance gain achieved by multithreading inside OSG is lost. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Advice sought for rendering coins in OSG. Lots of coins.
A little youtube video clip showing the progress on my coin pusher arcade prototype with very simple graphics: http://www.youtube.com/watch?v=ubpZUTuO1ecfmt=22 The bottleneck here is definitely physics. Frame rates take a dip when lots of coins are interacting. I am hoping for some public CUDA support in the Bullet physics library in the near future. This demo is based mainly on the osgbullet source code found on the OSG Wiki. I replaced the golf ball in the demo with coins and I am tossing in a new coin every second. I also added a box-shaped pusher and a (yet invisible) rear wall that makes sure the coins fall off the pusher eventually. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Advice sought for rendering coins in OSG. Lots of coins.
To profile the peformance bottleneck it would be best to press 's' a couple more times to get the full frame rate stats so you can see exactly which parts of rendering are the bottleneck - the frame rate only tells that you frame rate is reducing it doesn't give any clues to why. I am pretty sure I am limited by the physics. Right now I have to reduce the physics time step dynamically to stay within my tolerated frame rate window. A final video (I promise!) is posted here and it shows an almost complete pusher machine and up to 400 coins in the game. http://www.youtube.com/watch?v=0bLAq7btZbUfmt=22 I have since made the pusher operate faster so the player won't fall asleep. I still have to add the game mechanics (player's coin balance, player controlled coin insertion etc). My coins are currently rendered several OSG PositionAttitudeTransforms, all from the same model instance. I may switch to an approach that uses vertex shaders soon. A future enhancement could put the physics on a separate thread from OSG. We will see how that goes. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Multi-touch in the OSGViewer and camera manipulators
Hi, My boss was running my 3D engineering app on a 32 inch touch screen (no multi-touch yet, I suppose) and he liked how he was able to rotate the camera with a fingertip. That gave me an idea - are there any affordable Multi-touch LCD screens (standalone) and how difficult would it be to add Multitouch capabilities to OSG? In particular I was wondering what it would take to support Multi-Touch capabilities in the various Camera manipulators - and how to get the special input events from various operating systems (Mac, Windows, Linux). In particular zooming with two fingers would be extremely cool (the pinch gesture) , and grabbing an object with two fingers, rotating it (or the camera around it) in the 3D view according to how the two fingers move. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] get texture from scene a frame n-1, n-2, n-3 ...
Can't you just store the n frame in a circular buffer of size 4? That gives you frames n, n-1, n-2 and n-3. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] thousands spheres renedering with OSG
You might want to explore using vertex shaders to achieve some kind of fake geometry instancing. The SDK sample osgforest does something similar to project a forest made of thousands of trees using GLSL (and also ARB fragment program in the 2.9 branch). More about OpenGL pseudo instancing is found here in this nVidia paper: http://download.nvidia.com/developer/SDK/Individual_Samples/DEMOS/OpenGL/src/glsl_pseudo_instancing/docs/glsl_pseudo_instancing.pdf Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] thousands spheres renedering with OSG
Beside of that, my boss is not very keen to idea of vertex shader instancing for the reason of hardware limitations we should impose to our customers. To convince your boss: Vertex shaders even run even on Intel accelerated graphics (GMA 950) which is more than 3 years old since first introduced. Intel has a SSE2 accelerated software path in the driver to make up for the lack of hardware vertex shaders. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Background image
Hi Carlos, you need to put the HUD in a render bin that is drawn before everything else. Setting the render bin to 0 or 1 should work (because I think other geometry would default to bin 2) The HUD also needs to be configured to not write to the z buffer. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] source for 3d glasses?
http://www.amazon.de/3DStereo-Glasses-3D-Brille-Blau/dp/B001VJYGE0/ref=sr_1_1?ie=UTF8s=ce-deqid=1268254978sr=8-1 very cheap this offer is - but shipping you must pay for. says Yoda. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] 2.8.3 press release
There's a typo oagAnimation instead of osgAnimation. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Support vendor specific 3D APIs - any interest here?
Hi, So quad buffered stereo only works with professional graphics cards, and I have used that feature with success at my work place. At home I do not have access to such devices. But I do have a 120 Hz capable monitor and those nVidia 3D Vision shutter glasses, which unfortunately only support DirectX gaming and stereo viewing of video and still images. This is mostly targeted at a gaming audience and OpenGL is no longer relevant enough to be supported (what a shame!). But nVidia have created a proprietary API (NVAPI) with which it is possible to display pretty much anything with shuttered glasses. Would there be any interest to fit OpenSceneGraph with a capability to render to 3DVision enabled displays with non-Quadro graphics cards? Is support for proprietary APIs and extensions frowned upon in this community? (I hear ATI have a similar vendor specific shutter glasses API in their latest drivers) Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Support vendor specific 3D APIs - any interest here?
Hi, This presentation has something on presenting stereoscopic imagery based on a DirectX9 surface, page 36 onwards. http://developer.download.nvidia.com/presentations/2009/GDC/GDC09-3DVision-The_In_and_Out.pdf NVAPI as found here http://developer.download.nvidia.com/NVAPI/NVAPI_May2009.zip describes details in the Stereoscopic 3D APIs section how to turn on 3D mode and even how to swap left/right eyes on stereoscopic surfaces with NvAPI_Stereo_ReverseStereoBlitControl() Unfortunately OpenGL surfaces do not seem to be supported. So one would have to take a slow code path reading the pixel data from an OpenGL surface and writing it into a DirectX9 surface. Ouch. This might not be feasible at high frame rates at all. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] 2.8.3 released!
Hi all -- The OSG v2.8.3 final release has just been tagged. Would it make sense to update the online reference documentation to 2.8.3, considering the API changes to osgAnimation? http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/ Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Trackball manipulator and screen distance with stereo
In my custom camera Manipulator I had to override the getFusionDistanceValue() function to get the desired effect. You can do the same by creating a child class of TrackballManipulator and use this instead. By default it returns _distance, which is the distance from the camera to the trackball center. You may want to return some other value instead to shift the fusion distance towards the observer or away from it. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VS2010
Let me add my findings related to Visual C++ 2010 Release Candidate and compiling OSG I used cmake 2.6.4 to generate a Visual C++ 2008 solution which was converted to a 2010 solution inside the IDE (which took forever!) The build process was flaky, it would randomly report errors during the build. However running the build 3 to 4 times in a row would finally build all sub-targets succesfully. Building the INSTALL project would not copy any binaries to their final location. I had to do this manually. Thinks may run more smoothly when using the latest cmake and targeting Visual C++ 2010 directly, who knows. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Stereoscopic billboarding possible?
Hi, excuse me if this question may be a bit trivial. Is there a way to make things render differently in the two rendering passes for stereo modes? I was thinking about providing two different textures for billboards (taken from slightly different angles) so these get a fake 3D appearance. Think stereoscopic impostors. Can this be done easily with OpenSceneGraph? Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OT: Fast software rendering
All their demos seem to do is to copypaste the same 3D model(s) all over the place. I am not convinced. Unlimited (open) landscapes at large resolutions would also require unlimited memory, which currently also costs unlimited money. Their voxel-like object storage technique doesn't appear to support character animation, so their technique might be suitable for static scenery only. Lots of hype for a (fast) similar-to-voxel based renderer IMHO. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Instanced Rendering Example in OSG
the osgdrawinstanced sample uses OpenGL draw instancing. Refer to this one instead of osgforest. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render to (part of) texture
If you bind the FBO to a texture you should be able to render to this texture. You can then render to a quad that covers only the pixels you need to change. But then of course, you'd have to get the source data from somehwere (possibly another texture). Maybe you can even compute the data on the fly using a fragment shader. I can't really help you concerning how to do this using OSG (all my GPGPU and render to texture code were done in hand crafted OpenGL - even though I was able to integrate all of it in an OSG based application) Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] use of object aggregation impossible?
Hi everybody, I am trying to reducing the overhead of dynmically creating 1 osg::AutoTransforms that have osgText::Text objects as their individual children. Turns out the object creation is too slow and memory intensive. So I've tried to embed 1 osg::AutoTransforms and osgText::Text objects into another object by means of aggregation, as a quick fix to this - rather than refactoring the entire application. osg::AutoTransform m_MovingMobilesTransform[1]; osgText::Text m_MovingMobilesText[1]; Problem is: 1gui\osg_gui.cpp(4836): error C2248: 'osg::AutoTransform::~AutoTransform' : cannot access protected member declared in class 'osg::AutoTransform' 1 C:\Users\Christian Buchner\Documents\Visual Studio 2010\Projects\SON\deps\OSG\include\osg/AutoTransform(99) : see declaration of 'osg::AutoTransform::~AutoTransform' 1 C:\Users\Christian Buchner\Documents\Visual Studio 2010\Projects\SON\deps\OSG\include\osg/AutoTransform(27) : see declaration of 'osg::AutoTransform' Apparently the AutoTransform destructor is declared virtual and protected. Was that done on purpose to prevent object aggregation here? Could I just create a child of osg::AutoTransform (e.g. MyAutoTransform) and declare its destructor public to work around this? Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] use of object aggregation impossible?
Ok, I got this to work on my own and I can now create 1 of these objects by means of aggregation without using any dynamic allocation. They key is to subclass from any osg objects you need and to declare your destructor public. Was there any particular reason most osg object destructors were declared virtual protected in the first place? I get the virtual, but not the protected. /* child class of osg::AutoTransform with a non-protected destructor, so we can do object aggregation. Also we inherit from an osg Geode and osg Text object. */ class MyAutoTransform : public osg::AutoTransform, public osg::Geode, public osgText::Text { public: MyAutoTransform() : osg::AutoTransform(), osg::Geode(), osgText::Text() { // setup child-parent relations osg::Geode::addDrawable( (osgText::Text*) this ); osg::AutoTransform::addChild( (osg::Geode*) this ); // AutoTransform properties setAutoRotateMode(osg::AutoTransform::ROTATE_TO_SCREEN); setAutoScaleToScreen(true); // text properties osgText::Text::setAlignment(osgText::Text::CENTER_BOTTOM); osgText::Text::setDataVariance(osg::Object::DYNAMIC); } // IMPORTANT: this destructor must be public ~MyAutoTransform() { } }; class AggregatingParentClass { /*...*/ public: MyAutoTransform m_lots_of_objects[1]; }; ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] use of object aggregation impossible?
You haven't said anything about why you are setting up your scene graph in this way. Perhaps if you explain what your are trying to achieve with your text labels we'll be able to recommend a sensible way forward. It is set up this way because the implementer only cared about getting his milestone done in time - and did not really think about performance much. And I get to clean up the mess ,) The performance mainly affects application startup, as we switch off most of these AutoTransform/Text objects using an osg::Switch parent object. Thus they are rendered only when needed and should not create a big impact during run time. We should really be using a pool of transform of text object that are shared between the (max.) 1 mobiles we have in our simulation. Usually only a few texts need to appear at the same time - but the implementer created one text per mobile, just in case ;) As for the safety of this aggregation method: The objects are created when the program starts and they are destroyed when the user exits the simulation. No big problem with the reference counting there. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Visual Studio 2010 binaries
Thank you for your response. I noticed your zip archive contains png.h from version 1.2.39 whereas the supplied .lib file is version 1.4.3. This triggers a runtime error in my application (which also uses Qt and other libraries). And them I am still facing issues with the Collada plugin in Debug mode, which currently refuses to load as a DLL. I suspect this is because the boost dependencies were only supplied as binaries in release mode. But with the pointers you provided, I should be able to create debug versions as well. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Visual Studio 2010 binaries
Here is your x86 3rdparty folder enhanced with the following fixes -replaced the png headers -added a debug DLL build of the Collada DOM -(optionally) added boost 1.4.3 headers without boost headers http://www.mediafire.com/file/tmu278o6fej7jpi/3rdParty.7z with boost 1.43 headers http://www.mediafire.com/file/nh37v305e509m83/3rdParty_noboost.7z You're free to integrate any of this into your binary distribution. I will keep it up on mediafire for a while. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to avoid / minimize overdraw of osg::PrimitiveSet::POINTS
What might would work in this case is to create several smaller sub volumes (cubes for example), and tell osg to sort these front to back for rendering. Then you would still see some overdraw within individual sub volumes, but not so much among different sub volumes. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [ANN] MS Kinect - official drivers available
I have two questions regarding the kinect: 1) what is the shortest distance that you can place yourself (or objects) in front of the Kinect and get good readings? 2) is the IR beam safe to the eyes when placing your face in front of the sensor at short distance? I am worried about hurting the retina. I was thinking to place the Kinect on top of the monitor to do some gesture based control of our OSG application, but I'd like to know about its limitations before actually purchasing one. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [ANN] MS Kinect - official drivers available
Definitely nice! But to be really useful, the skeletton should include head position and possibly rotation and the angles of hand and feet. Then the motion could be realistically mapped onto a 3D avatar. I heard news that the resolution of Kinect might be increased to 640x480 by firmware update (some additional compression on the USB link). Then this might be feasible. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Skybox (horizon and ground) in GLSL?
Hi, I managed to load some 20 buildings from a freely available GIS database from the city of Winston-Salem and I render them with OSG. Buildings floating in space look kind of funny though and I need a ground, a horizon and some sky. I do not want to use a flat ground geometry or sky dome - that's too old-fashioned. I was thinking to use a screen aligned quad (coordinates forced to screen dimensions in a vertex shader) and a pixel shader to set ground and sky zbuffer values and to render the ground and sky color. The ground zbuffer values for sure depend on the camera height over ground. And how the horizon is oriented would depend on the camera orientation (view matrix) Unfortunately having little prior experience with GLSL, I think I might need some input from the community how to pull this off. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Skybox (horizon and ground) in GLSL?
In a first step I would actually be okay if the terrain was infinite and flat. It can be extended to do heightfield raycasting later. I have plenty of papers about this topic (e.g. cone step mapping and more advanced methods). The main difficulty for me is how to cast rays from the screen aligned quad into the scene, i.e. finding the right matrices and transformations to do this in the vertex and pixel shaders. Once I have a ray vector per pixel, intersection with a ground plane should be trivial. Christian. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How to get the contents of a QPixmap into an OSG texture?
Hi, here's a very special case of Qt integration for OpenSceneGraph for which I am searching for a solution: We're using Qt to draw into a QPixmap (updating a map of measured radio conditions during a simulation in realtime). We optionally support a 3D display, which is typically a line by line polarized display. Simply opening a Qt window displaying the pixmap produces bad artifacting. When we open a window on the 3D display (on top of the OSG rendered output), it gets torn because every second line is visible only to each eye. So the only chance to display it right, would be to render the map as a HUD in OpenScenegraph so it gets rendered through the stencil buffer so it shows up nicely for both eyes. Now here's the question: How to transfer the contents of the QPixmap into a texture for OpenSceneGraph efficiently? A lot of texture updates using the CPU would likely slow down the entire application - if possible we would like to avoid slow updates and take a faster route. But which one could that be? Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] possible OSG 3.0.0 regression - different handling of transparencies in DDS texture loader?
Hi, I've just tested our app against OSG 3.0.0, mostly because it has some rudimentary Multitouch support which I hope to extend on. During the upgrade we only stumbled across a renamed header file (MatrixManipulator to CameraManipulator). No big deal - some extra preprocessor macros in the code fixed that. My application features some hundred or thousand walking persons (implemented as animated billboards) that read their texture data from a DDS file. It seems handling of transparencies has changed though. Where previously the billboards had a transparent background, the walking persons now appear in inside solid black squares. So the entire billboard is opaque. Would anyone know if there was a breaking change in the DDS plug-in between OSG 2.8.2 and 3.0.0 regarding transparency handling? Before I start digging into documentation, maybe someone here knows. With kind regards, Christian Buchner ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] any plans to update the online OSG Doxygen from 2.8.0 to 3.0.0?
Right now this link displays the 2.8.0 classes and APIs. http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/index.html With 3.0.x now being the current release branch, let me ask if anyone feels responsible for making the online Doxygen reference documentation up to date? ;) Thank you, Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OSG 3.0.0 appearance of osg::Box changed when rendered in Wireframe mode?
Hi, with OSG 2.8.2 we were able to create a cube like this and set polygon mode to LINE. And it would show up as the outline of a box with no diagonals in the faces. With OSG 3.0.0 the same code produces a box that now contains diagonal lines, as if the quads are now actually tesselated into triangles. Is there any compatibility flag that would allow us to get the old behavior back? Code snippets follow: static osg::Geode* createCube(float fRadius,osg::Vec3 vPosition, osg::Vec4 color) { // create a cube shape osg::Box *bCube = new osg::Box(vPosition,fRadius); // create a container that makes the cube drawable osg::ShapeDrawable *sdCube = new osg::ShapeDrawable(bCube); sdCube-setColor(color); // create a geode object to as a container for our drawable cube object osg::Geode* geodeCube = new osg::Geode(); // add our drawable cube to the geode container geodeCube-addDrawable(sdCube); return(geodeCube); } if (m_wireframeCube == NULL) m_wireframeCube = createCube(1.0, osg::Vec3(0.0, 0.0, 0.5), osg::Vec4(0.5f, 0.5f, 0.5f, 1.0f)); // // Wireframe box // osg::StateSet *state2 = new osg::StateSet(); state2-setMode( GL_LIGHTING, osg::StateAttribute::PROTECTED | osg::StateAttribute::OFF ); m_transform2 = new osg::MatrixTransform; m_transform2-setMatrix(osg::Matrix::scale(m_width, m_width, m_height) * osg::Matrix::translate(position)); osg::PolygonMode *polyModeObj; if ( !(polyModeObj = dynamic_cast osg::PolygonMode* ( state2-getAttribute( osg::StateAttribute::POLYGONMODE ))) ) { state2-setAttribute( new osg::PolygonMode( osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE )); } else polyModeObj-setMode( osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE ); osg::LineWidth *lineWidthObj; if ( !(lineWidthObj = dynamic_cast osg::LineWidth* ( state2-getAttribute( osg::StateAttribute::LINEWIDTH ))) ) { state2-setAttribute( new osg::LineWidth( 2.0f ) ); } else lineWidthObj-setWidth( 2.0f ); m_transform2-addChild(m_wireframeCube); m_transform2-setStateSet(state2); addChild(m_transform2); ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG 3.0.0 appearance of osg::Box changed when rendered in Wireframe mode?
Hi all, I solved this by rolling my own geometry and dropping the use of osg::Box. This function replaces the createCube function from the previously posted code snippet. I simply define my own color, vertex and normal buffer using Quad primitives. Now the wireframe looks sane again. static osg::Geode* createCube(float fRadius, osg::Vec3 vPosition, osg::Vec4 color) { osg::Geode* geode = new osg::Geode(); osg::Geometry* cubeGeom = new osg::Geometry(); osg::Vec4Array *colors = new osg::Vec4Array; colors-push_back(color); // define normals for each face osg::ref_ptrosg::Vec3Array cube_normals = new osg::Vec3Array; cube_normals-push_back(osg::Vec3( 0.0f,-1.0f, 0.0f)); cube_normals-push_back(osg::Vec3( 0.0f,-1.0f, 0.0f)); cube_normals-push_back(osg::Vec3( 0.0f,-1.0f, 0.0f)); cube_normals-push_back(osg::Vec3( 0.0f,-1.0f, 0.0f)); cube_normals-push_back(osg::Vec3( 0.0f,+1.0f, 0.0f)); cube_normals-push_back(osg::Vec3( 0.0f,+1.0f, 0.0f)); cube_normals-push_back(osg::Vec3( 0.0f,+1.0f, 0.0f)); cube_normals-push_back(osg::Vec3( 0.0f,+1.0f, 0.0f)); cube_normals-push_back(osg::Vec3(+1.0f,+0.0f, 0.0f)); cube_normals-push_back(osg::Vec3(+1.0f,+0.0f, 0.0f)); cube_normals-push_back(osg::Vec3(+1.0f,+0.0f, 0.0f)); cube_normals-push_back(osg::Vec3(+1.0f,+0.0f, 0.0f)); cube_normals-push_back(osg::Vec3(-1.0f,+0.0f, 0.0f)); cube_normals-push_back(osg::Vec3(-1.0f,+0.0f, 0.0f)); cube_normals-push_back(osg::Vec3(-1.0f,+0.0f, 0.0f)); cube_normals-push_back(osg::Vec3(-1.0f,+0.0f, 0.0f)); cube_normals-push_back(osg::Vec3( 0.0f,+0.0f,-1.0f)); cube_normals-push_back(osg::Vec3( 0.0f,+0.0f,-1.0f)); cube_normals-push_back(osg::Vec3( 0.0f,+0.0f,-1.0f)); cube_normals-push_back(osg::Vec3( 0.0f,+0.0f,-1.0f)); cube_normals-push_back(osg::Vec3( 0.0f,+0.0f,+1.0f)); cube_normals-push_back(osg::Vec3( 0.0f,+0.0f,+1.0f)); cube_normals-push_back(osg::Vec3( 0.0f,+0.0f,+1.0f)); cube_normals-push_back(osg::Vec3( 0.0f,+0.0f,+1.0f)); vPosition += osg::Vec3(+fRadius/2, +fRadius/2, +fRadius/2); // note, counterclockwise winding order with respect to normals osg::Vec3 myCoords[] = { // bottom face osg::Vec3(-fRadius, -fRadius, -fRadius) + vPosition, osg::Vec3(+fRadius, -fRadius, -fRadius) + vPosition, osg::Vec3(+fRadius, -fRadius, +fRadius) + vPosition, osg::Vec3(-fRadius, -fRadius, +fRadius) + vPosition, // top face osg::Vec3(-fRadius, +fRadius, +fRadius) + vPosition, osg::Vec3(+fRadius, +fRadius, +fRadius) + vPosition, osg::Vec3(+fRadius, +fRadius, -fRadius) + vPosition, osg::Vec3(-fRadius, +fRadius, -fRadius) + vPosition, // right face osg::Vec3(+fRadius, -fRadius, -fRadius) + vPosition, osg::Vec3(+fRadius, +fRadius, -fRadius) + vPosition, osg::Vec3(+fRadius, +fRadius, +fRadius) + vPosition, osg::Vec3(+fRadius, -fRadius, +fRadius) + vPosition, // left face osg::Vec3(-fRadius, -fRadius, +fRadius) + vPosition, osg::Vec3(-fRadius, +fRadius, +fRadius) + vPosition, osg::Vec3(-fRadius, +fRadius, -fRadius) + vPosition, osg::Vec3(-fRadius, -fRadius, -fRadius) + vPosition, // front face osg::Vec3(-fRadius, +fRadius, -fRadius) + vPosition, osg::Vec3(+fRadius, +fRadius, -fRadius) + vPosition, osg::Vec3(+fRadius, -fRadius, -fRadius) + vPosition, osg::Vec3(-fRadius, -fRadius, -fRadius) + vPosition, // back face osg::Vec3(-fRadius, -fRadius, +fRadius) + vPosition, osg::Vec3(+fRadius, -fRadius, +fRadius) + vPosition, osg::Vec3(+fRadius, +fRadius, +fRadius) + vPosition, osg::Vec3(-fRadius, +fRadius, +fRadius) + vPosition }; int numCoords = sizeof(myCoords)/sizeof(osg::Vec3); osg::Vec3Array* vertices = new osg::Vec3Array(numCoords,myCoords); cubeGeom-setVertexArray(vertices); cubeGeom-addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,numCoords)); cubeGeom-setColorArray(colors); cubeGeom-setColorBinding(osg::Geometry::BIND_OVERALL); cubeGeom-setNormalArray(cube_normals.get()); cubeGeom-setNormalBinding(osg::Geometry::BIND_PER_VERTEX); geode-addDrawable(cubeGeom); return geode; } ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Collada models, texture resolution and texture mipmaps?
Hi all, thanks to all contributors for the great OpenSceneGraph 3.0.1! we are currently loading a couple of detailed Collada files into a city scenery which displays a mobile radio network in operation. These collada files often have textures that wildly vary in resolution and size. Some of them are taken from Google's 3D warehouse and were made by different artists. Is there a way to tell the DAE plugin to downscale particularly large textures, so that we can limit the amount of graphics memory that these objects consume? Overall we want to have something like 30 detailed buildings in our city scene, and if OSG keeps all textures on the GPU all times we will be running out of memory quickly. We cannot simply enforce a low texture size limit globally for the entire application, as our own GPGPU radio propagation calculations require some high res textures in the order of 2048 pixels squared. Another thought: Does OSG automatically generate mipmaps for textures in Collada files? My thinking is that when a building is not anywhere close to the camera, its low resolution mip maps may be used and the highest resolution mip levels can be paged out of the graphics chip. I have no idea if this is a standard feature of modern OpenGL drivers or not, but it would certainly ease the memory pressure quite a bit. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OSG samples wanted 1) minimal GLSL sample, 2) dynamically render to cube map, use for reflection
Hi everyone. I am currently looking for a couple of OSG samples. Maybe someone can offer a pointer or link to some existing code demonstrating the techniques. 1) one minimal code sample demonstrating the use of GLSL for vertex and fragment processing (e.g. render a triangle). This is because I would like to begin learning GLSL (so far I've done only ARB shaders) and base this on really simple code. The osgShaders sample is anything but minimal. 2) a sample demonstrating how to render the surroundings of an object into a cube map and to use that cube map to render reflections on the object. The cube map should not be static, but rather be updated dynamically (other objects, even animated ones would correctly show up in it). This is because I would like to display specific objects in a 3D scene which do require a bit of reflection and refraction to look believable (think of a glass filled with Whisky). I am not looking for raytracing quality. Is it even possible to design single OSG nodes (drawables) which add the required additional camera into the scene graph and manage the cube map rendering all by themselves? It would be very nice if this sort of feature encapsulation is possible. Because it allows that complex reflecting or refracting objects could be provided as a single OSG node without requiring much code changes to the existing main program. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG samples wanted 1) minimal GLSL sample, 2) dynamically render to cube map, use for reflection
Thanks I will look into osgreflect. regarding osgShader, I think it is a bit too crowded to be used for starters. A lot of OpenGL ES books start with minimal samples that just render a triangle with shaders. Essentially I am looking for an OSG based equivalent. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG samples wanted 1) minimal GLSL sample, 2) dynamically render to cube map, use for reflection
Use of glsl in osg is pretty straitforward. Thanks for the hints so far. I condensed osgshaders into this short piece of code. It is self contained and nearly minimal, apart from -animating the Uniform variable for show effect -shaders doing a little more than the necessary minimum (lighting, animation, procedural texture) -relying on osg::Box, osg::ShapeDrawable for geometry (some user defined geometry with custom vertex attributes would be nice) This code sample seems less confusing for GLSL newbies like myself, when compared to the full osgshaders demo. Next I will go shopping in the osgreflect demo, as suggested by Robert Osfield. The goal would be to implement some reflecting and refracting object as a single osg Node, which fits into any scene graph with minimal fuss. /// // in-line GLSL source code static const char *blockyVertSource = { // blocky.vert - an GLSL vertex shader with animation\n uniform float Sine;\n const vec3 LightPosition = vec3(0.0, 0.0, 4.0);\n const float BlockScale = 0.30;\n // varyings are written by vert shader, interpolated, and read by frag shader.\n varying float LightIntensity;\n varying vec2 BlockPosition;\n void main(void)\n {\n // per-vertex diffuse lighting\n vec4 ecPosition= gl_ModelViewMatrix * gl_Vertex;\n vec3 tnorm = normalize(gl_NormalMatrix * gl_Normal);\n vec3 lightVec = normalize(LightPosition - vec3 (ecPosition));\n LightIntensity = max(dot(lightVec, tnorm), 0.0);\n // blocks will be determined by fragment's position on the XZ plane.\n BlockPosition = gl_Vertex.xz / BlockScale;\n // scale the geometry based on an animation variable.\n vec4 vertex= gl_Vertex;\n vertex.w = 1.0 + 0.4 * (Sine + 1.0);\n gl_Position= gl_ModelViewProjectionMatrix * vertex;\n }\n }; static const char *blockyFragSource = { // blocky.frag - an GLSL fragment shader with animation\n uniform float Sine;\n const vec3 Color1 = vec3(1.0, 1.0, 1.0);\n const vec3 Color2 = vec3(0.0, 0.0, 0.0);\n // varyings are written by vert shader, interpolated, and read by frag shader.\n varying vec2 BlockPosition;\n varying float LightIntensity;\n void main(void)\n {\n vec3 color;\n float ss, tt, w, h;\n ss = BlockPosition.x;\n tt = BlockPosition.y;\n if (fract(tt * 0.5) 0.5)\n ss += 0.5;\n ss = fract(ss);\n tt = fract(tt);\n // animate the proportion of block to mortar\n float blockFract = (Sine + 1.1) * 0.4;\n w = step(ss, blockFract);\n h = step(tt, blockFract);\n color = mix(Color2, Color1, w * h) * LightIntensity;\n gl_FragColor = vec4 (color, 1.0);\n }\n }; /// // callback for animating various Uniforms (currently only the SIN uniform) class AnimateCallback: public osg::Uniform::Callback { public: enum Operation { SIN }; AnimateCallback(Operation op) : _operation(op) {} virtual void operator() ( osg::Uniform* uniform, osg::NodeVisitor* nv ) { float angle = 2.0 * nv-getFrameStamp()-getSimulationTime(); float sine = sinf( angle );// -1 - 1 switch(_operation) { case SIN : uniform-set( sine ); break; } } private: Operation _operation; }; int main(int, char **) { // construct the viewer. osgViewer::Viewer viewer; // use a geode with a Box ShapeDrawable osg::Geode* basicModel = new osg::Geode(); basicModel-addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(0.0f,0.0f,0.0f),1.0f))); // create the blocky shader, a simple animation test osg::StateSet *ss = basicModel-getOrCreateStateSet(); osg::Program* program = new osg::Program; program-setName( blocky ); program-addShader( new osg::Shader( osg::Shader::VERTEX, blockyVertSource ) ); program-addShader( new osg::Shader( osg::Shader::FRAGMENT, blockyFragSource ) ); ss-setAttributeAndModes(program, osg::StateAttribute::ON); // attach some animated Uniform variable to the state set osg::Uniform* SineUniform = new osg::Uniform( Sine, 0.0f ); ss-addUniform( SineUniform ); SineUniform-setUpdateCallback(new AnimateCallback(AnimateCallback::SIN)); // run the osg::Viewer using our model viewer.setSceneData( basicModel ); return viewer.run(); } /*EOF*/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG samples wanted 1) minimal GLSL sample, 2) dynamically render to cube map, use for reflection
It is problematic to make dynamic reflect\refract rendering with a single node, because you need rtt cameras with scene surronding your object. My approach would have been node masks to remove rendering unwanted objects from the main graph. I'll think about it more. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to make OSG support very large Pixels images(For Map Texture)?
Either with a sharp digital knife, or an image processing tool of your choice (imagemagick if you like the command line, MS Paint if you like Microsoft). Don't you have the option to simply rescale it to 4096x4096 pixels? That would be much less of a hassle. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Fail to install due to osg80-osgDBd.dll is missing
Hi Kevin, You should not try to install a debug build in the first place, as it will depend on the Visual C++ debug runtime, which isn't legally redistributable. Furthermore you'd have to ship a debug build of OSG too, which is bigger and bulkier and runs much slower. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to add a shadow technique to an existing application?
I've been testing integrating the silver lining clouds and sky SDK into our application. The light source (position and color) is dynamically updated by silver lining, and it would be nice to have matching shadows. The application display part of a city skyline (about 2km by 2km). The ground and water surfaces are using shaders, anything else is using the fixed function pipeline. Most buildings are simply geometry without textures (just vertically extruded ground shapes), but some iconic buildings in the skyline is represented as detailed 3D models (originally Collada format, but converted to .ive using osgconv) Now I wonder how I could start adding a shadow technique to this application. What shadow technique is best suited for a geometry of limited size where the camera can be freely moved about? I guess all my geometries that use shaders will have to sample from a shadow map. Is there any osg example that I could use as a reference (using shaders)? What else should I consider when integrating an existing osg shadow technique into an existing application? Maybe someone who has also gone through these steps could offer a little guidance. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Sharing some screenshots of my present work :-)
Hi, Congratulations, this is looking really good! I am also building a city model, but on a much smaller scale - it is used in a radio simulation of 4G networks. I have recently added Silver Lining for sky and clouds, shadow mapping (the very basic algorithm), some water and reflections of buildings in the water. The speciality in my implementation is the rapid passage of time, which is accelerated by a factor of 500. People will turn the lights on in the evening and early morning, and off at night time. I learned a lot of techniques from your book, so keep writing them ;) Christian 2012/11/14 Wang Rui wangra...@gmail.com Hi all, I'd love to share some snapshots of my present work, which lasts for half a months and depends heavily on a modified version of osgShadow and the OSG effect compositor in developing. The scene is from part of a CBD area in Beijing, and it will be shown on a wall with four projectors at last. I use VDSM with additional PSSM support and customized shaders to provide real-time illumination and shadowing. And the compositor which is currently maintained in osgRecipes is used to add glow effect and final color grading. SilverLining SDK is used for sky and cloud rendering. The scene includes only a few refined building models, but with OSG's dynamic paging ability we can easily support very large city with nearly the same rendering quality. I will be glad to submit both the shadow and compositor functionality to OSG core at the end of this year, or at the beginning of next year (as Robert is busy at present :-) and hope it could be improved again and again and also help other develop their applications. Current city models may not be suitable for open source use so I may have to find and commit a copyleft set of models along with the coming submissions. It would be appreciated if somebody could provide me some at that time. Cheers, Wang Rui [image: 内嵌图片 6] [image: 内嵌图片 1] [image: 内嵌图片 2] [image: 内嵌图片 3] [image: 内嵌图片 4] [image: 内嵌图片 5] ___ 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] Sharing some screenshots of my present work :-)
A snapshot of my version of Chicago at dawn. You might ask yourself what that cruise ship is doing there. http://img839.imageshack.us/img839/9950/chicagodawn.jpg Only a few detailed 3D models are in the city (imported from Collada format), the other buildings are vertically extruded ground shapes. The ground looks so strange because it displays radio coverage by radio cell. Christian 2012/11/14 Christian Buchner christian.buch...@gmail.com Hi, Congratulations, this is looking really good! I am also building a city model, but on a much smaller scale - it is used in a radio simulation of 4G networks. I have recently added Silver Lining for sky and clouds, shadow mapping (the very basic algorithm), some water and reflections of buildings in the water. The speciality in my implementation is the rapid passage of time, which is accelerated by a factor of 500. People will turn the lights on in the evening and early morning, and off at night time. I learned a lot of techniques from your book, so keep writing them ;) Christian 2012/11/14 Wang Rui wangra...@gmail.com Hi all, I'd love to share some snapshots of my present work, which lasts for half a months and depends heavily on a modified version of osgShadow and the OSG effect compositor in developing. The scene is from part of a CBD area in Beijing, and it will be shown on a wall with four projectors at last. I use VDSM with additional PSSM support and customized shaders to provide real-time illumination and shadowing. And the compositor which is currently maintained in osgRecipes is used to add glow effect and final color grading. SilverLining SDK is used for sky and cloud rendering. The scene includes only a few refined building models, but with OSG's dynamic paging ability we can easily support very large city with nearly the same rendering quality. I will be glad to submit both the shadow and compositor functionality to OSG core at the end of this year, or at the beginning of next year (as Robert is busy at present :-) and hope it could be improved again and again and also help other develop their applications. Current city models may not be suitable for open source use so I may have to find and commit a copyleft set of models along with the coming submissions. It would be appreciated if somebody could provide me some at that time. Cheers, Wang Rui [image: 内嵌图片 6] [image: 内嵌图片 1] [image: 内嵌图片 2] [image: 内嵌图片 3] [image: 内嵌图片 4] [image: 内嵌图片 5] ___ 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] Positioning the camera
You're trying to set the view matrix on the camera which may get overwritten by the camera manipulator at the beginning of each frame. Instead, check your camera manipulator (e.g. TrackballManipulator) if it has a member function that accepts a view matrix. Some camera manipulators (like the Terrain manipilator) keep a center position, a distance and an Euler angle with respect to the center. Setting these values might work, while setting the view matrix directly may not work. Also in the beginning the camera manipulators compute a default home position and use it. Make sure you apply your own view matrix at a later point in time. Christian 2012/11/15 michael kapelko korn...@gmail.com Hi. I have default viewer without any special manipulator specified. I try to setViewMatrix for camera to position it, but it doesn't work. Code: http://pastie.org/5382807 It needs to be run from Data directory. Am I doing it wrong? ___ 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] questions on simple skeletal animation for crowd simulation
Are you sure your agents need to be full 3D models? I've done something using perspective billboards, in the osgrvo2 sample in the osgRecipes repository maintained by Wang Rui. The billboards were rendered in Poser using a python script that rendered it out from many viewing angles. The GPU can easily render 1 agents with different walking speeds at interactive frame rates. The bottleneck is the agent simulation on the CPU. ;) 2012/11/17 Bruno Fanini phoeni...@gmail.com Hello osgUsers, Within a osg-based crowd simulator I'm currently developing, I was trying to investigate a simple skeletal animation for a given set of agents. I'm digging the animtkviewer.cpp example (osganimationviewer) and it looks like a good solution for this case. In this context, I would just need a plain simple walking animation for my characters. I've a set of PositionAttitudeTransforms nodes to control position attitude of a single agent, so my questions are: - is it possible to control the independent speed of the walking animation for a single agent? (i.e. another agent is walking faster, etc..) - what about instancing 3d models? is it still possible with this approach somehow? (i.e. every p.a.t pointing to the same 3d model) - what about the performance drop (estimate)? - is there any example out there applied to crowd simulations or similar? Thanks, -- Bruno Fanini http://BrunoFanini.co.nr http://DevHelio.co.nr (Software Development) http://www.facebook.com/DigitalDivadlohttp://www.facebook.com/digitaldivadlo (Digital Art) ___ 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] Triangle colored from both sides?
Have you played with osg::LightModel state attribute yet? Maybe enabling/disabling two sided lighting makes a difference. // Enable two sided lighting osg::LightModel* lightModel = new osg::LightModel; lightModel-setTwoSided(true); stateSet-setAttributeAndModes(lightModel, osg::StateAttribute::ON); 2012/11/21 Matthias Sattler osgfo...@tevs.eu Hi, I'ld like to have the triangles in the code below drawn colored on both sides. As the normals are pointing towards the triangles one side gets painted black, even though osg::Material::FRONT_AND_BACK is specified. Do you have an idea how I can achieve this? Thank you! Cheers, Matthias // Forum problem. Add in the include lines. #include osg/Geode #include osg/Geometry #include osg/Material #include osg/Vec3 #include osgViewer/Viewer osg::Node* createScene() { osg::Geode* geode = new osg::Geode(); osg::ref_ptrosg::Vec3Array shared_normals = new osg::Vec3Array; shared_normals-push_back(osg::Vec3(0.0f,-1.0f,0.0f)); { osg::Geometry* polyGeom = new osg::Geometry(); osg::Vec3 myCoords[] = { // note in anticlockwise order. osg::Vec3(-1.12056, -2.15188e-09, -0.840418), osg::Vec3(-0.95165, -2.15188e-09, -0.840418), osg::Vec3(-1.11644, 9.18133e-09, -0.716827), // note in anticlockwise order. osg::Vec3(-0.840418, 9.18133e-09, -0.778623), osg::Vec3(-0.622074, 9.18133e-09, -0.613835), osg::Vec3(-1.067, 9.18133e-09, -0.609715), }; int numCoords = sizeof(myCoords)/sizeof(osg::Vec3); osg::Vec3Array* vertices = new osg::Vec3Array(numCoords,myCoords); polyGeom-setVertexArray(vertices); polyGeom-setNormalArray(shared_normals.get()); polyGeom-setNormalBinding(osg::Geometry::BIND_OVERALL); polyGeom-addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES,0,6)); osg::StateSet* stateSet = new osg::StateSet(); osg::Material* material = new osg::Material; material-setColorMode(osg::Material::AMBIENT_AND_DIFFUSE); material-setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4(1.0, 0.0, 0.0, 1)); material-setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4(1.0, 0.0, 0.0, 1)); stateSet-setAttribute(material, osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON); stateSet-setMode(GL_LIGHTING, osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON); stateSet-setMode(GL_CULL_FACE, osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF); polyGeom-setStateSet(stateSet); geode-addDrawable(polyGeom); } return geode; } int main(int, char **) { osg::Group* root = new osg::Group; root-addChild( createScene() ); osgViewer::Viewer viewer; viewer.setSceneData( root ); return viewer.run(); } -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51182#51182 ___ 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] how about high quality transparency in OSG?
There's definitely sample code for depth peeling available (osgdepthpeeling) Sorting of geodes by distance is also implemented as a render bin feature - but sorting at geode level may be a bit too coarse. Transparency has been an issue in many forum/mailing list topics - because it's hard and non-trivial. Maybe try searching for those threads. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Depthmap from light's point of view
if you look at the implementation of osgShadow, in particular the osg::ShadowMap class you will see how to render the scene from the light's point of view for the purpose of creating a depth map. The depth map is then later used when rendering the main view, for superimposing a shadow. Warning: the default behavior turns on backface culling and only enables the back faces for rendering. This may not be what you want - but it's easy enough to change. 2012/12/12 Peterakos hay...@gmail.com Hello. Lets say there is cessna as a child in LightSource group. LightSource has 1 light. What i want to do is to get the depth map from light's point of view. How can i do this ? I am thinking of placing a Camera as a child in LightSource. This camera will look at exactly the same direction as the light and will also has the same position. Is this the right way to do it ? ( I know how to make camera render to texture) Thank you for your time. ___ 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] Model Matrix in Vertex Shader
Is there one definitive list that explains all the built-in osg uniforms? This one would have come handy earlier, but I did not know about it. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Drawing only a specific bin (e.g., the Transparent render bin)..
You could use an individual bit in the node mask of each geode or drawable added to a specific render bin. Then you can turn on and off bins by setting the appropriate bitpattern in the camera's mask. Caveat: This only supports up to 32 individual bins and may clash with other code already using node masks ;) Christian 2013/1/12 Frank Sullivan knarf.navil...@gmail.com Hi, I was just wondering if there is any way to draw only a specific bin, either by telling the cull visitor to throw away objects that belong in the other bins, or by somehow influencing the draw process after the cull pass? What I have in mind is deferred lighting, where one often wants to draw only the opaque objects to the g-buffer, and then draw the transparent objects after the lighting pass. Thank you! Cheers, Frank -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51932#51932 ___ 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] Integration of a NodeKit for Sky Rendering
This nodekit is a godsend! And the license seems pretty permissive, too. Christian 2013/1/18 Limberger, Daniel daniel.limber...@hpi.uni-potsdam.de ** ** ** ** *From:* Limberger, Daniel *Sent:* 18 January 2013 15:50 *To:* Engel, Juri *Subject:* Integration of a NodeKit for Sky Rendering into OSG ** ** Hi, ** ** I would like to present you my open source library osgHimmel that allows simple noninvasive rendering of background imagery (i.e., skies) within OSG. It currently is an OSG extending lib, that features two different techniques for sky rendering (or in traditional terms, skybox rendering): texture based (traditional) and computational (astrophysical). ** ** The first approach handles rendering of skies via common texture mapping techniques, extended by time based transitions, rotation around the zenith, horizon blending as well as an (experimental) faked sun. ** ** The second approach, renders astrophysical based skies with good results not only but especially at nightly scenes: correct star positions, atmosphere approximation, moon rendering including lunar eclipses and more. ** ** Further Contributions to OSG: **- **A useful, minimal astronomy library. **- **Good resources for both, texture based and physical based, approaches. **- **Solutions for common OSG issues, e.g., placing skies in arbitrary node structures, texture ping-ponging for post/pre processing, environment map rendering for reflection/illumination. **- **Starting point for cloud rendering. The current implementation is not very efficient though (TODO..) **- **Introduces no third parties, purely based on OSG (and optionally Qt for the editor)! ** ** For now, osgHimmel is mainly used internally at the Computer Graphics Systems group at the HPI (hpi3d.de), and the first integration into a commercial product is already in progress. We have two research projects, trying to extend the library by HDR, temporal-glare, Glare, simple as well as image based illumination. ** ** I would like to suggest an integration of osgHimmel into OSG, since a larger user base would convince me to keep osgHimmel alive and spent further development time on the library. What requirements must be met and what further steps have to be taken to make this integration possible (we can rename the lib to osgSky if this is a problem ;) )? Or is it better practice for such library to stay independent, without a direct OSG integration? ** ** I’m strongly interested in any ideas and concerns of this community concerning osgHimmel. ** ** ** ** All resources (including videos, demos, poster, my master’s thesis, and a recent vmv2012 paper) are available at: http://osghimmel.googlecode.com ** ** recent poster with some images: https://osghimmel.googlecode.com/files/Daniel_Limberger_Poster.pdf ** ** Thanks a lot! And also thanks to this mailing list, which was of great help during development of osghimmel. ___ 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] how about high quality transparency in OSG?
Check out the osgdepthpeeling code sample for one (somewhat slow) implementation of depth peeling. We don't have automatic triangle sorting, but we do have sorting of drawables and geodes in the DepthSortedBin render bins. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgdepthpeeling or osgoit
does osgoit require the loaded 3D model to be transparent already? I remember that I was able to run osgdepthpeeling with the dumptruck model successfully, but with the osgoit sample I can't get this to render any transparency at all. 2013/2/17 Mathias Fröhlich mathias.froehl...@gmx.net Hi List, On Sunday, February 17, 2013 08:20:55 Sajjadul Islam wrote: are both the same is theory ? What are the differences between them implementation-wise ? osgoit concentrates on the order independent transparency and does this with a minimal requirement on the state of the displayed model. Also it uses a minimal set of OpenGL features/extensions to make this run on as much hardware/drivers as possible. Greetings Mathias ___ 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] osgdepthpeeling or osgoit
For the record, with a little editing one can make any OSG object transparent Here's a modified state set that makes the dump truck work with the osgoit demo. I added blending, moved everything to TRANSPARENT_BIN and changed the alpha settings in the material. And then it works as expected in the osgoit viewer. StateSet { UniqueID StateSet_1 DataVariance STATIC rendering_hint TRANSPARENT_BIN renderBinMode INHERIT GL_CULL_FACE OFF GL_LIGHTING ON GL_BLEND ON BlendFunc { DataVariance STATIC source SRC_ALPHA destination ONE } Material { DataVariance STATIC ColorMode OFF ambientColor 0.2 0.2 0.2 0.4 diffuseColor 0.8 0.8 0.8 0.4 specularColor 0 0 0 0.4 emissionColor 0 0 0 0.4 shininess 0 } } I would find the osgoit demo more useful if it had a command line switch to override the material settings and blend function of the loaded model, so one can run this with the vast majority of existing OSG models from the default data directory. I will now try to understand the osgoit code and then try to roll my own implementation of either the dual depth peeling code, or the weighted average method from the nVidia paper. The reason is that I will have to show some transparent buildings in our radio simulator and once we start adding some interior walls to the geometry, things become too complicated for the simpler algorithms. Depth peeling seems to be the way to go for us. Thank you for providing the osgoit demo! 2013/2/19 Mathias Fröhlich mathias.froehl...@gmx.net Hi, On Monday, February 18, 2013 15:56:02 Christian Buchner wrote: does osgoit require the loaded 3D model to be transparent already? What do you mean? If parts of your model are not transparent they should not render transparent? Right? I remember that I was able to run osgdepthpeeling with the dumptruck model successfully, but with the osgoit sample I can't get this to render any transparency at all. It did for me the other way round. I never saw something sensible with osgdepthpeeling. But loading a model with transparent triangles renders fine with osgoit. At least the ones that I usually tried. Only if your model contains protected state attributes that need to be overwritten this can hurt. Especially the blend mode need to be overruled by the viewer code. For the zurich paper, I also read that. IIRC the loaded model needs to have all the state replaced by the viewer codes for multiple render targets which makes all the colors and textures and whatnot just disappear or requires a lot work to translate that. That simpler algorithm does not need any cooperation from the model except the blend state must not be protected. So it's about to view a model just like it would look like with osgviewer but with correct(er) transparency. Greetings Mathias ___ 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] Ideas for shiny antique Gold?
Maybe you can find existing GLSL metal effects and accompanying artwork in tools such as ATI RenderMonkey or nVidia's FX composer or Shader Designer. http://www.opengl.org/sdk/tools/ShaderDesigner/ Just watch out for the license of whatever code and art snippets you choose. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgdepthpeeling or osgoit
After some futile attempts to make the nVidia dual depth peeling compatible with non-Vidia cards by dropping the vendor specific extensions I've decided to go forward with the DepthPeeling code from osgoit. I noticed that as soon as there are GLSL shaders attached to the object being rendered, the shadow depth testing seems to fail (is this fixed function stuff?). Or in other words, these statements don't have an effect anymore. _depthTextures[i]-setShadowComparison(true); _depthTextures[i]-setShadowAmbient(0); // The r value if the test fails _depthTextures[i]-setShadowCompareFunc(osg::Texture::GREATER); _depthTextures[i]-setShadowTextureMode(osg::Texture::INTENSITY); It seems that I will have to roll my own shadow comparison in GLSL. This would be in the fragment shader, I presume? 2013/2/19 Christian Buchner christian.buch...@gmail.com For the record, with a little editing one can make any OSG object transparent Here's a modified state set that makes the dump truck work with the osgoit demo. I added blending, moved everything to TRANSPARENT_BIN and changed the alpha settings in the material. And then it works as expected in the osgoit viewer. StateSet { UniqueID StateSet_1 DataVariance STATIC rendering_hint TRANSPARENT_BIN renderBinMode INHERIT GL_CULL_FACE OFF GL_LIGHTING ON GL_BLEND ON BlendFunc { DataVariance STATIC source SRC_ALPHA destination ONE } Material { DataVariance STATIC ColorMode OFF ambientColor 0.2 0.2 0.2 0.4 diffuseColor 0.8 0.8 0.8 0.4 specularColor 0 0 0 0.4 emissionColor 0 0 0 0.4 shininess 0 } } I would find the osgoit demo more useful if it had a command line switch to override the material settings and blend function of the loaded model, so one can run this with the vast majority of existing OSG models from the default data directory. I will now try to understand the osgoit code and then try to roll my own implementation of either the dual depth peeling code, or the weighted average method from the nVidia paper. The reason is that I will have to show some transparent buildings in our radio simulator and once we start adding some interior walls to the geometry, things become too complicated for the simpler algorithms. Depth peeling seems to be the way to go for us. Thank you for providing the osgoit demo! 2013/2/19 Mathias Fröhlich mathias.froehl...@gmx.net Hi, On Monday, February 18, 2013 15:56:02 Christian Buchner wrote: does osgoit require the loaded 3D model to be transparent already? What do you mean? If parts of your model are not transparent they should not render transparent? Right? I remember that I was able to run osgdepthpeeling with the dumptruck model successfully, but with the osgoit sample I can't get this to render any transparency at all. It did for me the other way round. I never saw something sensible with osgdepthpeeling. But loading a model with transparent triangles renders fine with osgoit. At least the ones that I usually tried. Only if your model contains protected state attributes that need to be overwritten this can hurt. Especially the blend mode need to be overruled by the viewer code. For the zurich paper, I also read that. IIRC the loaded model needs to have all the state replaced by the viewer codes for multiple render targets which makes all the colors and textures and whatnot just disappear or requires a lot work to translate that. That simpler algorithm does not need any cooperation from the model except the blend state must not be protected. So it's about to view a model just like it would look like with osgviewer but with correct(er) transparency. Greetings Mathias ___ 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] osgdepthpeeling or osgoit
I am currently stuck with OSG 3.0.1 (latest stable release) not being able to provide an osg::Uniform corresponding to the GLSL sampler2DRectShadow. The enum does not yet contain the *SAMPLER_2D_RECT_SHADOW type. ;-(* I would have to switch to a later development release, which is a major undertaking. Alternatively I might have to switch from Texture Rectangles to regular Texture2D objects, fortunately there is a #define for that. Christian 2013/2/20 Mathias Fröhlich mathias.froehl...@gmx.net Hi, On Tuesday, February 19, 2013 19:07:59 Christian Buchner wrote: After some futile attempts to make the nVidia dual depth peeling compatible with non-Vidia cards by dropping the vendor specific extensions I've decided to go forward with the DepthPeeling code from osgoit. I noticed that as soon as there are GLSL shaders attached to the object being rendered, the shadow depth testing seems to fail (is this fixed function stuff?). Or in other words, these statements don't have an effect anymore. _depthTextures[i]-setShadowComparison(true); _depthTextures[i]-setShadowAmbient(0); // The r value if the test fails _depthTextures[i]-setShadowCompareFunc(osg::Texture::GREATER); _depthTextures[i]-setShadowTextureMode(osg::Texture::INTENSITY); It seems that I will have to roll my own shadow comparison in GLSL. This would be in the fragment shader, I presume? Without looking in depth into this and just out of my head. Yes, in the Fragment shader have a shadow sampler unifom bound on that texture and compare for the .r component. Then discard the pixel if that test fails. You need to rescale the projection space fragement position apropriately to the input of the shadow sampler. If I remember right there was also some problem with the demo with models not being close to the origin. I believe something with the near far computation in interaction with osgoit is not entirely correct. Greetings Mathias ___ 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] osgdepthpeeling or osgoit
I am currently finding a problem with the osgoit demo (as found in OSG 3.0.1). The osgviewer by default starts in full screen mode, and never generates an initial RESIZE event. I am testing this on Windows, if that matters. The _texWidth and _texHeight members of the DepthPeeling object remain at their default values of 0. While this seems to generate reasonably sized shadowing maps (why?), this has the unfortunate side effect that the CullCallback never receives an update with the correct texture width and height. When not using texture rectangles and when USE_NON_POWER_OF_TWO_TEXTURE #define is not set, it will execute this line: m.postMultScale(osg::Vec3d(viewport-width()/double(_texWidth), viewport-height()/double(_texHeight), 1)); producing an invalid scaling matrix. So the screen stays blank (no model is rendered at all) when using square Texture2D objects. Feeding an appropriate default value to the DepthPeeling constructor with the screen resolution fixes it. Christian 2013/2/17 Mathias Fröhlich mathias.froehl...@gmx.net Hi List, On Sunday, February 17, 2013 08:20:55 Sajjadul Islam wrote: are both the same is theory ? What are the differences between them implementation-wise ? osgoit concentrates on the order independent transparency and does this with a minimal requirement on the state of the displayed model. Also it uses a minimal set of OpenGL features/extensions to make this run on as much hardware/drivers as possible. Greetings Mathias ___ 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
[osg-users] initializing the depth buffer with another camera's buffer before rendering
Hi, I've been modifying the osgoit code sample to allow opaque objects to occlude the depth peeled layers. I found that rendering the opaque geometry into the depth buffer of each peeled layer causes a lot of overhead because of the extra culling and geometry passes each time. Instead I would like to render my opaque object just once into the first slave camera's depth buffer and copy the contents of its depth buffer into the other slave cameras (or rather FBOs) before performing the depth peeling passes. So instead of clearing the z buffer at the start of each frame, would it be feasible to copy the depth buffer from one FBO into another, and with reasonable performance? Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] initializing the depth buffer with another camera's buffer before rendering
Hmm, im am stuck trying to extract a pointer to an fbo object in the postDrawCallback of my cameras, allowing me to call fbo_ext-glBlitFramebuffer(...) My offscreen render cameras perform their own FBO setup. I am merely passing the hint to use a frame buffer object as render target by calling setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); And the only point in the osg source code where an accessor is provided to an osg::FrameBufferObject seems to be in the RenderStage header file. I haven't yet figured out how to get from an osg.:Camera or an osg::RenderInfo to an actual fbo pointer. *sigh* Christian 2013/2/21 Christian Buchner christian.buch...@gmail.com Hi, I've been modifying the osgoit code sample to allow opaque objects to occlude the depth peeled layers. I found that rendering the opaque geometry into the depth buffer of each peeled layer causes a lot of overhead because of the extra culling and geometry passes each time. Instead I would like to render my opaque object just once into the first slave camera's depth buffer and copy the contents of its depth buffer into the other slave cameras (or rather FBOs) before performing the depth peeling passes. So instead of clearing the z buffer at the start of each frame, would it be feasible to copy the depth buffer from one FBO into another, and with reasonable performance? Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] resthttp plugin build issues
I tried using a more recent boost 1.51 which already includes ASIO. The reason being that there is a Windows installer for Boost that includes Visual Studio 2010 binaries - I did not want to use a really old version of that installer with dependencies compiled against a previous Visual Studio versions (mixing and matching dependencies like that is often problematic) Anyway, I got this plug-in to build and the HOWTO is archived above ;) Christian 2013/2/24 Stephan Huber ratzf...@digitalmind.de Hi, As I developed the resthttp-plugin I sticked to the header-only version of boost and the separate asio-lib to keep it simple to get the plugin compiling on windows and other platforms as using asio from within boost you'll also need to link aainst the boost libs, it doesn't suffice to include only the headers. What problems did you try to fix on your end? cheers, Stephan Am 23.02.13 20:50, schrieb Christian Buchner: Hi, in order to successfully build the resthttp plug-in from OpenSceneGraph trunk I had to modify its CMakeLists.txt file to this: INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR}) LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) INCLUDE_DIRECTORIES(${ASIO_INCLUDE_DIR}) note the change from Boost_INCLUDE_DIRS to Boost_INCLUDE_DIR and the addition of the LINK_DIRECTORIES I also changed all occurences of #include asio.hpp to #include boost/asio.hpp I changed and all occurrences of asio::error_code to system::error_code and asio::thread to boost::thread Now asio builds against later boost releases, such as 1.51 for Windows in my case (installed with boostpro installer) A small quirk in CMake 2.8 remains. It always indicates Boost_DIR as Boost_DIR-NOTFOUND, but correctly sets Boost_INCLUDE_DIR and Boost_LIBRARY_DIRS. This is odd. Are these reasonable changes, or do you plan to stick to requiring the very outdated boost 1.37 release? Christian ___ 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 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgdepthpeeling or osgoit
I've just posted an overhauled version of osgoit to osg-submissions. You may want to have a look. Compositing with solid geometry is now possible, and mix-and-match with GLSL shaders in transparent objects works fine. Tested on nVidia so far. Hopefully that HeatMap GLSL thing also renders on Intel. Christian 2013/2/17 Mathias Fröhlich mathias.froehl...@gmx.net Hi List, On Sunday, February 17, 2013 08:20:55 Sajjadul Islam wrote: are both the same is theory ? What are the differences between them implementation-wise ? osgoit concentrates on the order independent transparency and does this with a minimal requirement on the state of the displayed model. Also it uses a minimal set of OpenGL features/extensions to make this run on as much hardware/drivers as possible. Greetings Mathias ___ 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] Fwd: setting a polygon height
I've done this stuff before for buildings that are vertically extruded from a polygon shape step 1) create an osg::Geometry 2) create a vertex buffer with two copies of the polygon vertices, the second copy having a different z coordinate. use setVertexArray() 3) For proper lighting, create a normal array also with one normal per vertex, matching the indexing in the vertex array. use setNormalArray(). 4) run a tesselation algorithm to to create a list of triangles that will form the top and bottom faces (concave polygons aren't supported in hardware, so tesselation is mandatory) 5) using an index buffer, create triangle primitives for the top and bottom faces based on the tesselation results 6) create a quads primitive for the surfaces on the side, possibly also using index buffers. You can't really use a quad strip here, or the normal vectors for touching quads will be shared, which leads to an (undesired) smooth shading effect for the sides. some very small code snippets // less then 256 vertices can use an UByte based index buffer std::vectorunsigned char indices_c; // omitted here is the tesselation process creating the vertex indices roofGeometry-addPrimitiveSet(new osg::DrawElementsUByte( GL_TRIANGLES, indices_c.size(), indices_c[0] )); // alternatively less then 65536 vertices can use an UShort based index buffer std::vectorunsigned short indices_s; // omitted here is the tesselation process creating the vertex indices roofGeometry-addPrimitiveSet(new osg::DrawElementsUShort( GL_TRIANGLES, indices_s.size(), indices_s[0] )); // I am actually storing my vertices for the quads in a separate Geometry, so I can use DrawArrays instead of an index buffer for the quads making up the sides. Then the vertices for each quad are taken in sequential order from the vertex buffer. sideGeometry-addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,num_vertices_per_polygon_ring); If you need your quad strip on the side to have different color or different vertex attributes, your vertex buffer needs to contain the polygon ring four times. You should look at some osg examples that create their own geometry based on vertex buffers to get the hang of it. Christian 2013/2/26 Robert Osfield robert.osfi...@gmail.com Hi Mohammed, On 26 February 2013 04:19, Mohammed Rashad mohammed.ras...@research.iiit.ac.in wrote: Is it possible to have a 2D square looks like a cube? You can do anything you want with your geometry, but you have to create what you want, the OSG doesn't provide a means of automatically converting a square/polygon to a object with sides and end caps like your photo. What you are asking for is very specific function and is has to be implemented in user code. Once you have you geometry you can animate it using an update callback that updates the vertices on the geometry, or use a shader to do the same. Robert. ___ 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] silverlining integration in OSG. Manually drawing clouds - problem
My problem is that the clouds are supposed to become part of my depth peeling algorithm for achieving proper transparency, and hence I cannot just draw them after everything else ;) I need to draw the clouds without any alpha blending enabled, because the depth peeling will blend the clouds into the final scene afterwards. The blending done by DrawObjects(true) causes the clouds to turn very dark at the edges in my use case. I just asked the Sundog support, because after purchasing the SDK I think there's 3 months of support included. Do you know if they also have a user forum? Christian 2013/2/26 Sebastian Messerschmidt sebastian.messerschm...@gmx.de Hi Christian, If you are referring to drawing the clouds individually: I had exactly the same problem and didn't find a solution apart from rendering the clouds after everything else. (simply using the DrawObjects approach) as I thought I'm simply stupid. But maybe simply drop a line to support@sundog, they really helped a lot with those issues. Also it is worth upgrading from time to time, as they seem to release a new version quite regularly. If you get some answer/solution I'd be interested, too cheers Sebastian Hi, I have the need to draw the silverlining clouds without alpha blending enabled. So I use DrawObjects(false) in order to roll my own cloud drawing. I tried to follow the sample posted here: http://www.sundog-soft.com/docs/html/usage.html Under Here's an example of manually drawing clouds following a call to Atmosphere::DrawObjects(false): this guide contains some OpenGL snippets. But it seems the call to atm-DrawObject(*it) is messing with the OpenGL state so badly, that I don't even see anything on screen any more afterwards. I tried saving and restoring most OpenGL states around this function call but got funny sparkling clouds in bizarre colours. I was just wondering if anyone can offer a working example of an OSG silver lining integration with running DrawObject() for clouds in the drawImplementation of a drawable. Christian ___ osg-users mailing listosg-users@lists.openscenegraph.orghttp://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 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PRE_RENDER ignores depth buffer?
Maybe your pre/post cameras have a clearMask that erases the depth buffer? Just in case it matters: My recent osg-submission myosgoit shows how to copy the depth buffer from one pre/post render camera to another - in case a multi pass algorithm needs to be based on some kind of pre-initialized depth information. All my cameras share one fbo, just the color and depth attachments get swapped out. Christian 2013/3/11 Sergey Polischuk pol...@yandex.ru Hi i've used prerender cameras with depth texture attached without any problems. Cheers. 11.03.2013, 11:24, Daniel Schmid daniel.sch...@swiss-simtec.ch: Hi all I have a NESTED_RENDER camera that 3 RTTs plus a Depth texture. Works fine. Now I added a PRE_RENDER camera rendering part of geometry to a texture and a Depth texture. This works aswell except that the depth texture remains empty/untouched. Is there an issue with PRE_RENDER cameras? Regards Daniel , ___ 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 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Windows: osgscribe.exe built in Visual Studio 2010 raises (false?) virus/trojan alarms
Hi, I am building OpenSceneGraph 3.0.1 on Windows 7 32bit using Visual Studio 2010 Express using dependencies found here: http://members.iinet.net.au/~bchrist/3rdParty_VC10_x86_x64.zip What really is annoying is that some of the compiled examples persistently trigger AntiVirus alerts. We've had this with Avira as well as McAffee - so we either had to whitelist some executables or to uninstall the antivirus solution. I am not sure if this VirusTotal report is accessible to all of you, but it shows 33 out of 45 antivirus engines producing a (false?) positive! osgscribe.exe uploaded to virustotal: https://www.virustotal.com/de/file/3632f40cabfa7fdf322b5a905e61d85d9a8d88e42430f5c7eab1b8a21fae225d/analysis/1363105395/ A few other executables in the examples folder are also affected. Do we possibly have an infection in some of the dependencies, or is this a true false alarm? If so, why would it be registered by so many individual scanning engines? Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [forum] Rendering backface like front face
@cbuchner1 Hmm, well I bet a lot of software relies on that feature... I found threads by the Blender team who had to create workarounds because on some newer Geforce cards (4xx and 5xx series) suddenly the viewport update were orders of magnitude slower. http://blairwillems.com/2012/04/28/blender-improve-viewport-performance-on-geforce-4xx-5xx-cards/ http://projects.blender.org/tracker/index.php?func=detailaid=29724group_id=9atid=498 Also this issue has been mentioned in the nvidia forums: https://devtalk.nvidia.com/default/topic/529615/opengl/two-sided-lighting-on-geforce-cards/ So, ideally you would turn the two sided lighting feature off for anything but the simplest geometries, and perform a two sided lighting in a fragment shader. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [forum] Rendering backface like front face
The front and back material properties were set to same values, it's just that when doing the calculations for the back side, the normal vector is not pointing towards the light source but away from it. I only looked at this issue briefly, and concluded that it would take some GLSL to fix it. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] adding barrel distortion for stereoscopic rendering in Oculus Rift head set
My point is that there is no need to wait for the thing to arrive to actually implement something. The barrel distortion parameters can also be adjusted when the hardware finally arrives ;) Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org