Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: problem with surface lighting (OpenGL)
Date: Fri, 17 Apr 2009 12:23:02 +0000 (UTC)
Organization: Pierburg GmbH
Lines: 34
Message-ID: <gs9sb6$7bh$1@fred.mathworks.com>
References: <gs77e9$fbj$1@fred.mathworks.com> <gs9k4l$3c4$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1239970982 7537 172.30.248.38 (17 Apr 2009 12:23:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 17 Apr 2009 12:23:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 872224
Xref: news.mathworks.com comp.soft-sys.matlab:533498


"Oliver Woodford" <o.j.woodford.98@cantab.net> wrote in message <gs9k4l$3c4$1@fred.mathworks.com>...
> It looks to me like the face normals are being incorrectly calculated here. I would submit it as a bug report and see what happens.

Thanks for your answer, Oliver, so I'm not the only one observing the zebra. It's remarkable that the face normal calculation should depend on the existence or shape of neighbouring faces.
In the meantime I've sent in a service request. To strengthen the effect, I've increased the number of faces:


[Y,Z,X] = cylinder([1.2 1 1 0.8],144);   % "[Y,Z,X]"!
X(3:end,:) = X(3:end,:)+0.5;

figure(1)
surf(X,Y,Z,'EdgeAlpha',0.2,'FaceColor','c')
axis equal off
light('Position',[0 0 1],'Style','infinite');

idxShift = mod(1:size(X,2),4)>1;
X(3,idxShift) = X(3,idxShift)+0.2;

figure(2)
surf(X,Y,Z,'EdgeAlpha',0.2,'FaceColor','c')
axis equal off
light('Position',[0 0 1],'Style','infinite');

figure(3)
surf(X(1:3,:),Y(1:3,:),Z(1:3,:),'EdgeAlpha',0.2,'FaceColor','c')
axis equal off
light('Position',[0 0 1],'Style','infinite');

figure(4)
surf(X(1:3,:),Y(1:3,:),Z(1:3,:),'EdgeAlpha',0.2,'FaceColor','c')
hold on
surf(X(3:4,:),Y(3:4,:),Z(3:4,:),'EdgeAlpha',0.2,'FaceColor','c')
axis equal off
light('Position',[0 0 1],'Style','infinite');