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

조회 수: 1 (최근 30일)
Emmin
Emmin 2016년 2월 7일
댓글: Shurui Zhang 2019년 5월 15일
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)
  댓글 수: 2
Walter Roberson
Walter Roberson 2016년 2월 7일
What is fvcdata() ? That does not appear to be a routine defined by Mathworks.
Emmin
Emmin 2016년 2월 7일
oh, it's a variable. I was using it interchangeably..
fvcdata = fv.facevertexcdata;

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2016년 2월 7일
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
Shurui Zhang
Shurui Zhang 2019년 5월 15일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by