Re: [osg-users] setLODScale affecting near far planes?
Hi Jose, Getting 10fps is pretty bad, I personally wouldn't be happy till get that up to 60Hz+. The first step is to work out what is the bottleneck - you say that you have too many triangles in your scene, and cutting this down gets you back your frame rate. There are lots of ways to manage the number of triangles, if you have fog to hide what is in the distance you can get away with enabling culling on the far plane, but if you do enable this then you have to disable the compute near/far as the two will be dependant on each other and you'll end up with a feedback loop that might not behave well. Far plane culling isn't the only techinique - using LODScale is another technique, as is use of osgTerrain::Terrain::setSampleRatio() if you are using osgdem --terrain generated databases. See osgmultitexturecontrol example for code that controls these parameters. I've talked about these in last month so have a trawl through the mailing list archives. Robert. On Tue, Sep 23, 2008 at 8:59 PM, Joseanibal Colon Ramos [EMAIL PROTECTED] wrote: Hi all, Good, I am happy it is all clearer now, and I am sorry it wasn't enough at first. So back to the original issue: I observe my problem of auto-changing near/far planes when I modify the LODScale via camera-setLODScale(float). This *always* happens whether or not culling is enabled, but of course I am not affected by this problem when culling is disabled because no matter what values my near/far planes have, my objects do not get culled. I enable culling via: camera-setCullingMode(getCurrent() | osg::CullSttings::near | osg::cullS::far) - I don't have the code in front of me but that is the idea. The problem I encounter is that since I am culling the near/far planes, some objects get culled from my scene if the near/far planes shift positions automatically. Robert already explained that with my current near/far computing settings I will get some slight changes to the near/far planes when changing the LODScale. Although this is undesirable for my application, it makes sense given Robert's earlier explanation. So Paul asks, what if I just keep the original culling mode? Well, that would be great, it looks great and I don't have the culling problem of the changing near/far planes, but there is one *crucial* issue: frame-rate. My terrain is too large and I need a decent level of detail, but it winds up drawing way too many triangles. I am attempting to find the optimal LODScale for my app, which can get me up from 10fps to about 25-30fps at a decent LODScale, and I also want to cull all those extra triangles, which can pump me up to 40-50 fps, at the cost of culling objects when not desired. I think I'll be alright, I need to play some more with the near/far compute settings. Thanks all for your interest in this topic, -Jose On Mon, September 22, 2008 10:52 am, Paul Martz wrote: FYI, Roland is correct, the OSG just does culling on sides of the frustum by default. OpenGL does no culling, is just does near and far *clipping*. The OSG of course doesn't change this so will do near/far clipping and the only way to switch this off is to disable GL_DEPTH_TEST. Even that won't work; DEPTH_TEST is a fragment op, and clipping against the clip planes is done before rasterization. It would seem that Paul and Gordon have confused the clipping and culling a little. Yes, I thought the original poster was talking about enabling OpenGL near/far clipping (probably because I have seen so many newbies ask how to disable this in the OpenGL forums and newsgroups). Clearly, the original poster said culling... My mistake, and thanks to all for the clarification. Back to the original issue: So, you see this problem when you enable OSG culling for near/far. What happens if you leave this disabled (as osgviewer does)? -Paul ___ 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] setLODScale affecting near far planes?
Hi all, Good, I am happy it is all clearer now, and I am sorry it wasn't enough at first. So back to the original issue: I observe my problem of auto-changing near/far planes when I modify the LODScale via camera-setLODScale(float). This *always* happens whether or not culling is enabled, but of course I am not affected by this problem when culling is disabled because no matter what values my near/far planes have, my objects do not get culled. I enable culling via: camera-setCullingMode(getCurrent() | osg::CullSttings::near | osg::cullS::far) - I don't have the code in front of me but that is the idea. The problem I encounter is that since I am culling the near/far planes, some objects get culled from my scene if the near/far planes shift positions automatically. Robert already explained that with my current near/far computing settings I will get some slight changes to the near/far planes when changing the LODScale. Although this is undesirable for my application, it makes sense given Robert's earlier explanation. So Paul asks, what if I just keep the original culling mode? Well, that would be great, it looks great and I don't have the culling problem of the changing near/far planes, but there is one *crucial* issue: frame-rate. My terrain is too large and I need a decent level of detail, but it winds up drawing way too many triangles. I am attempting to find the optimal LODScale for my app, which can get me up from 10fps to about 25-30fps at a decent LODScale, and I also want to cull all those extra triangles, which can pump me up to 40-50 fps, at the cost of culling objects when not desired. I think I'll be alright, I need to play some more with the near/far compute settings. Thanks all for your interest in this topic, -Jose On Mon, September 22, 2008 10:52 am, Paul Martz wrote: FYI, Roland is correct, the OSG just does culling on sides of the frustum by default. OpenGL does no culling, is just does near and far *clipping*. The OSG of course doesn't change this so will do near/far clipping and the only way to switch this off is to disable GL_DEPTH_TEST. Even that won't work; DEPTH_TEST is a fragment op, and clipping against the clip planes is done before rasterization. It would seem that Paul and Gordon have confused the clipping and culling a little. Yes, I thought the original poster was talking about enabling OpenGL near/far clipping (probably because I have seen so many newbies ask how to disable this in the OpenGL forums and newsgroups). Clearly, the original poster said culling... My mistake, and thanks to all for the clarification. Back to the original issue: So, you see this problem when you enable OSG culling for near/far. What happens if you leave this disabled (as osgviewer does)? -Paul ___ 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] setLODScale affecting near far planes?
Hi all again, Robert: for you last question; yes, I have near/far culling enabled and the near/far setting is compute_near_far_using_bounding_volume. If the near far modification that is taking place should be very small, somehow I am still getting quite significant jumps because some objects near the camera get culled when I would not like that to happen. When I enable culling for near/far planes, it seems like osg takes into account my preferred near/far planes and is NOT auto-computing. It does do some re computation as I change the LODScale. Why does this happen? Paul: Do you get the same behavior when viewing your database in osgviewer and hitting the * and / keys? -Paul Sorry Paul, but it is hard for me to say, because with osgviewer I only notice the terrain loosing or gaining detail, but since I am unable to dump the camera information in osgviewer I cannot compare it to my application's printouts of near far planes, but thanks for the advice. -Jose On Sat, September 20, 2008 1:53 am, Robert Osfield wrote: Hi Jose, The LODScale does not affect the near/far planes and certainly won't affect near/far plane culling if enabled. If you have compute near/far planes on the camera enabled then LODScale might change the depth range a little as different children of LOD gets selected, but generally this would be very small.Could it be that you have enabled near/far plane culling by not disabled the compute of the near/far? Both settings are on the camera. Robert. On Fri, Sep 19, 2008 at 11:01 PM, Joseanibal Colon Ramos [EMAIL PROTECTED] wrote: Hi all, I am getting this rather weird effect when playing with the setLODScale values in my application. I have a large pagedLOD terrain, with near/far planes culling mode enabled for my camera, and I am looking at a certain direction in the scene. I added osg's lod scale handler so that I can modify the value interactively (with the * and / keys, just like in osgviewer) and it turns out that as I change that value, and I dump my application's debug information, I notice the the near/far planes do not remain constant, although I am not moving around the scene and I am always looking in the same direction. This causes problems because the clipping planes change as a result of changing the LOD scale and my non-LOD objects beyond the planes get culled. I don't think that the clipping planes should change at all if I am not moving my camera. I should still see the objects that are within a constant near/far distance, and I should only observe different level of detail on the LOD objects as I change the scale. What am I missing here? I am using osg.2.6.0 on a 64bit intel linux machine. Thanks, -Jose ___ 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] setLODScale affecting near far planes?
Hi all again, Robert: for you last question; yes, I have near/far culling enabled and the near/far setting is compute_near_far_using_bounding_volume. If the near far modification that is taking place should be very small, somehow I am still getting quite significant jumps because some objects near the camera get culled when I would not like that to happen. When I enable culling for near/far planes, it seems like osg takes into account my preferred near/far planes and is NOT auto-computing. It does do some re computation as I change the LODScale. Why does this happen? You have said on multiple occasions that you are enabling near/far culling -- What exactly do you mean by that? Near/far culling is always enabled in OSG and OpenGL, so I'm curious to know what function call you are making that you believe is enabling near/far culling. Paul: Do you get the same behavior when viewing your database in osgviewer and hitting the * and / keys? -Paul Sorry Paul, but it is hard for me to say, because with osgviewer I only notice the terrain loosing or gaining detail, but since I am unable to dump the camera information in osgviewer I cannot compare it to my application's printouts of near far planes, but thanks for the advice. If you don't get the dame behavior in osgviewer, then most likely this is a bug in your own application somewhere, and not a problem in OSG. You can dump the osgviewer camera information by editing the osgviewer source. -Paul ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] setLODScale affecting near far planes?
Culling IS done against the near and far clip, this is standard operating procedure of OGL and OSG Gordon __ Gordon Tomlinson Product Manager 3D Email : gtomlinson @ overwatch.textron.com __ (C): (+1) 571-265-2612 (W): (+1) 703-437-7651 Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival - Master Tambo Tetsura -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Smeenk, R.J.M. (Roland) Sent: Monday, September 22, 2008 11:36 AM To: OpenSceneGraph Users Subject: Re: [osg-users] setLODScale affecting near far planes? Paul, As far as I know default OSG culling is only done against the sides and not against the near and far plane. See: enum MaskValues { NO_CULLING = 0x0, VIEW_FRUSTUM_SIDES_CULLING = 0x1, NEAR_PLANE_CULLING = 0x2, FAR_PLANE_CULLING = 0x4, VIEW_FRUSTUM_CULLING= VIEW_FRUSTUM_SIDES_CULLING| NEAR_PLANE_CULLING| FAR_PLANE_CULLING, SMALL_FEATURE_CULLING = 0x8, SHADOW_OCCLUSION_CULLING= 0x10, DEFAULT_CULLING = VIEW_FRUSTUM_SIDES_CULLING| SMALL_FEATURE_CULLING| SHADOW_OCCLUSION_CULLING, ENABLE_ALL_CULLING = VIEW_FRUSTUM_CULLING| SMALL_FEATURE_CULLING| SHADOW_OCCLUSION_CULLING }; -- Roland -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Martz Sent: maandag 22 september 2008 16:46 To: 'OpenSceneGraph Users' Subject: Re: [osg-users] setLODScale affecting near far planes? Hi all again, Robert: for you last question; yes, I have near/far culling enabled and the near/far setting is compute_near_far_using_bounding_volume. If the near far modification that is taking place should be very small, somehow I am still getting quite significant jumps because some objects near the camera get culled when I would not like that to happen. When I enable culling for near/far planes, it seems like osg takes into account my preferred near/far planes and is NOT auto-computing. It does do some re computation as I change the LODScale. Why does this happen? You have said on multiple occasions that you are enabling near/far culling -- What exactly do you mean by that? Near/far culling is always enabled in OSG and OpenGL, so I'm curious to know what function call you are making that you believe is enabling near/far culling. Paul: Do you get the same behavior when viewing your database in osgviewer and hitting the * and / keys? -Paul Sorry Paul, but it is hard for me to say, because with osgviewer I only notice the terrain loosing or gaining detail, but since I am unable to dump the camera information in osgviewer I cannot compare it to my application's printouts of near far planes, but thanks for the advice. If you don't get the dame behavior in osgviewer, then most likely this is a bug in your own application somewhere, and not a problem in OSG. You can dump the osgviewer camera information by editing the osgviewer source. -Paul ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-opensce negraph.org This e-mail and its contents are subject to the DISCLAIMER at http://www.tno.nl/disclaimer/email.html ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] setLODScale affecting near far planes?
Tomlinson, Gordon wrote on Monday, September 22, 2008 10:45 AM: Culling IS done against the near and far clip, this is standard operating procedure of OGL and OSG To be precise, OSG only culls based on the sides of the frustum by default (as Roland says); OGL does the near and far plane culling (based on OSG calculations of what those planes should be). You can configure OSG to do its own near and far plane culling in addition, though. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Smeenk, R.J.M. (Roland) Sent: Monday, September 22, 2008 11:36 AM To: OpenSceneGraph Users Subject: Re: [osg-users] setLODScale affecting near far planes? Paul, As far as I know default OSG culling is only done against the sides and not against the near and far plane. See: enum MaskValues { NO_CULLING = 0x0, VIEW_FRUSTUM_SIDES_CULLING = 0x1, NEAR_PLANE_CULLING = 0x2, FAR_PLANE_CULLING = 0x4, VIEW_FRUSTUM_CULLING= VIEW_FRUSTUM_SIDES_CULLING| NEAR_PLANE_CULLING| FAR_PLANE_CULLING, SMALL_FEATURE_CULLING = 0x8, SHADOW_OCCLUSION_CULLING= 0x10, DEFAULT_CULLING = VIEW_FRUSTUM_SIDES_CULLING| SMALL_FEATURE_CULLING| SHADOW_OCCLUSION_CULLING, ENABLE_ALL_CULLING = VIEW_FRUSTUM_CULLING| SMALL_FEATURE_CULLING| SHADOW_OCCLUSION_CULLING }; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Martz Sent: maandag 22 september 2008 16:46 To: 'OpenSceneGraph Users' Subject: Re: [osg-users] setLODScale affecting near far planes? Hi all again, Robert: for you last question; yes, I have near/far culling enabled and the near/far setting is compute_near_far_using_bounding_volume. If the near far modification that is taking place should be very small, somehow I am still getting quite significant jumps because some objects near the camera get culled when I would not like that to happen. When I enable culling for near/far planes, it seems like osg takes into account my preferred near/far planes and is NOT auto-computing. It does do some re computation as I change the LODScale. Why does this happen? You have said on multiple occasions that you are enabling near/far culling -- What exactly do you mean by that? Near/far culling is always enabled in OSG and OpenGL, so I'm curious to know what function call you are making that you believe is enabling near/far culling. Paul: Do you get the same behavior when viewing your database in osgviewer and hitting the * and / keys? -Paul Sorry Paul, but it is hard for me to say, because with osgviewer I only notice the terrain loosing or gaining detail, but since I am unable to dump the camera information in osgviewer I cannot compare it to my application's printouts of near far planes, but thanks for the advice. If you don't get the dame behavior in osgviewer, then most likely this is a bug in your own application somewhere, and not a problem in OSG. You can dump the osgviewer camera information by editing the osgviewer source. -Paul -- Bryan Thrall FlightSafety International [EMAIL PROTECTED] ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] setLODScale affecting near far planes?
On Mon, Sep 22, 2008 at 4:45 PM, Tomlinson, Gordon [EMAIL PROTECTED] wrote: Culling IS done against the near and far clip, this is standard operating procedure of OGL and OSG FYI, Roland is correct, the OSG just does culling on sides of the frustum by default. OpenGL does no culling, is just does near and far *clipping*. The OSG of course doesn't change this so will do near/far clipping and the only way to switch this off is to disable GL_DEPTH_TEST. It would seem that Paul and Gordon have confused the clipping and culling a little. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] setLODScale affecting near far planes?
FYI, Roland is correct, the OSG just does culling on sides of the frustum by default. OpenGL does no culling, is just does near and far *clipping*. The OSG of course doesn't change this so will do near/far clipping and the only way to switch this off is to disable GL_DEPTH_TEST. Even that won't work; DEPTH_TEST is a fragment op, and clipping against the clip planes is done before rasterization. It would seem that Paul and Gordon have confused the clipping and culling a little. Yes, I thought the original poster was talking about enabling OpenGL near/far clipping (probably because I have seen so many newbies ask how to disable this in the OpenGL forums and newsgroups). Clearly, the original poster said culling... My mistake, and thanks to all for the clarification. Back to the original issue: So, you see this problem when you enable OSG culling for near/far. What happens if you leave this disabled (as osgviewer does)? -Paul ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] setLODScale affecting near far planes?
Hi Jose, The LODScale does not affect the near/far planes and certainly won't affect near/far plane culling if enabled. If you have compute near/far planes on the camera enabled then LODScale might change the depth range a little as different children of LOD gets selected, but generally this would be very small.Could it be that you have enabled near/far plane culling by not disabled the compute of the near/far? Both settings are on the camera. Robert. On Fri, Sep 19, 2008 at 11:01 PM, Joseanibal Colon Ramos [EMAIL PROTECTED] wrote: Hi all, I am getting this rather weird effect when playing with the setLODScale values in my application. I have a large pagedLOD terrain, with near/far planes culling mode enabled for my camera, and I am looking at a certain direction in the scene. I added osg's lod scale handler so that I can modify the value interactively (with the * and / keys, just like in osgviewer) and it turns out that as I change that value, and I dump my application's debug information, I notice the the near/far planes do not remain constant, although I am not moving around the scene and I am always looking in the same direction. This causes problems because the clipping planes change as a result of changing the LOD scale and my non-LOD objects beyond the planes get culled. I don't think that the clipping planes should change at all if I am not moving my camera. I should still see the objects that are within a constant near/far distance, and I should only observe different level of detail on the LOD objects as I change the scale. What am I missing here? I am using osg.2.6.0 on a 64bit intel linux machine. Thanks, -Jose ___ 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] setLODScale affecting near far planes?
Hi all, I am getting this rather weird effect when playing with the setLODScale values in my application. I have a large pagedLOD terrain, with near/far planes culling mode enabled for my camera, and I am looking at a certain direction in the scene. I added osg's lod scale handler so that I can modify the value interactively (with the * and / keys, just like in osgviewer) and it turns out that as I change that value, and I dump my application's debug information, I notice the the near/far planes do not remain constant, although I am not moving around the scene and I am always looking in the same direction. This causes problems because the clipping planes change as a result of changing the LOD scale and my non-LOD objects beyond the planes get culled. I don't think that the clipping planes should change at all if I am not moving my camera. I should still see the objects that are within a constant near/far distance, and I should only observe different level of detail on the LOD objects as I change the scale. What am I missing here? I am using osg.2.6.0 on a 64bit intel linux machine. Thanks, -Jose ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] setLODScale affecting near far planes?
Do you get the same behavior when viewing your database in osgviewer and hitting the * and / keys? -Paul Hi all, I am getting this rather weird effect when playing with the setLODScale values in my application. I have a large pagedLOD terrain, with near/far planes culling mode enabled for my camera, and I am looking at a certain direction in the scene. I added osg's lod scale handler so that I can modify the value interactively (with the * and / keys, just like in osgviewer) and it turns out that as I change that value, and I dump my application's debug information, I notice the the near/far planes do not remain constant, although I am not moving around the scene and I am always looking in the same direction. This causes problems because the clipping planes change as a result of changing the LOD scale and my non-LOD objects beyond the planes get culled. I don't think that the clipping planes should change at all if I am not moving my camera. I should still see the objects that are within a constant near/far distance, and I should only observe different level of detail on the LOD objects as I change the scale. What am I missing here? I am using osg.2.6.0 on a 64bit intel linux machine. Thanks, -Jose ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-opensce negraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org