Is there a way of finding how much light gets projected onto face of a patch?
1 次查看(过去 30 天)
显示 更早的评论
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
2016-2-7
What is fvcdata() ? That does not appear to be a routine defined by Mathworks.
回答(1 个)
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
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 Center 和 File Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!