[vtkusers] texture map to cube
David.Pont at ForestResearch.co.nz
David.Pont at ForestResearch.co.nz
Thu May 6 20:13:52 EDT 2004
Is vtkTextureMapToBox any use?
Dave P
|---------+---------------------------------->
| | "John Biddiscombe" |
| | <jbiddiscombe at skippingm|
| | ouse.co.uk> |
| | Sent by: |
| | vtkusers-admin at vtk.org |
| | |
| | |
| | 07/05/2004 11:47 |
| | |
|---------+---------------------------------->
>------------------------------------------------------------------------------------------------------------|
| |
| To: <vtkusers at vtk.org>, <anast.jm at pg.com> |
| cc: |
| Subject: Re: [vtkusers] texture map to cube |
>------------------------------------------------------------------------------------------------------------|
This will never work with TextureMapToPlane. It projects the points onto a
plane and so only 2 faces will ever look reasonable.
What you need is an image which is an unfolded cube and then write a
texturemaptocube which computes the texture coords correctly
------
| +Z |
------
---------------------
| -X | -Y | +X | +Y |
---------------------
------
| -Z |
------
like this, then compute the texcoords from the offsets. Is that what you're
trying to do?
JB
----- Original Message -----
From: <anast.jm at pg.com>
To: <vtkusers at vtk.org>
Sent: Thursday, May 06, 2004 9:57 PM
Subject: Re: [vtkusers] texture map to cube
> Dean,
>
> My code is very similar to yours and I couldn't get this to work either.
> Its not very intuitive. If the cube's origin is correct and the extent 1
> in all directions and Repeat is On, I can get an exact copy of my image
on
> all cube faces. If repeat is off, then I get two faces filled, and a very
> light smear on two other faces with the top and bottom blank. I've tried
> zillions of extent combos with origin offsets and can make heads or tails
> out of it. I tried maping to sphere too but I couldn't see anything.
>
> What are you seeing....john
>
>
>
>
>
> "Dean Inglis" <dean.inglis at camris.ca>
> Sent by: vtkusers-admin at vtk.org
> 05/06/2004 02:25 PM
>
>
> To: "vtkusers archive" <vtkusers at vtk.org>
> cc: (bcc: John Anast-JM/PGI)
> Subject: [vtkusers] texture map to cube
>
>
> I am trying to texture map a set of 6 face labels
> to a cube. So far I am just trying to map 4 of
> the faces with +/- coordinate face labels. The input
> image looks like this:
>
> ---------------------
> | -X | -Y | +X | +Y |
> ---------------------
>
> The unsuccessful pipeline is:
>
> package require vtk
> package require vtkinteraction
>
> vtkCubeSource cube
> cube SetBounds -1 1 -1 1 -1 1
>
> vtkTextureMapToPlane tmap
> #vtkTextureMapToCylinder tmap
> tmap SetInput [cube GetOutput]
> #tmap AutomaticPlaneGenerationOn
>
> vtkPolyDataMapper pmap
> pmap SetInput [tmap GetOutput]
>
> vtkPNGReader reader
> reader SetFileName "testwrap.png"
>
> vtkTexture texture
> texture SetQualityTo32Bit
> texture InterpolateOn
> #texture RepeatOn
> texture RepeatOff
> texture SetInput [reader GetOutput]
>
> vtkActor tact
> tact SetMapper pmap
> tact SetTexture texture
>
>
> # Create graphics stuff
> #
> vtkRenderer ren1
> vtkRenderWindow renWin
> renWin AddRenderer ren1
> vtkRenderWindowInteractor iren
> iren SetRenderWindow renWin
>
> # Add the actors to the renderer, set the background and size
> ren1 AddActor tact
>
> ren1 ResetCameraClippingRange
> ren1 SetBackground 0 .5 .4
>
> renWin SetSize 800 800
> iren Initialize
>
> # render the image
> #
> iren AddObserver UserEvent {wm deiconify .vtkInteract}
>
> # prevent the tk window from showing up then start the event loop
> wm withdraw .
>
>
> any hints? thanks,
> Dean
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: <
http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
_
More information about the vtkusers
mailing list