[vtkusers] How To Texture Map a patch with vtkGlobeSource

Aashish Chaudhary aashish.chaudhary at kitware.com
Thu Nov 4 17:24:58 EDT 2010


On Thu, Nov 4, 2010 at 5:15 PM, Joey Mukherjee <joeymu at gmail.com> wrote:

> Now I remember why this doesn't work.  When you have a texture, it
> must just be a flat image, right?  You can't add any relief (i.e.
> vtkWarpScalar) to make it look different?  Passing the output of
> vtkWarpScalar doesn't seem to work.
>

Correct,  a texture in general is a flat image. What you can do easily is to
use two textures:

1. height map texture (for warping)
2. decal texture (for coloring).

Now not sure if you are familiar with shaders but what would I do is the
pass these two the shader's and use height map texture to warp the globe
geometry (move the vertices)
and other to color the fragments in the fragment shader.

>
> Its amazingly fast to plot this data as a texture instead of trying to
> plot it as an image.
>
> Also, to get this to work, I had to make the lat/long range go from
> -180 to 180 and -90 to 90 since that is what my image is.  I realize
> in Donny's original example, he already had the USA image and just
> want to map that part.  I thought he was digging into a larger
> dataset.
>

So basically  you were using the entire globe right?

>
> If I just wanted to show a certain region specified by a given
> lat/long range, would any of the vtkGeo stuff be able to help me?  I'm
> ideally interested in viewing the data at the polar regions.
>
> It should if not let me know.

Thanks,



> Thank you for this!
> Joey
>
> On Thu, Nov 4, 2010 at 10:57 AM, Aashish Chaudhary
> <aashish.chaudhary at kitware.com> wrote:
> >
> >
> > On Thu, Nov 4, 2010 at 11:51 AM, Joey Mukherjee <joeymu at gmail.com>
> wrote:
> >>
> >> On Thu, Nov 4, 2010 at 10:42 AM, Aashish Chaudhary
> >> <aashish.chaudhary at kitware.com> wrote:
> >>>
> >>> Hi,
> >>>
> >>> On Thu, Nov 4, 2010 at 11:34 AM, Joey Mukherjee <joeymu at gmail.com>
> wrote:
> >>>>
> >>>> Thanks for posting this example Aashish!
> >>>>
> >>>> I have some NetCDF data files that I would like to overlay over the
> >>>> Earth and be able to extract subsets from them and the like.  To get
> this
> >>>> same type of visualization, can I make use of the Geo classes?
> >>>
> >>> Probably need more detail on exactly what you are trying to do but in
> >>> general you should be able to use Geo*  classes for the purpose above.
> >>>
> >>>>
> >>>> Does the have to be a texture map or can I use any kind of regularized
> >>>> image data?
> >>>
> >>> Can you elaborate this?
> >>
> >> I have some NetCDF files which are described as follows:
> >> netcdf test {
> >> dimensions:
> >>         x = 5760 ;
> >>         y = 2880 ;
> >> variables:
> >>         float x(x) ;
> >>                 x:long_name = "x" ;
> >>                 x:actual_range = 0., 360. ;
> >>         float y(y) ;
> >>                 y:long_name = "y" ;
> >>                 y:actual_range = -90., 90. ;
> >>         float z(y, x) ;
> >>                 z:long_name = "z" ;
> >>                 z:_FillValue = NaNf ;
> >>                 z:actual_range = -9.04707336425781, 10.6143484115601 ;
> >> // global attributes:
> >>                 :Conventions = "COARDS/CF-1.0" ;
> >>                 :GMT_version = "4.3.1 [64-bit]" ;
> >>                 :node_offset = 1 ;
> >> The X/Y are long/lat respectively, with the z being the scalar values.
>  I
> >> would like to overlay this file and others onto a globe and specify just
> >> portions of the map to view.  vtkNetCDFCFReader will output an image (I
> >> believe), but its the part of mapping it to the globe which gets me.  I
> >> can't just convert an image to a texture map, can I?
> >
> > Just like the example, you can use vtkTexture and call SetInput on it
> with
> > the vtkImageData (that s the output of the image reader).
> >
> >>
> >> You can see that this is a pretty high resolution (5760x2880) dataset so
> >> I'd like to just look at portions of the dataset to save time.
> >
> > Sure.
> >
> >
> >>
> >> Thanks,
> >> Joey
> >
> >
> > --
> > | Aashish Chaudhary
> > | R&D Engineer
> > | Kitware Inc.
> > | www.kitware.com
> >
>



-- 
| Aashish Chaudhary
| R&D Engineer
| Kitware Inc.
| www.kitware.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101104/f8374eb6/attachment.htm>


More information about the vtkusers mailing list