Robert,<br><br>Thanks. This was helpful. I resolved my issue by just setting the alpha to 1.0 for all input values in my transfer function. This together with specifying an IsosurfaceProperty gave me the effect I wanted. <br><br>Thanks again,<br><br>Alex<br><div class="gmail_quote"><div dir="ltr">On Tue, Feb 16, 2016 at 10:16 AM Robert Osfield <<a href="mailto:robert.osfield@gmail.com">robert.osfield@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Alex,<br>
<br>
I'm a bit too busy to go rummaging through code to answer your<br>
questions so will do my best by providing some general questions. I<br>
vaguely recall OSG-3.0 alpha, transparency and isosurface all<br>
overlapped a bit, so there was a bit of cross over. In OSG-3.4<br>
transparency and isosurface value is now separate and can be applied<br>
together within the same shader. There is also AlphaFunc which clips<br>
out fragments below a specific alpha value. I hope this makes sense.<br>
<br>
Robert.<br>
<br>
On 16 February 2016 at 14:59, Alex Taylor <<a href="mailto:alextaylor@gmail.com" target="_blank">alextaylor@gmail.com</a>> wrote:<br>
> Robert,<br>
><br>
> Thanks again. I do have one quick follow up question related to something<br>
> you said.<br>
><br>
> "Check the alpha values settings that you have set up for the VolumeTile."<br>
><br>
> I'm trying to figure out exactly what you mean by the "alpha values<br>
> settings" on the VolumeTile. I define my VolumeTile as shown below. As you<br>
> can see, I'm not setting Alpha anywhere in the setup of my tile. The one<br>
> place where alpha comes in is when I set the TransferFunctionProperty on my<br>
> tile. This brings me to my question.<br>
><br>
> It looks to me like the intention of Isosurface property is to specify the<br>
> isovalue for the isosurface rendering. What happens if you specify an<br>
> Isosurface property but your transfer function contains alpha values between<br>
> the ranges of (0,1)? Meaning, if you are defining an isosurface at isovalue<br>
> = X, do you also have to specify the alpha in your transfer function as a<br>
> unit step function U(I-X) with transition at X?<br>
><br>
> I'm trying to understand the motivation for blending being on for the<br>
> Isosurface codepath in RayTracedTechnique and how the alpha in the transfer<br>
> function interacts with the specification of an IsosurfaceProperty. I had<br>
> originally thought/guessed that the alpha in your transfer function would<br>
> just be ignored if you specify an IsosurfaceProperty.<br>
><br>
> - Alex<br>
><br>
> osg::ref_ptr<osg::Image> intensityImage = createTexture3D(data);<br>
><br>
> osg::ref_ptr<osg::Image> image_3d =<br>
> (volumeProperties.volumeTechnique == VolumeTechnique::FixedFunction) ?<br>
><br>
><br>
> osgVolume::applyTransferFunction(intensityImage.get(),volumeProperties.transferFunction.get())<br>
> :<br>
><br>
><br>
> intensityImage.release();<br>
><br>
><br>
><br>
> osg::ref_ptr<osgVolume::ImageLayer> layer = new<br>
> osgVolume::ImageLayer(image_3d);<br>
><br>
> tile->setLayer(layer.get());<br>
><br>
> Where createTexture3D is defined as:<br>
><br>
> osg::Image* createTexture3D(const mxArray* src) {<br>
><br>
> if (src == NULL || mxGetNumberOfDimensions(src) != 3 ||<br>
> mxGetClassID(src) != mxUINT8_CLASS) {<br>
><br>
> return NULL;<br>
><br>
> }<br>
><br>
> size_t num_s = mxGetDimensions(src)[0];<br>
><br>
> size_t num_t = mxGetDimensions(src)[1];<br>
><br>
> size_t num_r = mxGetDimensions(src)[2];<br>
><br>
> // now allocate the 3d texture;<br>
><br>
> osg::ref_ptr<osg::Image> image_3d = new osg::Image;<br>
><br>
> image_3d->setImage(num_s, num_t, num_r,<br>
><br>
> GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE,<br>
><br>
> static_cast<uint8_T *>(mxGetData(src)),<br>
><br>
> osg::Image::NO_DELETE);<br>
><br>
><br>
><br>
> return image_3d.release();<br>
><br>
> }<br>
><br>
> Other than that, the only other specification Alpha comes from setting the<br>
> TransferFunctionProperty on the tile with my TransferFunction. This brings<br>
> me to my question.<br>
><br>
> When<br>
><br>
><br>
><br>
> On Fri, Feb 12, 2016 at 5:42 AM Robert Osfield <<a href="mailto:robert.osfield@gmail.com" target="_blank">robert.osfield@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Hi Alex,<br>
>><br>
>> On 11 February 2016 at 20:47, Alex Taylor <<a href="mailto:alextaylor@gmail.com" target="_blank">alextaylor@gmail.com</a>> wrote:<br>
>> > Also, if it matters, I found that I can get the rendering I'd expect if<br>
>> > I<br>
>> > explicitly set the BlendFunc in the special case of Isosurface:<br>
>> ><br>
>> > if (volumeProperties.useIsosurface){<br>
>> > stateset->setAttribute(new osg::BlendFunc(GL_ONE, GL_ZERO),<br>
>> > osg::StateAttribute::ON);<br>
>> > }<br>
>> ><br>
>> > I'm not sure why I need to do this in OSG 3.4 when I didn't in OSG 3.0,<br>
>> > probably another issue with the viewer or something on my end.<br>
>><br>
>> From the details above and the picture it looks to me that OSG-3.4 is<br>
>> probably doing the right thing w.r.t the settings, such as alpha<br>
>> settings, you are using and OSG-3.0 implementation was incorrect and<br>
>> ignored these settings so you never saw this.<br>
>><br>
>> Check the alpha values settings that you have set up for the VolumeTile.<br>
>><br>
>> Robert.<br>
>> _______________________________________________<br>
>> osg-users mailing list<br>
>> <a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
>> <a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
><br>
><br>
> _______________________________________________<br>
> osg-users mailing list<br>
> <a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
> <a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
><br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div>