## Stuart’s MATLAB VideosWatch and Learn

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the Original version of the page.

# Basics: Volume visualization: 5/9 Making a 3-d plot ‘pretty’ with lighting, shading, interpolation, etc…4

Posted by Doug Hull,

This short video is the fifth of a series of nine that talks about volume visualization. Patrick gave this talk internally to help technical support engineers understand capabilities of MATLAB for volume visualization.

I like his slow, clear, methodical presentation with great visualizations. It is the first time I have deeply understood some of the volume visualization techniques we have.

Tom Clark replied on : 1 of 4
Nice, thanks to Doug and Patrick. The alpha command is useful - I hadn't come across that, and always struggled with setting facealpha value etc for individual patches. Also well worth a mention is the isonormals command, which effectively removes the faceted appearance of the patch objects (although gouraud lighting helps, computing the isonormals is still a substantial improvement). From the ML isonormals help:
data = cat(3, [0 .2 0; 0 .3 0; 0 0 0], ...
[.1 .2 0; 0 1 0; .2 .7 0],...
[0 .4 .2; .2 .4 0;.1 .1 0]);
data = interp3(data,3,'cubic');

subplot(1,2,1)
p1 = patch(isosurface(data,.5),...
'FaceColor','red','EdgeColor','none');
view(3); daspect([1,1,1]); axis tight
camlight; camlight(-80,-10); lighting phong;
title('Triangle Normals')

subplot(1,2,2)
p2 = patch(isosurface(data,.5),...
'FaceColor','red','EdgeColor','none');
isonormals(data,p2)
view(3); daspect([1 1 1]); axis tight
camlight;  camlight(-80,-10); lighting phong;
title('Data Normals')


Patrick Kalita replied on : 2 of 4
Hello! This is Patrick, that voice you hear in this video. As Tom notes, the ISONORMALS command is great to use in conjunction with the ISOSUFACE command. ISONORMALS can make the surface look more continuous by adjusting the 'VertexNormals' property of the patch object based on the gradient of the underlying data. In fact, when you call ISOSURFACE without an output argument it makes use of the ISONORMALS command. In the interest of limiting the total length of this presentation to one hour I had to forgo talking about the nice ISOSURFACE-helpers like ISONORMALS, ISOCAPS, and ISOCOLORS. But please feel free to check them out in the documentation: https://www.mathworks.com/help/matlab/ref/isonormals.html https://www.mathworks.com/help/matlab/ref/isocaps.html https://www.mathworks.com/help/matlab/ref/isocolors.html
Ahmad replied on : 3 of 4
Hi I have a question that i cant really solve it i have a 3D matrix A(424x424x192) where A(424x424x1)is an image of the first layer of an object and then A(424x424x2)is the image of the second layer(for example the first layer is at zero cm hieght and the second layer is at 2 cm hieght and so on until we reach the last layer A(424x424x192)which is at 192 cm hieght. i wand to plot this matrix to get a volume shape of my object. but i dont know how to do it. so if any one can help i will be really happy thanks Ahmad
dhull replied on : 4 of 4