how to create a transparent sphere

I have created a sphere using the [x,y,z} = sphere() function however, when I go to use alpha(.15) to try and add some transparency it just keeps giving me a dark sphere... I also tried using the following code;
[x,y,z] = sphere(128); colormap(hot(256)); shl = surfl(2*x,2*y,2*z); hold on; sh2 = surfl(2*x, y, 2*z); alpha(shl,.15) shading interp;
but this simply gives me two spheres one that is a block colour inside a larger transparent sphere. Any idea what the issue is
Many thanks

 채택된 답변

Thorsten
Thorsten 2013년 1월 22일
편집: Thorsten 2013년 1월 22일

1 개 추천

[x y z] = sphere(128);
h = surfl(x, y, z);
set(h, 'FaceAlpha', 0.5)
shading interp

댓글 수: 4

Bran
Bran 2013년 1월 22일
Hi there do I use this along with the sphere() function?
Thorsten
Thorsten 2013년 1월 22일
Yes. I added the code to my example.
Bran
Bran 2013년 1월 22일
Thanks so much Thorsten
Bran
Bran 2013년 1월 23일
Hi thorsten, I have come across an extension to this original problem. Instead of using x y and z to trace my sphere I would like to use values stored in a vector which have been sampled in the sphere and have retained this shape. However, I only have the indices of these values so my question is two-fold. How can I do the reverse of what is usual and that is find the value at particular indices rather than the other way around? And also how can I then use these values to trace out my transparent sphere?
Many many thanks for all your help :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

질문:

2013년 1월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by