Hi Robert, Thanks again for your reply. I am a bit confused on using color map. I would like my program to support at least 8 bit color, so how should I create the color map? Where can I find more information? osgvolume.cpp does not have much details related to color map.
All layers are undersampled. I think I need to adjust the sample density if only first layer display. Regards, Clement ________________________________________ From: [email protected] [[email protected]] On Behalf Of Robert Osfield [[email protected]] Sent: Friday, 4 May 2012 7:09 PM To: OpenSceneGraph Users Subject: Re: [osg-users] osgvolume brightness and sample density Hi Clement, On 4 May 2012 08:46, <[email protected]> wrote: > Hi Robert, > > Sorry, I just saw your reply. Is TransferFunctionProperty used for > defined colour map? > > osg::ref_ptr<osg::TransferFunction1D> transferFunction = new > osg::TransferFunction1D; > transferFunction->setColor(0.0, osg::Vec4(1.0,0.0,0.0,0.0)); > transferFunction->setColor(0.5, osg::Vec4(1.0,1.0,0.0,0.5)); > transferFunction->setColor(1.0, osg::Vec4(0.0,0.0,1.0,1.0)); > > transferFunction->assign(transferFunction->getColorMap()); > osg::ref_ptr<osgVolume::TransferFunctionProperty> tfp = new > osgVolume::TransferFunctionProperty(transferFunction.get()); > > osg::ref_ptr<osgVolume::CompositeProperty> cp = new > osgVolume::CompositeProperty; > layer->addProperty(cp.get()); > cp->addProperty(tfp.get()); > > > If I don't use TransferFunctionProperty, I guess osg will use default > colour map. Then I no need to create another colour map. Is that correct? If you don't use a TransferFunctionProperty then the intensity or colours coming from the Texture3D (sourced from the osgVolume::ImageLayer) will be used directly, there isn't any default colour map. > For example, the size of my volume cube is 100 * 100 * 50. If I show the > first layer (100 * 100 * 1), the colour from the back view is more brightness > than from the front view. I am not understand why it is related to > TransferFunctionProperty. The colour brightness is affected by adjusting the > SampleDensityProperty value. If your data is undersampled then it won't be as bright as it would be if the ray casting take sufficient samples to properly map your volume. > I have more question about performance. If the image is showed the first > layer, the performance is the same as showing all layers (100 * 100 * 50). > Is any possible way to increase the rendering speeding when only first layer > is shown? Many thanks. When you say layer, do you simply mean a slice of an 3D osg:Image? In osgVolume the Layer class represent as whole 3D image. Robert. _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

