Hi,
I am new to OpenGL. My current assignment involves changing the
brightness and contrast of the currently displayed image (3D Volume)
as per the user input. I am using multi texturing with 2D textures for
rendering the 3D Volume.
I am using glPixelTransfer to change the SCALE for changing the
brightness. Is there some way by which I can specify the threshold in
OpenGL such that the pixels having intensity above the particular
threshold are not rendered?
I have already tried using glAlphaFunc for specifying the threshold
level but it dint work.
I am really struggling with this with no luck so far. Please help ....
Thanks & Regards,
Pradnya
|
|
0
|
|
|
|
Reply
|
pchaphekar
|
5/8/2004 12:52:46 PM |
|
<pchaphekar@vsnl.net> wrote in message
news:4ab3468f.0405080452.6933edd5@posting.google.com...
> Hi,
>
> I am new to OpenGL. My current assignment involves changing the
> brightness and contrast of the currently displayed image (3D Volume)
> as per the user input. I am using multi texturing with 2D textures for
> rendering the 3D Volume.
> I am using glPixelTransfer to change the SCALE for changing the
> brightness. Is there some way by which I can specify the threshold in
> OpenGL such that the pixels having intensity above the particular
> threshold are not rendered?
> I have already tried using glAlphaFunc for specifying the threshold
> level but it dint work.
>
> I am really struggling with this with no luck so far. Please help ....
>
> Thanks & Regards,
> Pradnya
It's better to use a dependent texture look-up to do what you want. The way
you do this may vary depending on the capability of your graphics card, but
this is a common technique for volume rendering. Basically your main texture
(representing the voxels) is an intensity map, the values of which are used
as indices into an RGBA texture for display (i.e. so you can control the
alpha channel on output). For the latest graphics cards, this is most easily
done in a fragment shader, e..g using Cg.....
You can look at VTK or OpenQVis to see how these techniques are used.
Hope that helps
Roger
-------------------------------------------------------
EMail: roger dot rowland at rmrsystems dot co dot uk
|
|
0
|
|
|
|
Reply
|
Roger
|
5/9/2004 11:19:44 AM
|
|
"Roger Rowland" <see.sig@bottomof.message> wrote in message news:<1084101566.10318.0@lotis.uk.clara.net>...
> <pchaphekar@vsnl.net> wrote in message
> news:4ab3468f.0405080452.6933edd5@posting.google.com...
> > Hi,
> >
> > I am new to OpenGL. My current assignment involves changing the
> > brightness and contrast of the currently displayed image (3D Volume)
> > as per the user input. I am using multi texturing with 2D textures for
> > rendering the 3D Volume.
> > I am using glPixelTransfer to change the SCALE for changing the
> > brightness. Is there some way by which I can specify the threshold in
> > OpenGL such that the pixels having intensity above the particular
> > threshold are not rendered?
> > I have already tried using glAlphaFunc for specifying the threshold
> > level but it dint work.
> >
> > I am really struggling with this with no luck so far. Please help ....
> >
> > Thanks & Regards,
> > Pradnya
>
>
> It's better to use a dependent texture look-up to do what you want. The way
> you do this may vary depending on the capability of your graphics card, but
> this is a common technique for volume rendering. Basically your main texture
> (representing the voxels) is an intensity map, the values of which are used
> as indices into an RGBA texture for display (i.e. so you can control the
> alpha channel on output). For the latest graphics cards, this is most easily
> done in a fragment shader, e..g using Cg.....
>
> You can look at VTK or OpenQVis to see how these techniques are used.
>
> Hope that helps
> Roger
>
> -------------------------------------------------------
> EMail: roger dot rowland at rmrsystems dot co dot uk
Thanks for your help Roger. I have gone through the OpenQVis code, but
I was not able to figure out how exactly the dependant texture look up
is done... Could you please provide some more pointers to this ...
Your help is highly appreciated...
Thanks & Regards,
Pradnya
|
|
0
|
|
|
|
Reply
|
pchaphekar
|
5/11/2004 5:54:52 AM
|
|
<pchaphekar@vsnl.net> wrote in message
news:4ab3468f.0405102154.406aeb59@posting.google.com...
> ...snip...
>
> Thanks for your help Roger. I have gone through the OpenQVis code, but
> I was not able to figure out how exactly the dependant texture look up
> is done... Could you please provide some more pointers to this ...
> Your help is highly appreciated...
Well, it really depends on your graphics card. If this is in your control,
you can make it easier for yourself rather than trying to code for whatever
hardware the end user has.
For example, if your card supports paletted textures (extensions
GL_EXT_paletted_texture and GL_EXT_shared_texture_palette), like many NVidia
cards do (or did!), you can build your main texture as an index (i.e.
GL_COLOR_INDEX instead of GL_RGBA or whatever) and then build the
look-up-table (LUT) using glColorTableEXT(). Alternatively, if you have
support for texture shaders (GL_NV_texture_shader) you can use the
NVidia-specific extensions to do the same thing with slightly different
syntax (I think there's an implementation of this in OpenQVis - look for
GL_TEXTURE_SHADER_NV in the source).
If you need to support different cards it might be possible to us Cg
(www.cgshaders.org) to handle the hardware-dependent aspects for you and
just implement a simple fragment shader to do a dependent texture read.
Although this looks like an NVidia-specific thing, this will work on many
ATI cards too (they just need to support e.g. GL_ARB_fragment_program).
If you google for "opengl" and "dependent texture" I'm sure you'll find
plenty of examples. If you do have specific hardware in mind then let us
know what it is. If you *don't* then I'd personally recommend NV GF-FX (as
big as you can afford). I use an FX5950 with 256Mb to do volume rendering
from DICOM data sets and have an interactive window/level adjustment (which
is what I guess you're describing). For this I have a 2D dependent texture
to access my LUT using 16-bit intensity data derived from the DICOM slices.
So I know it works!
Hope this helps,
Roger
------------------------------------------------------
EMail: roger dot rowland at rmrsystems dot co dot uk
|
|
0
|
|
|
|
Reply
|
Roger
|
5/11/2004 7:55:05 AM
|
|
Thanks for your valuable inputs, Roger ..
Well I am using NVIDIA Quadro FX 500 with OpenGL drivers 1.4 Version
.... I found that the extensions GL_EXT_paletted_texture and
GL_EXT_shared_texture_palette are not supported on this card.
The other option is using GL_TEXTURE_SHADER_NV extension supported by
NVIDIA...
Since we are already using multitexturing, I am not sure how to use a
dependant texture lookup will work with this ...
Could you please eleborate more on this.
Thanks again
Pradnya
"Roger Rowland" <see.sig@bottomof.message> wrote in message news:<1084262110.29070.0@sabbath.news.uk.clara.net>...
> <pchaphekar@vsnl.net> wrote in message
> news:4ab3468f.0405102154.406aeb59@posting.google.com...
> > ...snip...
> >
> > Thanks for your help Roger. I have gone through the OpenQVis code, but
> > I was not able to figure out how exactly the dependant texture look up
> > is done... Could you please provide some more pointers to this ...
> > Your help is highly appreciated...
>
> Well, it really depends on your graphics card. If this is in your control,
> you can make it easier for yourself rather than trying to code for whatever
> hardware the end user has.
>
> For example, if your card supports paletted textures (extensions
> GL_EXT_paletted_texture and GL_EXT_shared_texture_palette), like many NVidia
> cards do (or did!), you can build your main texture as an index (i.e.
> GL_COLOR_INDEX instead of GL_RGBA or whatever) and then build the
> look-up-table (LUT) using glColorTableEXT(). Alternatively, if you have
> support for texture shaders (GL_NV_texture_shader) you can use the
> NVidia-specific extensions to do the same thing with slightly different
> syntax (I think there's an implementation of this in OpenQVis - look for
> GL_TEXTURE_SHADER_NV in the source).
>
> If you need to support different cards it might be possible to us Cg
> (www.cgshaders.org) to handle the hardware-dependent aspects for you and
> just implement a simple fragment shader to do a dependent texture read.
> Although this looks like an NVidia-specific thing, this will work on many
> ATI cards too (they just need to support e.g. GL_ARB_fragment_program).
>
> If you google for "opengl" and "dependent texture" I'm sure you'll find
> plenty of examples. If you do have specific hardware in mind then let us
> know what it is. If you *don't* then I'd personally recommend NV GF-FX (as
> big as you can afford). I use an FX5950 with 256Mb to do volume rendering
> from DICOM data sets and have an interactive window/level adjustment (which
> is what I guess you're describing). For this I have a 2D dependent texture
> to access my LUT using 16-bit intensity data derived from the DICOM slices.
> So I know it works!
>
> Hope this helps,
> Roger
>
>
> ------------------------------------------------------
> EMail: roger dot rowland at rmrsystems dot co dot uk
|
|
0
|
|
|
|
Reply
|
pchaphekar
|
5/13/2004 3:00:00 PM
|
|
<pchaphekar@vsnl.net> wrote in message
news:4ab3468f.0405130700.d5dffd4@posting.google.com...
> Thanks for your valuable inputs, Roger ..
> Well I am using NVIDIA Quadro FX 500 with OpenGL drivers 1.4 Version
> ... I found that the extensions GL_EXT_paletted_texture and
> GL_EXT_shared_texture_palette are not supported on this card.
> The other option is using GL_TEXTURE_SHADER_NV extension supported by
> NVIDIA...
> Since we are already using multitexturing, I am not sure how to use a
> dependant texture lookup will work with this ...
> Could you please eleborate more on this.
>
Using NV texture shaders is certainly possible but I don't know how this
would affect your multi-texturing without knowing more about what you're
using it for. Are you using it for inter-slice interpolation?
In any case, I can recommend googling for any of the publications by Klaus
Engel et al. I found a lot of useful information this way. For example, see
if you can download the course notes for the following 2002 SIGGRAPH
course -
http://www.cs.utah.edu/~jmk/sigg_crs_02/courses_0067.html
or from the (now outdated) http://www.vis.uni-stuttgart.de/~engel/
Maybe if you post some of your code I can make some specific suggestions.
Best regards,
Roger
------------------------------------------------------
EMail: roger dot rowland at rmrsystems dot co dot uk
|
|
0
|
|
|
|
Reply
|
Roger
|
5/13/2004 3:34:20 PM
|
|
Thanks for ur inputs Roger.
I am using multitexturing for inter slice iterpolation.
I am pasting my rendering code here
It would be really great if you give ur comments on this:
// set the multitexturing environment
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_PRIMARY_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_INTERPOLATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA, GL_PRIMARY_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, GL_SRC_ALPHA);
glEnable(GL_BLEND);
glDepthMask(GL_FALSE);
glBlendFunc(GL_ONE, GL_ONE);
glBlendEquationEXT(GL_MAX_EXT);
"Roger Rowland" <see.sig@bottomof.message> wrote in message news:<1084462462.9135.0@doris.uk.clara.net>...
> <pchaphekar@vsnl.net> wrote in message
> news:4ab3468f.0405130700.d5dffd4@posting.google.com...
> > Thanks for your valuable inputs, Roger ..
> > Well I am using NVIDIA Quadro FX 500 with OpenGL drivers 1.4 Version
> > ... I found that the extensions GL_EXT_paletted_texture and
> > GL_EXT_shared_texture_palette are not supported on this card.
> > The other option is using GL_TEXTURE_SHADER_NV extension supported by
> > NVIDIA...
> > Since we are already using multitexturing, I am not sure how to use a
> > dependant texture lookup will work with this ...
> > Could you please eleborate more on this.
> >
>
> Using NV texture shaders is certainly possible but I don't know how this
> would affect your multi-texturing without knowing more about what you're
> using it for. Are you using it for inter-slice interpolation?
>
> In any case, I can recommend googling for any of the publications by Klaus
> Engel et al. I found a lot of useful information this way. For example, see
> if you can download the course notes for the following 2002 SIGGRAPH
> course -
>
> http://www.cs.utah.edu/~jmk/sigg_crs_02/courses_0067.html
>
> or from the (now outdated) http://www.vis.uni-stuttgart.de/~engel/
>
> Maybe if you post some of your code I can make some specific suggestions.
>
> Best regards,
> Roger
>
> ------------------------------------------------------
> EMail: roger dot rowland at rmrsystems dot co dot uk
|
|
0
|
|
|
|
Reply
|
pchaphekar
|
5/27/2004 2:02:33 PM
|
|
Thanks for ur help Roger.
I am using multitexturing for inter slice interpolation.
I am pasting my rendering code here.
It would really be great if you give ur comments on this:
// Set multitexturing environment
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB,
GL_INTERPOLATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_PRIMARY_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_INTERPOLATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA, GL_PRIMARY_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, GL_SRC_ALPHA);
glEnable(GL_BLEND);
glDepthMask(GL_FALSE);
glBlendFunc(GL_ONE, GL_ONE);
glBlendEquationEXT(GL_MAX_EXT);
// loop over total number of textures
for (; l_nQuadCount < l_nTotQuads; ++l_nQuadCount)
{
// get the lower and upper texture bounds for multi_texturing
double l_dQuadPos = (double)l_nQuadCount * (double)(l_nTotTextures -
1)/ (double)(l_nTotQuads - 1);
double l_dWeight = (int)l_dQuadPos + 1 - l_dQuadPos;
l_nLoTexBound = l_nStartTexPos + (int)(floor(l_dQuadPos)) *
l_nQuadIncr;
l_nHiTexBound = l_nStartTexPos + (int)(ceil(l_dQuadPos)) *
l_nQuadIncr;
// flag to check if the texture and polygon are co-planar
bool l_bQuadNotAtTex = (l_nLoTexBound != l_nHiTexBound);
glColor4f(l_dWeight, l_dWeight, l_dWeight, l_dWeight);
glActiveTextureARB (GL_TEXTURE0_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBindTexture(GL_TEXTURE_2D, m_pui2DTextureHandles[l_nLoTexBound]);
glActiveTextureARB (GL_TEXTURE1_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
if (l_bQuadNotAtTex && l_nQuadCount != l_nTotQuads - 1)
glBindTexture(GL_TEXTURE_2D, m_pui2DTextureHandles[l_nHiTexBound]);
else
glBindTexture(GL_TEXTURE_2D,
m_pui2DTextureHandles[l_nLoTexBound]);
glBegin(GL_QUADS);
{
int l_nPointCount = 0;
for (l_nPointCount = 0; l_nPointCount < 4; ++l_nPointCount)
{
glMultiTexCoord2fARB(GL_TEXTURE0_ARB,
m_dTexcorrds[l_SweepCoord][l_nPointCount][0],
m_dTexcorrds[l_SweepCoord][l_nPointCount][1]);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB,
m_dTexcorrds[l_SweepCoord][l_nPointCount][0],
m_dTexcorrds[l_SweepCoord][l_nPointCount][1]);
glVertex3dv(coords[l_SweepCoord][l_nPointCount]);
}
}
glEnd();
for (int l_nPointCount = 0; l_nPointCount < 4; ++l_nPointCount)
{
coords[l_SweepCoord][l_nPointCount][l_SweepCoord] += l_dSliceSpacing;
}
} // end of outer for
glDepthMask(GL_TRUE);
glDisable (GL_ALPHA_TEST);
glDisable(GL_BLEND);
glDisable(GL_POLYGON_OFFSET_FILL);
glActiveTextureARB (GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_2D);
glActiveTextureARB (GL_TEXTURE0_ARB);
glDisable(GL_TEXTURE_2D);
}
Please tell me how it is possible to use NVIDIA shaders in this
scenario.
I really appreciate ur help.
Thanks & Regards,
Pradnya
"Roger Rowland" <see.sig@bottomof.message> wrote in message news:<1084462462.9135.0@doris.uk.clara.net>...
> <pchaphekar@vsnl.net> wrote in message
> news:4ab3468f.0405130700.d5dffd4@posting.google.com...
> > Thanks for your valuable inputs, Roger ..
> > Well I am using NVIDIA Quadro FX 500 with OpenGL drivers 1.4 Version
> > ... I found that the extensions GL_EXT_paletted_texture and
> > GL_EXT_shared_texture_palette are not supported on this card.
> > The other option is using GL_TEXTURE_SHADER_NV extension supported by
> > NVIDIA...
> > Since we are already using multitexturing, I am not sure how to use a
> > dependant texture lookup will work with this ...
> > Could you please eleborate more on this.
> >
>
> Using NV texture shaders is certainly possible but I don't know how this
> would affect your multi-texturing without knowing more about what you're
> using it for. Are you using it for inter-slice interpolation?
>
> In any case, I can recommend googling for any of the publications by Klaus
> Engel et al. I found a lot of useful information this way. For example, see
> if you can download the course notes for the following 2002 SIGGRAPH
> course -
>
> http://www.cs.utah.edu/~jmk/sigg_crs_02/courses_0067.html
>
> or from the (now outdated) http://www.vis.uni-stuttgart.de/~engel/
>
> Maybe if you post some of your code I can make some specific suggestions.
>
> Best regards,
> Roger
>
> ------------------------------------------------------
> EMail: roger dot rowland at rmrsystems dot co dot uk
|
|
0
|
|
|
|
Reply
|
pchaphekar
|
5/27/2004 2:18:09 PM
|
|
|
7 Replies
391 Views
(page loaded in 0.118 seconds)
|