Date: Mar 8, 2012 6:35 AM
Author: kinor
Subject: shadowing of patch object

Hi all,

has anyone experience with lighting patch objects? I try to visualize a simple box on a plane. the result is quite surprising as single rectangles of the surface are visually split in the two patches they are made of.
Additionally i like to see shadow of the box on the plane, and i have no idea how to get it.
thanks a lot for any hint
kinor
here is my short code:

close all
hold on

% draw box
pts = [ 0 1 0; 0 3 0; 3 3 0; ...
3 1 0; 3 1 2; 3 3 2; ...
0 3 2; 0 1 2];

vert = [1 2 7; 1 8 7; 2 3 7;3 6 7;3 4 6;4 5 6;1 4 8;4 5 8;6 7 8; 5 6 8];
col = [1 1 1] * 0.9;
patch('vertices', pts, 'faces', vert, 'facecolor',col, 'edgecolor', 'none')

% draw base plane
pts2 = [-1 -1 0; -1 4 0; 4 4 0; 4 -1 0];
vert2 = [1 2 3; 1 3 4]
patch('vertices', pts2, 'faces', vert2, 'facecolor','w', 'edgecolor', 'none')

% try to set light
axis equal
axis tight
view(3);
% camlight
% lighting gouraud
% material metal

axis vis3d
h = light;
for az = -50:10:50
lightangle(h,az,30)
drawnow
pause
end