Post

MovieTexture

Overview

MovieTexture applies a 2D movie image to surface geometry, or provides audio for a Sound node. First define as texture, then USE as Sound source to see it/hear it/save memory. Texture maps have a 2D coordinate system (s, t) horizontal and vertical, with (s, t) texture-coordinate values in range [0.0, 1.0] for opposite corners of the image.

The MovieTexture node belongs to the Texturing component and requires at least level 3, its default container field is texture. It is available since VRML 2.0 and from X3D version 3.0 or higher.

Hierarchy

1
2
3
4
5
6
+ X3DNode
  + X3DAppearanceChildNode
    + X3DTextureNode
      + X3DSingleTextureNode
        + X3DTexture2DNode
          + MovieTexture (X3DSoundSourceNode, X3DUrlObject)*

* Derived from multiple interfaces.

Fields

SFNode [in, out] metadata NULL [X3DMetadataObject]

Information about this node can be contained in a MetadataBoolean, MetadataDouble, MetadataFloat, MetadataInteger, MetadataString or MetadataSet node.

Hint

SFString [in, out] description “”

Author-provided prose that describes intended purpose of the url asset.

Hint

  • Many XML tools substitute XML character references for special characters automatically if needed within an attribute value (such as & for & ampersand character, or " for “ quotation-mark character).

SFBool [in, out] enabled TRUE

Enables/disables node operation.

SFBool [in, out] load TRUE

load=true means load immediately, load=false means defer loading or else unload a previously loaded scene.

Hints

  • Allows author to design when Inline loading occurs via user interaction, event chains or scripting.
  • Use a separate LoadSensor node to detect when loading is complete.

MFString [in, out] url [ ] [URI]

Location and filename of movie file or stream. Multiple locations are more reliable, and including a Web address lets e-mail attachments work.

Hints

  • MFString arrays can have multiple values, so separate each individual string by quote marks “https://www.web3d.org” “https://www.web3d.org/about” “etc.”
  • Alternative XML encoding for quotation mark “ is " (which is an example of a character entity).
  • Can replace embedded blank(s) in url queries with %20 for each blank character.
  • X3D Scene Authoring Hints, urls

Warning

  • Strictly match directory and filename capitalization for http links! This is important for portability. Some operating systems are forgiving of capitalization mismatches, but http/https url addresses and paths in Unix-based operating systems are all case sensitive and intolerant of uppercase/lowercase mismatches.

SFTime [in, out] autoRefresh 0 [0,∞)

autoRefresh defines interval in seconds before automatic reload of current url asset is performed.

Hints

  • If preceding file loading fails or load field is false, no refresh is performed.
  • Repeated refresh attempts to reload currently loaded entry of url list. If that fails, the browser retries other entries in the url list.

Warning

  • Automatically reloading content has security considerations and needs to be considered carefully.

SFTime [in, out] autoRefreshTimeLimit 3600 [0,∞)

autoRefreshTimeLimit defines maximum duration that automatic refresh activity can occur.

Hint

  • Automatic refresh is different than query and response timeouts performed by a networking library while sequentially attempting to retrieve addressed content from a url list.

Warning

  • Automatically reloading content has security considerations and needs to be considered carefully.

SFFloat [in, out] gain 1 (-∞,∞)

The gain field is a factor that represents the amount of linear amplification to apply to the output of the node.

Hint

  • Negative gain factors negate the input signal.

Warning

  • Decibel values shall not be used.

SFFloat [in, out] speed 1 (-∞,∞)

Factor for how fast the movie (or soundtrack) is played.

Hints

  • A MovieTexture node shall display frame 0 if speed = 0.
  • A negative speed value sets the movie to play in reverse.

SFFloat [in, out] pitch 1 (0,∞)

Multiplier for the rate at which sampled sound is played. Changing pitch also changes playback speed.

Hint

  • Changing the pitch field does not trigger a duration_changed event. Playback interval may vary but duration of the original media data remains unmodified.

SFBool [in, out] loop FALSE

Repeat indefinitely when loop=true, repeat only once when loop=false.

SFTime [in, out] startTime 0 (-∞,∞)

Absolute time: number of seconds since January 1, 1970, 00:00:00 GMT.

Hint

  • ROUTE a time value matching system clock to this field, such as output event from TouchSensor touchTime or TimeTrigger triggerTime.

SFTime [in, out] resumeTime 0 (-∞,∞)

When resumeTime becomes <= time now, isPaused becomes false and MovieTexture becomes active. Absolute time: number of seconds since January 1, 1970, 00:00:00 GMT.

Hint

  • ROUTE a time value matching system clock to this field, such as output event from TouchSensor touchTime or TimeTrigger triggerTime.

Warning

  • Not supported in VRML97.

SFTime [in, out] pauseTime 0 (-∞,∞)

When time now >= pauseTime, isPaused becomes true and MovieTexture becomes paused. Absolute time: number of seconds since January 1, 1970, 00:00:00 GMT.

Hint

  • ROUTE a time value matching system clock to this field, such as output event from TouchSensor touchTime or TimeTrigger triggerTime.

Warning

  • Not supported in VRML97.

SFTime [in, out] stopTime 0 (-∞,∞)

Absolute time: number of seconds since January 1, 1970, 00:00:00 GMT.

Hint

  • ROUTE a time value matching system clock to this field, such as output event from TouchSensor touchTime or TimeTrigger triggerTime.

Warnings

  • An active TimeSensor node ignores set_cycleInterval and set_startTime events.
  • An active TimeSensor node ignores set_stopTime event values less than or equal to startTime.

SFBool [out] isPaused

isPaused true/false events are sent when MovieTexture is paused/resumed.

Warnings

  • Not supported in VRML97.
  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

SFBool [out] isActive

isActive true/false events are sent when playback starts/stops.

Warning

  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

SFTime [out] elapsedTime

Current elapsed time since MovieTexture activated/running, cumulative in seconds, and not counting any paused time.

Hint

  • elapsedTime is a nonnegative SFTime duration interval, not an absolute clock time.

Warnings

  • Not supported in VRML97.
  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

SFTime [out] duration_changed

Length of time in seconds for one cycle of media stream.

Hints

  • duration_changed is an SFTime duration interval, normally nonnegative, and not an absolute clock time.
  • Changing the pitch field does not trigger a duration_changed event. Playback interval may vary but duration of the original media data remains unmodified.

Warnings

  • Duration value of -1 implies that media data has not yet loaded or is unavailable for some reason.
  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

SFBool [ ] repeatS TRUE

Whether to repeat texture along S axis horizontally from left to right.

SFBool [ ] repeatT TRUE

Whether to repeat texture along T axis vertically from top to bottom.

SFNode [ ] textureProperties NULL [TextureProperties]

Single contained TextureProperties node that can specify additional visual attributes applied to corresponding texture images.

Supported File Formats

Any video file format supported by the web browser, but at least:

EncodingFile ExtensionMIME Type
MP4.mp4video/mp4
WebM.webmvideo/webm
OGG.oggvideo/ogg
GIF.gifimage/gif

Advice

Hints

Warning

  • MovieTexture has containerField='texture' when parent is an Appearance node, otherwise containerField='source' when parent is a Sound node.

Example

View Source in Playground

See Also

This post is licensed under CC BY 4.0 by the author.