x3dom

Using X3Dom MovieTexture on a sphere doesn't show whole movie


I'm trying to use a movie as a texture on a sphere using X3Dom's MovieTexture. It is in equirectangular projection which would allow the user to look around (similar to Google StreetView).

The movie is mp4 or ogv and plays fine on e.g. a box shape from the example code from the x3dom docs.

However, on the sphere only 20 percent of the surface is covered with the movie texture while the rest is stretched over the surface.

Sphere and Box shape with MovieTexture

The relevant code looks like this:

<x3d width='500px' height='400px'>
  <scene>
    <shape>
      <appearance>
         <MovieTexture repeatS="false" repeatT="false" loop='true' url='bigBuckBunny.ogv'></MovieTexture>
      </appearance>
      <sphere></sphere>
    </shape>
  </scene>
</x3d>

Solution

  • Looks like it is supposed to work but currently a bug in x3dom when repeatS="false" is set on the texture.

    The problem also occurs with a generic <texture> element that includes a <canvas> or <video> element.

    The workaround that worked for me is to use a <canvas> with a power-of-two size to avoid setting repeatS="false"

    An alternative would be to scale to original video.