texturing a surface (mayavi)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

texturing a surface (mayavi)

Jean-Luc Menut
Hello all,

I try to put a numpy array as a texture for a surface (mlab.surf). I do
not find a clear example on how to do this. Is someone have done that
before ?

thanks,
J.L.
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: texturing a surface (mayavi)

Gael Varoquaux
On Fri, Jan 15, 2010 at 01:14:49PM +0100, Jean-Luc Menut wrote:
> I try to put a numpy array as a texture for a surface (mlab.surf). I do
> not find a clear example on how to do this. Is someone have done that
> before ?

Hei Jean-Luc,

The API to do this is a bit more contrieved than I would like, and I have
not had time to write documentation or a good example. However, attached
is an example that could help you.

HTH,

Gaël

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

earth_example.py (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: texturing a surface (mayavi)

Jean-Luc Menut

> The API to do this is a bit more contrieved than I would like, and I have
> not had time to write documentation or a good example. However, attached
> is an example that could help you.


Thanks a lot, Gaël, I will investigate your example.


By the way, I would like to thanks all the peoples who work on mayavi
and who answer the questions on the mailing list.
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: texturing a surface (mayavi)

Jean-Luc Menut
In reply to this post by Jean-Luc Menut

 > I try to put a numpy array as a texture for a surface (mlab.surf).

I ended up with doing that :

fig = mlab.gcf()
texture=mlab.imshow(data1)
surf=mlab.surf(data2,warp_scale=0.02,color=(1,1,1))
surf.actor.tcoord_generator_mode = 'plane'
surf.actor.texture_source_object = fig.children[0]
surf.actor.mapper.scalar_visibility = False
surf.actor.enable_texture = True

But I did not find how to change the colormap of the texture.

Hopefully, I found that the mesh function could take a scalar as
parameter. It seems to do what I want.

J.L.
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev