You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The image keyword argument in plot_trisurf() does not render the image texture correctly in an ipyvolume figure.
Version numbers
Python 3.7 <-- EDIT TO ADD: maybe this is the problem? I recall seeing a note in your .travis.yml file that says "ipywidgets currently does not support 3.7". If this means ipyvolume also isn't supported it would be a good idea to remove the ability to pip/conda install it with python 3.7. Nope, that's not it. I've just tested in a new environment with python 3.6 and I still see the same thing.
ipyvolume - 0.5.1
ipywidgets - 7.4.2
ipywebrtc - 0.4.2
pythreejs - 2.0.2
ipython - 7.4.0
Chrome (latest, up to date) - Version 74.0.3729.169 (Official Build) (64-bit)
I don't get any python or javascript warnings, but the image texture fails to render on the final output - the mobius strip just looks black.
Example
Imports and loading the image we'll use as a texture
importipyvolumeasipvimportnumpyasnpimportPILimage=PIL.Image.open('ballpit.png')
# I used this image because it was colourful and had less black in it than the jupyter logo:# !curl http://localhost:8888/static/base/images/logo.png -o logo.png
plot_mesh() with an image texture
This is the working example code we'll use as a baseline. So far, so good.
fig=ipv.figure()
# we create a sequence of 8 u v coordinates so that the texture moves across the surface.X=np.arange(-5, 5, 0.25*1)
Y=np.arange(-5, 5, 0.25*1)
X, Y=np.meshgrid(X, Y)
R=np.sqrt(X**2+Y**2)
Z=np.sin(R)
u=np.array([X/5+np.sin(k/8*np.pi)*4.forkinrange(8)])
v=np.array([-Y/5*(1-k/7.) +Z*(k/7.) forkinrange(8)])
mesh=ipv.plot_mesh(X, Z, Y, u=u, v=v, texture=image, wireframe=False)
ipv.show()
This is the output:
plot_trisurf() with no image texture
Here is @deeplook's mobious strip, without an image texture
Setting up:
importipyvolumeasipvimportnumpyasnpimportPILimage=PIL.Image.open('ballpit.png')
defcalculate_points(num_theta=30, num_width=4):
"Calculate x, y, and z vectors for a Möbius strip."theta=np.linspace(0, 2*np.pi, num_theta)
width=np.linspace(-0.4, 0.4, num_width)
width, theta=np.meshgrid(width, theta)
phi=0.5*thetar=1+width*np.cos(phi) # radius in x-y planex=np.ravel(r*np.cos(theta))
y=np.ravel(r*np.sin(theta))
z=np.ravel(width*np.sin(phi))
returnx, y, znt, nw=30, 4x, y, z=calculate_points(num_theta=nt, num_width=nw)
# works only for num_w == 4rng=range(0, nt*nw-nw, nw)
triangles= [[i, i+1, i+4] foriinrng]
triangles+= [[i+1, i+4, i+5] foriinrng]
triangles+= [[i+1, i+2, i+5] foriinrng]
triangles+= [[i+2, i+5, i+6] foriinrng]
triangles+= [[i+2, i+3, i+6] foriinrng]
triangles+= [[i+2, i+3, i+6] foriinrng]
triangles+= [[i+3, i+6, i+7] foriinrng]
Displaying the mobius strip
ipv.figure()
ipv.plot_trisurf(x, y, z, triangles=triangles)
ipv.squarelim()
ipv.show()
plot_trisurf() with an image texture
I don't do anything here except add the texture=image keyword argument.
ipv.figure()
ipv.plot_trisurf(x, y, z, triangles=triangles, texture=image)
ipv.squarelim()
ipv.show()
Here I should see a very colourful image texture, but instead it just looks black.
I don't see any python or javascript errors.
Withouot u v coordinates, webgl doesn't know what part of the texture to put where. In the first example, there are u v coordinates passed, and it works, so also passing the right u and v coordinates should be the solution. Hope that helps!
The
image
keyword argument inplot_trisurf()
does not render the image texture correctly in an ipyvolume figure.Version numbers
Python 3.7
<-- EDIT TO ADD: maybe this is the problem? I recall seeing a note in your .travis.yml file that says "ipywidgets currently does not support 3.7". If this means ipyvolume also isn't supported it would be a good idea to remove the ability to pip/conda install it with python 3.7.Nope, that's not it. I've just tested in a new environment with python 3.6 and I still see the same thing.ipyvolume - 0.5.1
ipywidgets - 7.4.2
ipywebrtc - 0.4.2
pythreejs - 2.0.2
ipython - 7.4.0
Chrome (latest, up to date) - Version 74.0.3729.169 (Official Build) (64-bit)
I don't get any python or javascript warnings, but the image texture fails to render on the final output - the mobius strip just looks black.
Example
Imports and loading the image we'll use as a texture
plot_mesh() with an image texture
This is the working example code we'll use as a baseline. So far, so good.
This is the output:
![ipyvolume_texture_ballpit](https://user-images.githubusercontent.com/30920819/58381184-879a4a80-7ffd-11e9-9988-2b40b6943a21.PNG)
plot_trisurf() with no image texture
Here is @deeplook's mobious strip, without an image texture
Setting up:
Displaying the mobius strip
plot_trisurf() with an image texture
I don't do anything here except add the
texture=image
keyword argument.Here I should see a very colourful image texture, but instead it just looks black.
I don't see any python or javascript errors.
As discussed in #249
The text was updated successfully, but these errors were encountered: