Re: [osg-users] osgUtil::Optimizer and transparent objects
Anyone any hint regarding this? I'd really need an advice if I should fix the optimizer or where to solve this. cheers Sebastian Hello, I've encountered a problem when using the OpenFlight plugin with preserveFace/preserveObject option not used. If the perserveFace options is not used, the importer uses the Optimizer with the following options: osgUtil::Optimizer::SHARE_DUPLICATE_STATE | osgUtil::Optimizer::MERGE_GEOMETRY | osgUtil::Optimizer::MERGE_GEODES | osgUtil::Optimizer::TESSELLATE_GEOMETRY | osgUtil::Optimizer::STATIC_OBJECT_DETECTION; This unfortunately breaks the sorting of transparent objects, as in my example all forests (represented by simple quads/polygons) are put into one geode. After digging into the optimizer, I realized, that it will not check if the statesets contain any transparency. Would you consider this rather a bug in the Optimizer or more a mis-usage in the OpenFlight importer? As the osgviewer doesn't disable depth writes for transparent objects, the problem is only visible if you use the transparent-bin with depth writes off, which leads me to another question: Would it be wise to turn off depth writes for the transparent bin by default ( or a least make it configurable for the osgviewer)? cheers Sebastian ___ 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] osgUtil::Optimizer and transparent objects
Hi About optimizer - i would rather count this one as misusage. And for transparent stuff with depth write disabled by default - there are some cons for this (alpha masked geometry with alpha test f.e.). And if you want correct blending you should draw transparent objects after solid and sort them either back to front or front to back (depending on blending function), in case of back to front sorting there are no difference between depth write enabled or disabled anyway (as long as sorted objects not overlap). So disabling depth write would only help in cases when sorting are not an option for some reason, sorted objects overlaps(in depth), or objects are very transparent (as in latter case draw order often dont make big visual difference, at least you cant say that something completely wrong looking at picture :) Cheers 26.01.2012, 20:19, Sebastian Messerschmidt sebastian.messerschm...@gmx.de: Anyone any hint regarding this? I'd really need an advice if I should fix the optimizer or where to solve this. cheers Sebastian Hello, I've encountered a problem when using the OpenFlight plugin with preserveFace/preserveObject option not used. If the perserveFace options is not used, the importer uses the Optimizer with the following options: osgUtil::Optimizer::SHARE_DUPLICATE_STATE | osgUtil::Optimizer::MERGE_GEOMETRY | osgUtil::Optimizer::MERGE_GEODES | osgUtil::Optimizer::TESSELLATE_GEOMETRY | osgUtil::Optimizer::STATIC_OBJECT_DETECTION; This unfortunately breaks the sorting of transparent objects, as in my example all forests (represented by simple quads/polygons) are put into one geode. After digging into the optimizer, I realized, that it will not check if the statesets contain any transparency. Would you consider this rather a bug in the Optimizer or more a mis-usage in the OpenFlight importer? As the osgviewer doesn't disable depth writes for transparent objects, the problem is only visible if you use the transparent-bin with depth writes off, which leads me to another question: Would it be wise to turn off depth writes for the transparent bin by default ( or a least make it configurable for the osgviewer)? cheers Sebastian ___ 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] osgUtil::Optimizer and transparent objects
Am 26.01.2012 17:51, schrieb Sergey Polischuk: Hi About optimizer - i would rather count this one as misusage. Okay, still I think it'll be possible to fix the merge geode visitor easily. I don't want to loose the ability to merge the literally thousands of openflight geometries if they are not transparent. I've come up with a quick fix which I'm testing currently. It required a simple check in the mergeGeode function: bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode geode) { if (!isOperationPermissibleForObject(geode)) return false; #if 1 //new check osg::StateSet* geode_stateset = geode.getStateSet(); if (geode_stateset osg::StateSet::TRANSPARENT_BIN == geode_stateset-getRenderingHint()) { return false; } #endif I'm wondering if the best solution would be to use an additional flag in the MERGE_GEODE optimizer to either skip transparent state sets or optimize them anyways. Maybe Robert can give an advice, how to solve this question. And for transparent stuff with depth write disabled by default - there are some cons for this (alpha masked geometry with alpha test f.e.). And if you want correct blending you should draw transparent objects after solid and sort them either back to front or front to back (depending on blending function), in case of back to front sorting there are no difference between depth write enabled or disabled anyway (as long as sorted objects not overlap). So disabling depth write would only help in cases when sorting are not an option for some reason, sorted objects overlaps(in depth), or objects are very transparent (as in latter case draw order often dont make big visual difference, at least you cant say that something completely wrong looking at picture :) I do separate my drawing by issuing the opaque stuff first and draw the transparent stuff sorted. Still a lot of models I've come across (e.g. simple vegetation) uses a lot if intersecting quads, so for this it really makes a difference whether depth writes are enabled or not. Anyways, right now I'm trying to post-process my scenes in order to control some stuff, so it doesn't hurt to much to decide for my self if depth writes are on or not. Question was more pointed to the fact, that in each classical example you find, depth writes are off for blended stuff. cheers Sebastian Cheers 26.01.2012, 20:19, Sebastian Messerschmidtsebastian.messerschm...@gmx.de: Anyone any hint regarding this? I'd really need an advice if I should fix the optimizer or where to solve this. cheers Sebastian Hello, I've encountered a problem when using the OpenFlight plugin with preserveFace/preserveObject option not used. If the perserveFace options is not used, the importer uses the Optimizer with the following options: osgUtil::Optimizer::SHARE_DUPLICATE_STATE | osgUtil::Optimizer::MERGE_GEOMETRY | osgUtil::Optimizer::MERGE_GEODES | osgUtil::Optimizer::TESSELLATE_GEOMETRY | osgUtil::Optimizer::STATIC_OBJECT_DETECTION; This unfortunately breaks the sorting of transparent objects, as in my example all forests (represented by simple quads/polygons) are put into one geode. After digging into the optimizer, I realized, that it will not check if the statesets contain any transparency. Would you consider this rather a bug in the Optimizer or more a mis-usage in the OpenFlight importer? As the osgviewer doesn't disable depth writes for transparent objects, the problem is only visible if you use the transparent-bin with depth writes off, which leads me to another question: Would it be wise to turn off depth writes for the transparent bin by default ( or a least make it configurable for the osgviewer)? cheers Sebastian ___ 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 mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osgUtil::Optimizer and transparent objects
Hello, I've encountered a problem when using the OpenFlight plugin with preserveFace/preserveObject option not used. If the perserveFace options is not used, the importer uses the Optimizer with the following options: osgUtil::Optimizer::SHARE_DUPLICATE_STATE | osgUtil::Optimizer::MERGE_GEOMETRY | osgUtil::Optimizer::MERGE_GEODES | osgUtil::Optimizer::TESSELLATE_GEOMETRY | osgUtil::Optimizer::STATIC_OBJECT_DETECTION; This unfortunately breaks the sorting of transparent objects, as in my example all forests (represented by simple quads/polygons) are put into one geode. After digging into the optimizer, I realized, that it will not check if the statesets contain any transparency. Would you consider this rather a bug in the Optimizer or more a mis-usage in the OpenFlight importer? As the osgviewer doesn't disable depth writes for transparent objects, the problem is only visible if you use the transparent-bin with depth writes off, which leads me to another question: Would it be wise to turn off depth writes for the transparent bin by default ( or a least make it configurable for the osgviewer)? cheers Sebastian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org