Re: [osg-users] Visualizing a light cone in scene
Basically What you want is the situation where the peak of the cone is at 0,0,0, and the base is at your negative direction pointed towards the ground. You may have to put transform between say the DOF node, and the cone. You might also just forgo the OSG cone, and have a model where the peak of the cone is at 0,0,0. You might end up with a graph that looks something like this: (osg::MatrixTransform) -> (your Aircraft model), (DOF Node) ->(osg::MatrixTransform) ->(your cone). You could just use a Matrix transform, instead of the DOF Node. The DOF node is basically to aim the light. The point of the first matrix transform is to move your aircraft mode + your cone at the same time. Both the DOF and model would be children of the transform, the DOF node is basically there to rotate the light cone, which might be just straight down. You the last Matrix Transform is to setup the cone so it rotates about the point of the cone. You will most likely want to read up Hierarchical Modeling in Computer Graphics. There are lots of examples + lecture notes on the topic. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69983#69983 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Visualizing a light cone in scene
Hi David, Thanks for the tips on my problem. Yes, i am trying to use (at present) light cone to show in my scene what its highlighting. But it fails to show the cone light beam emanating from the aircraft. As u suggested, i tried with transparent cone. But The problem is i am not able to position the cone vertically down the aircraft with the apex of cone touching the aircraft body. This is due to fact that OSG::cone takes height information as (0,0,height). I am not able to pass the x, y components of apex of cone. I Guess, i need to tweak the cone rendering. ... Thank you! Cheers, Suraj -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69974#69974 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Visualizing a light cone in scene
Hi David, Thanks for the tips on my problem. Yes, i am trying to use (at present) light cone to show in my scene what its highlighting. But it fails to show the cone light beam emanating from the aircraft. As u suggested, i tried with transparent cone. But The problem is i am not able to position the cone vertically down the aircraft with the apex of cone touching the aircraft body. This is due to fact that OSG::cone takes height information as (0,0,height). I am not able to pass the x, y components of apex of cone. I Guess, i need to tweak the cone rendering. But dont know how to go about it. ... Thank you! Cheers, Suraj -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69975#69975 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Visualizing a light cone in scene
Hi Ekaterina, Thanks for the clue. I am at present doing the round trace in a brute force way: I am retaining the rendered base circle of cone in each of the position of the aircraft. Next when the aircraft moves to next position, i again draw the new base circle, while i translate the cone i drew to show the searchlight. DO u have any better way of doing this? ... Thank you! Cheers, Suraj -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69973#69973 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Visualizing a light cone in scene
Hi, I am doing something similar. If you want to have your cone tilted attach it to your air vehicle using MatrixTransform, like in the example "osgspheresegment": osg::MatrixTransform* positioned = new osg::MatrixTransform; positioned->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON); positioned->setDataVariance(osg::Object::STATIC); positioned->setMatrix(osg::Matrix::translate(-bs.center())* osg::Matrix::scale(size,size,size)* osg::Matrix::rotate(osg::inDegrees(180.0f),0.0f,0.0f,1.0f)); positioned->addChild(cessna); positioned->addChild(lod); osg::MatrixTransform* xform = new osg::MatrixTransform; xform->setUpdateCallback(new osg::AnimationPathCallback(animationPath,0.0f,2.0)); xform->addChild(positioned); model->addChild(xform); Could you please tell, how did you make the trace on the ground? Thank you! Cheers, Ekaterina -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69968#69968 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Visualizing a light cone in scene
How are you planning on doing the search light? Are you planning on doing it as a semi-transparent cone? If so I would basically recommend looking at the DOF nodes (osgSim::DOFTransform), and look to attach the DOF node to your aircraft, and then placing your code under the DOF node. As per lighting model for the cone of light, it partially depends on what you are going for, doing a spot light is more realistic, but is going to be more work if you want to sort of pillar of light effect. If you are just looking to visualize what a search light would highlight, it just going to be easier to do a semi transparent cone. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69966#69966 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Visualizing a light cone in scene
Hi, Any suggestions or clues ? ... Cheers, Suraj -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69963#69963 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Visualizing a light cone in scene
Hi all, I am trying to visualize in openscenegraph a scene where there is a moving aircraft and a 'searchlight' attached to it. I am given the orientation of searchlight w.r.t aircraft in terms of angle between the vertical axes of searchlight beam and that of aircraft. Also the positions of aircraft is given along its trajectory. I need to show the cone of light in the scene and part of terrain lit so far by the given searchlight while the aircraft is in motion. Please see the attachment 1. My approach: I determined the point vertically below the moving aircraft by doing terrain intersection and use this point (shown in green in attachments )as the center of cone. Then i render the cone using its height as distance between the green dot and the location of aircraft. This method gives me a cone that is tilted and its tip doesnt touch the aricraft. This happens coz this approach doesnt provide me means of specifying the coordinates of the tip of the cone, and so, the cone rendered is tilted one as shown in attachment 2 in red. Is there any better method of doing this? Perhaps rendering the cone of a spotlight kind of thing? Please help. Also, if the canting angle between the searchlight and aircraft is changed the light cone generated in reality will not be always right circular (i.e. the cone height need not be perpendicular to cone base). How to handle such scenarios? I feel rendering a spotlight beam could take care of this issue. Any suggestions or guidance about how to go ahead? ... Thank you! Cheers, Suraj -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69944#69944 Attachments: http://forum.openscenegraph.org//files/tilted_cone_995.jpg http://forum.openscenegraph.org//files/conical_scanners_114.jpg ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org