Point cloud and lighting effects

7 views (last 30 days)
Richard
Richard on 7 Oct 2017
Edited: Cedric on 14 Oct 2017
I'm displaying a half a dozen point clouds, and would like to add some "effects", eg lighting, etc. to give some depth to the figure. But, I don't seem to be able to get any lighting to reflect off the point cloud. Is there any way to do that? The figure seems "flat" without some sort of shadow effect.
Thanks Rick
  2 Comments
Abhi Sundararaman
Abhi Sundararaman on 10 Oct 2017
There's a light function
However, it says that lighting only affects patches and surfaces. If you mapped your point cloud onto a surface or a patch, I suppose you could also use the above function.
Another thing you could do is, if the point clouds are being displayed as a scattered set of points in 3d, you could plot the same points again but zero one of the components of X,Y, and Z and plot those points in black. This would fake a "shadow" effect (for example if you zeroed Z).
Cedric
Cedric on 10 Oct 2017
Edited: Cedric on 14 Oct 2017
And here is a pretty scary alternative ..
pts = rand( 20, 3 ) * 10 ;
plot3( pts(:,1), pts(:,2), pts(:,3), 'r.', 'MarkerSize', 15 ) ;
hold on ; grid on ;
R = @(ry,rz) [cos(ry) -sin(ry) 0; sin(ry) cos(ry) 0; 0 0 1] * ...
[cos(rz) 0 sin(rz); 0 1 0; -sin(rz) 0 cos(rz)] ;
p = [zeros(1,8); 0,0.5,0.2,0.6,0,0.1,0,0; 0,1,1,2,2,1,1,0] ;
for k = 1 : 10
rts_p = R(rand-0.5,rand-0.5)*(rand+0.5)*eye(3)*p+rand(3,1).*max(pts).' ;
fill3(rts_p(1,:),rts_p(2,:),rts_p(3,:), 'y') ;
end

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!