Matlab 3D figure to 3D (X)HTML

Converts 3D objects of a Matlab figure to XHTML embedded X3D file. Interactive 3D website graphics.
ダウンロード: 4K
更新 2011/8/17


編集メモ: This file was selected as MATLAB Central Pick of the Week

This function FIGURE2XHTML converts the 3D objects of a Matlab figure to an in XHTML embedded X3D file. In a modern browser, you can then view your figure interactively because of the great X3DOM Library (Instant 3D the HTML way!

Currently the function supports: Axes, Patch, Line, Surface, Text, Images and Light Objects.

Note: Even volume rendering in your browser is possible, by using:

Browsers supported:
- Google Chrome 9.x and above
- Firefox 4.x and above
- Webkit nightly builds
- Flash11 needed for Internet explorer (or InstantReality-plugin)


Note : All input arguments are optional, and sorting doesn't matter
thus figure2xhtml(); is valid but also figure2xhtml(options,handle);

filename : Name of the XHTML file (also an X3D file is created).
When empty or not known a File-Dialog is shown
handle : Figure handle or axis handle
When empty or not known the current axis (GCA) is used
options : A struct with options
options.output : Produce output files 'x3d', 'xhtml' or 'both' (default)
options.width : Width of X3D render object in pixels default 500
options.height : Height of X3D render object in pixels default 500
options.headlight : Enable Camera head light, boolean true/false
(default true)
options.title : Title of xhtml page, default 'Matlab X3D'
options.interactive : Make mesh/surface objects clickable in xhtml,
boolean true/false (default false)

figure, hold on; axis equal;
patch(FV,'facecolor',[1 0 0],'facealpha',0.5);


Dirk-Jan Kroon (2024). Matlab 3D figure to 3D (X)HTML (, MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2011a
Windows macOS Linux

ヒントを与えたファイル: Export figure to 3D interactive PDF

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート

Improved Internet Explorer support

Added options

added alphamap support

Added images support.
Added reverse axis support.

Added Line-Marker support

Font-size adjustment

added text support, and example with axis in xhtml.

- Added Surface Texture Support
- Fixed NaN bug in vertex-normals