Is there a way of finding how much light gets projected onto face of a patch?‏

1 view (last 30 days)
Hi,
Is there a way of finding how much light/intensity gets projected onto a face of a patch?
I am attempting to plot a surface, then convert each surface into a patch. I am introducing a light source at a certain position. Based on the plots, the faces exposed to light change color, while the faces that are not exposed to light get shaded. I am trying to find how much light/intensity each face gets from the source.
I have tried the code below. It seems that based on the colormap of each face, each face gets light equally, which doesn't seem to be the case when looking at the plots. Is there a way of finding how much light/intensity gets projected onto each face of a patch based on the location of the lighting?
[x,y,z]= cylinder([1 1],40);
cylinder1=surf(x,y,z);
surf_info = findall(cylinder1,'Type','surface');
fv = surf2patch(surf_info.XData,surf_info.YData,surf_info.ZData,surf_info.CData);
patch(fv,'FaceVertexCData',fv.facevertexcdata,'FaceColor','flat');
light1=light('Position',[2 2 2],'Style','local');
lighting flat
color_per_face = fvcdata(fv.faces(:,1));
color_map = colormap;
figure,plot(color_map)
color_per_face_2= fvcdata(fv.faces(:,2));
color_map_2 = colormap;
figure,plot(color_map_2)

Answers (1)

Walter Roberson
Walter Roberson on 7 Feb 2016
The data that you can fetch from the patch are all input values, not the values after modification for lighting. There is no obvious way to extract the lit values short of rendering to image and reading out from the image.
  1 Comment
Shurui Zhang
Shurui Zhang on 15 May 2019
Hi Walter,
I came across the same question where I need a model to light my face patch in different angles. However, the lighting seems to be only a "post-processing" way for plot view and I cannot get my patch with altered brightness. I wonder how I can process my data with the same effect instead of just a visualization effect?
Thanks!
Shurui

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!