Effacer les filtres
Effacer les filtres

Why can't I generate a sphere with a material?

1 vue (au cours des 30 derniers jours)
WEN SHIN LU
WEN SHIN LU le 30 Jan 2022
Modifié(e) : DGM le 30 Jan 2022
Hi!
The following is my code. I intended to generate a sphere with a material shiny but I could't make it. Can anyone to tell me what lines I need to put in or modify?
Thank you.
[X,Y,Z]= sphere;
x2 = X.*50;
y2 = Y.*50;
z2 = Z.*50;
h = surf(x2,y2,z2);
material shiny;
axis vis3d off
set(h,'LineWidth',1.5);
This is what I want. Shiny. But I can't make it.
sphere(50); shading flat;
light('Position',[1 3 2]);
light('Position',[-3 -1 3]);
material shiny;
axis vis3d off;

Réponse acceptée

DGM
DGM le 30 Jan 2022
Modifié(e) : DGM le 30 Jan 2022
Set up the lights.
[X,Y,Z]= sphere(20);
x2 = X.*50;
y2 = Y.*50;
z2 = Z.*50;
h = surf(x2,y2,z2);
light('Position',[1 3 2]);
light('Position',[-3 -1 3]);
material shiny;
axis vis3d off
FWIW, the default material is pretty shiny already, but you can always tweak the constants individually if you want.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by