Re: [visad] HowTo Questions: gray scale, shader gray scale, viewers position, process monitor and netcdf access to large files

Hi Bill,

thanks once more for the really fast answer. Some thoughts:

1.a) Before starting to use VisAD I implemented a really tentative Volume Renderer using 16-bit grey scale textures, at least I thought so. According to http://download.java.net/media/java3d/javadoc/1.5.2/javax/media/j3d/Texture.html I used the LUMINANCE_ALPHA texture format, creating the texture from a grey scale BufferedImage. Do you know if Java3D translates this into an RGBA texture internally? If that's the case I would forget about it, creating textures this way.

1.b) I read that Paletted textures and texture color tables were only available as vendor specific OpenGL extensions and therefore not directly included into Java3D? On the other hand Java3D supports Shader programs since Version 1.4 and hence the possibility to simulate hardware LUT hopefully. According to the book "Real time volume graphics" (visible in google books, p. 40-41, p. 87-88) it is possible to simulate hardware LUT in OpenGL trough the use of a dependent texture look up. A fragment shader uses the luminance value interpolated at a certain point from a normal Texture2D or Texture3D mapping as index into 1D Texture. This 1D texture actually stores the color value finally used by the fragment shader. One advantage is, that changes of coloring would only need to exchange this 1D-Texture instead of the whole volume stored in GPU memory. The second advantage is, that the high frequency transfer function is applied post-interpolative this way, what should lead to nicer depictions (p 89 - 92). Has anybody tried this fragment shader approach yet? What could be the correct extension point for building such a Renderer?

2. I have in mind that the Java3D library itself offers a helpful tool for that somewhere. I'll tell the list if I found out.

3. I think I will have to shelf this idea for now until I have a better understanding of the VisAD workflow and know which classes to ask

4. Thank you, I will take a look and perhaps ask the mentioned directly :-)

kind regards,
Marius

hiding@xxxxxxxxx wrote:
Hi Marius,

We are all glad that you like VisAD. Your questions
are excellent. Here is what I know about answers to
them (but cavat emptor, I haven't written any code
for 6 years):

1. a) Images are rendered via texture maps, and
Java3D texture maps require values for each of
red, green and blue (and alpha) at each pixel.

1. b) Java3D does not support hardware color
tables. (I first wrote Vis5D on the Stellar GS 1000,
which did support hardware color lookup tables,
missed that capability in most later graphics
hardware).

2. You should be able to do this via the setMatrix()
method of the ProjectionControlJ3D you get from
DisplayImplJ3D.getProjectionControl(). Of course,
you've got to figure out how to set a user view point
as a 4x4 matrix.

Can any active VisAD programmers suggest tools
to help define J3D matrices?

3. Applications would need to keep track of
progress through a sequence of fetch, analyze and
display data. It would be nice if the display "please
wait" would give percent done, but sorry to say it
doesn't.

4. a) Perhaps the Unidata folks can help with this
(or perhaps Tom W)?

4. b) Jeff McWhirter recently created the CachedFlatField
and related "Cache" classes, that I think are better than
the olf FileFlatField. Hopefully he or someone can
comment on these.

Best regards,
Bill Hibbard

-----Original Message-----
From: Marius Schmidt <mariuss@xxxxxxxxxxxxxxxxxxxxxxxxxx>
To: visad@xxxxxxxxxxxxxxxx
Sent: Wed, Jul 14, 2010 6:14 am
Subject: [visad] HowTo Questions: gray scale, shader gray scale, viewers position, process monitor and netcdf access to large files

Hi again VisAD community,

as my work progresses I fall more and more in love with the ease of use
of the VisAD library :-). But for today I do not only have laud but also
a bunch of questions I hope you can help me with:

1. Gray Scale:
a) I have learned from the tutorial and documentation, that I have to
create a custom lookup table to provide a gray scale mapping using
Display.RGB(A). If I only map to gray in a 3D display I was wondering,
if internally 24 (32) bit texture are used nevertheless? If yes, is it
possible to enforce the use of an 8-bit luminance texture instead to
reduce memory consumption and allow bigger datasets uploaded to GPU memory?

b) Before I started working with VisAD I experimented with some fragment
shader based application of lookup tables as explained in some
literature. I searched the library for the usage of Shader programms but
did not find any. Am I guessing right that color table is applied to
data before uploading it to the GPU? At which place might it be possible
and a good idea to implement a shader based lookup table for real-time
coloring of depictions (by only exchanging the lookup map stored as
lookup texture in GPU memory and accessed by a fragment shader)?

2. Viewers position:
I have not found a way yet to Setup the initial users view point viewing
direction, I guess I overlooked something, can you help me out ?

3. Process monitor
Some calculations or data fetching processes in VisAD take longer than a
few seconds and I would like to display their progress using a process
monitor showing the user, that there is still something going on. I have
seen, that as soon as the display is up and there are calculations going
on a "please wait" message is being displayed. But that does not work
for initial pre-displayed processes like fetching and analyzing data of
a bigger Netcdf dataset. Is there a hook to ask Visad how many percent
of a job is already processed ?

4. Netcdf
a) I have seen that there is Plain as a reader for NetCDF datasets. I
transformed one of the dicom image sets available at the human visible
project into netcdf format, but without attention to any convention like
CF. Following the VerySimple and Simple example of the developers guide
did not really worked for me, so I set the MathType, FunctionType and
Set informations up manually and handed them over to a FlatField. Then I
used Plain only to read the sample values from the netcdf file into the
FlatField in reversed order. It works allright but I am wondering what
to keep in mind, that the plain reader works innately. How do I have to
prepare my NetCDF files, which conventions are known to Plain?

b) I shall try to visualize some of the measuring results of the
Coltrims experiment (for your interest:
http://hsb.uni-frankfurt.de/web/research/atomic/coltrims/).
Unfortunately the data files come in chunks of more than 10 GB each. I
found that there are classes called VirtualData, FileFlatField, etc. and
hope, that my guess is right. Are they are somehow intended to be used
for accessing datasets that do not fit into memory? How do I utilize
them for fast retrieving of slices in dimension of 500MB? I do not have
the heart yet trying to access one of those files, because I did have
not really understood, how to use them, and  I do not want to freeze my
system instantly :-D

Best regards,
Marius

_______________________________________________
visad mailing list
visad@xxxxxxxxxxxxxxxx
For list information, to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/