- http://www.noveldevicelab.com/files/2018-08/light-out-coupling-for-reflective-displays-simple-geometrical-model-matlab-simulation-and-experimental-validation-2011-2.pdf
- https://www.cs.rochester.edu/u/brown/173/exercises/matrices/applications/raytrace.html
- https://cseweb.ucsd.edu/classes/fa12/cse252A-a/hw2/hw2.pdf
How to create a Lambertian (diffuse) sphere
12 views (last 30 days)
Show older comments
Hello everyone, I need to generate the image of a Lambertian sphere in Matlab. A Lambertian surface differes from a specular one by the fact that it reflects light in all directions regardless the angle of incidence.
I saw that exists the function
R = diffuse(Nx,Ny,Nz,S)
where Nx, Ny and Nz are the surface's normal vector components. The problem is that I need to generate a sphere.
The result I want to achieve is the following:
The code I've written is:
[x,y,z] = sphere(100);
figure
h = surf(x,y,z,'FaceColor','w','FaceAlpha',1);
set(h,'edgecolor','none');
axis equal
ax = gca; set(ax,'Color','k');
light('Position',[1 0 0],'Style','infinite','Color','w');
lighting gouraud
but the result I get is:
0 Comments
Accepted Answer
Adam Danz
on 5 Oct 2020
There are probably official definitions and methods for a Lambertian diffuse sphere but here's something that looks like it.
[x,y,z] = sphere(100);
figure
h = surf(x,y,z,'FaceColor','w','FaceAlpha',1);
set(h,'edgecolor','none');
axis equal
ax = gca; set(ax,'Color','k');
light('Position',[-1 -2 0],'Style','infinite','Color','w');
lighting gouraud
h.BackFaceLighting = 'unlit';
h.DiffuseStrength = .6;
h.SpecularStrength = 0;
h.AmbientStrength = .07;
Potentially relevant literature
0 Comments
More Answers (0)
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!