Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Transparent surfaces AND image in the same figure?

Subject: Transparent surfaces AND image in the same figure?

From: Alex James

Date: 20 Apr, 2010 19:06:05

Message: 1 of 2

I'm trying to create an image with a transparent surface overlaid on top of a camera image using mesh but am having a hard time of it.

 figure
 hold on
 mesh(zeros(size(fr))-59,fr); % draws the image at z=-59
 shading interp % gets rid of mesh lines
 hs=mesh(ilcfs,jlcfs,philcfs,'FaceColor','red','EdgeColor','none') % draws surface over the image, but mesh lines return on image, and transparency seems to also affect image...
 %shading interp
 alpha(.4)
 view(2)
 camlight left; lighting phong
 grid off

I've played around with changing the z of the image to get it in the figure behind the surface to my satisfaction, but I can't figure out how to manage shading of the two meshes separately.

Is this possible?

Subject: Transparent surfaces AND image in the same figure?

From: Oliver Woodford

Date: 21 Apr, 2010 10:12:29

Message: 2 of 2

"Alex James" wrote:
> I'm trying to create an image with a transparent surface overlaid on top of a camera image using mesh but am having a hard time of it.
>
> figure
> hold on
> mesh(zeros(size(fr))-59,fr); % draws the image at z=-59
> shading interp % gets rid of mesh lines
> hs=mesh(ilcfs,jlcfs,philcfs,'FaceColor','red','EdgeColor','none') % draws surface over the image, but mesh lines return on image, and transparency seems to also affect image...
> %shading interp
> alpha(.4)
> view(2)
> camlight left; lighting phong
> grid off
>
> I've played around with changing the z of the image to get it in the figure behind the surface to my satisfaction, but I can't figure out how to manage shading of the two meshes separately.
>
> Is this possible?

Yes. Each surface has its own Edgelighting and Facelighting properties, which you can change independently. There are also a whole host of reflectance properties you can also change indepently for each surface, such as AmbientStrength, DiffuseStrength, SpecularStrength, SpecularColorReflectance and SpecularExponent. And if you want to ged rid of the grid lines on the image just set the EdgeColor property to 'none', as you've done with the other surface.

Oliver

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us