[vtkusers] How To Texture Map a patch with vtkGlobeSource

Donny donnyz at charter.net
Tue Nov 2 22:56:42 EDT 2010


Thanks for the help Aashish. I have attached 3 image files, one with the
AutomaticSphereGenerationOff() set on the vtkTextureMapToSphere object and
one with AutomaticSphereGenerationOn(). The third image is not a screenshot,
it is the actual texture I am trying to map to the patch.  The only settings
I set on the vtkGlobeSource are :
gs->SetStartLatitude(24.0);
gs->SetEndLatitude(50.0);
gs->SetStartLongitude(-126.0);
gs->SetEndLongitude(-66.0);

As you can see the GlobeSource patch geometry is rendering as intended, but
the texture is not appearing correctly. 

"you can have

tx = asin(Nx)/PI  + 0.5
ty = asin(Ny)/PI + 0.5"

Is there a filter that will perform this mapping for me? 

Thanks.

-----Original Message-----
From: Aashish Chaudhary [mailto:aashish.chaudhary at kitware.com] 
Sent: Tuesday, November 02, 2010 10:11 AM
To: Donny
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] How To Texture Map a patch with vtkGlobeSource

Hi Donny,
- Show quoted text -
I have not used vtkTextureMapToSphere myself but can you try to
generate your own texture coordinates? globe source does produce
normals and in its very simplistic approach  ...

you can have

tx = asin(Nx)/PI  + 0.5
ty = asin(Ny)/PI + 0.5

In a shader you can do it easily.  Not sure why vtkTextureMapToSphere
didn't work. Will find out.

Can you post a snapshot?

On Tue, Nov 2, 2010 at 12:01 AM, Donny <donnyz at charter.net> wrote:
> I have created a globe patch with vtkGlobeSource for the general area of
the
> United States (Lat 24 to 50 Deg, Lon -126 to -66 Deg.) using
> SetLatitudeStart, SetLatitudeEnd ... I also have a .bmp image that
> corresponds to these extents and cannot find a filter to generate the
> texture coordinates for this patch so I can texture it. I tried
> vtkTextureMapToSphere and turned auto generate sphere to off but it only
> displayed a small portion of the image onto the patch. How can I generate
> the texture coordinates for a patch such as this?
>
>
>
> Thanks.
>
>
>
> Donny Zimmerman
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



-- 
| Aashish Chaudhary
| R&D Engineer
| Kitware Inc.
| www.kitware.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: auto_sphere_gen_on.jpg
Type: image/jpeg
Size: 16895 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101102/518bd0ad/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: auto_sphere_gen_off.jpg
Type: image/jpeg
Size: 74468 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101102/518bd0ad/attachment-0001.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: usa_image.jpg
Type: image/jpeg
Size: 41425 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101102/518bd0ad/attachment-0002.jpg>


More information about the vtkusers mailing list