fog3D

FOG3D adds 3D fog to the axes to emphasize depth of the shown 3D plot
339 Downloads
Updated 21 Jul 2014

View License

FOG3D adds 3D fog to the axes simulated by series of semi-transparent
planes oriented perpendicularly to the CAMERAPOSITION-CAMERATERGET line.
The planes cover whole 3D scene and tract 3D plot rotation making an
illusion of 3D depth fog.
Only small subset of the fog planes are visible during rotation of the 3D
plot to make user interaction smooth and fast.
As soon as the 3D rotation is finished (when user releases mouse button)
all fog planes are shown.

Syntax
fog3D(ah,Command)
fog3D(ah,Command, Param1Name,Param1Value, ... )

ah handle of axes to add fog

Command string command with desired action:
'add' to add fog
does nothing if fog already added
'remove' to remove fog completely
does nothing if no fog was already added
'hide' to hide fog
works only if fog was already added
'show' to show previously hidden fog
works only if fog was already added
'toggle' to toggle fog visibility
works only if fog was already added

If no COMMAND parameter is provided, 'add' is assumed.

Available paameters are:

Visible logical default: true
controls whether fog is initially visible

FollowAxesRotation logical default: true
controls whether fog follows rotation of 3D plot
If FOLLOWAXESROTATION is false fog becomes
invisible when 3D plot is rotated so the
CAMERAPOSITION-CAMERATERGET line is
parallel to fog planes.

SimpleWhenRotated logical default: true
controls whether fewer fog planes are
displayed when user rotates 3D plot

NPlanes number default: 101
controls number of fog planes
More planes make fog visually better.

NSimplePlanes number default: 11
controls how many of fog planes are visible during 3D plot rotation

Color 1x3 vector default: [ 1.0 1.0 1.0 ];
controls fog color

Origin 1x3 vector default: get(ah,'CameraTarget');

Examples

logo;
fog3D(gca,'remove');

In this case figure color is black while axes and fog color is white.
In order to create better image set figure color also to white.

logo;
set(gcf,'Color','w')
fog3D(gca,'add');

fog3D_demo;

Cite As

Andriy Nych (2024). fog3D (https://www.mathworks.com/matlabcentral/fileexchange/47275-fog3d), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0