Doug’s MATLAB Video Tutorials

November 17th, 2009

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

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.

2 Responses to “Basics: Volume visualization: 5/9 Making a 3-d plot ‘pretty’ with lighting, shading, interpolation, etc…”

  1. Tom Clark replied on :

    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')
    
  2. Patrick Kalita replied on :

    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:
    http://www.mathworks.com/access/helpdesk/help/techdoc/ref/isonormals.html
    http://www.mathworks.com/access/helpdesk/help/techdoc/ref/isocaps.html
    http://www.mathworks.com/access/helpdesk/help/techdoc/ref/isocolors.html

Leave a Reply

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>

If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).


Doug Hull is a proud MathWorker who is on a mission to help you with MATLAB.

Doug's picture

These postings are the author's and don't necessarily represent the opinions of The MathWorks.