Figure with image mapped to spherical background

18 views (last 30 days)
Hi, I am trying to make a 3-D plot which has a spherical background image. I have tried making a larger sphere that an image is mapped to, and then placing the other data to be plotted inside this sphere, and placing the camera inside the sphere. However when I do this the the figure displays as a circle, rather than the background image filling up the whole square area of the figure.
I have:
and my code is:
axis([-10 10 -10 10 -10 10])
[x,y,z]=sphere(50);
spherescale=10;
hold on
U_im=imread('esoMilkyway.jpg'); % Import texture data for Universe
Bg=surf((x*spherescale),(y*spherescale), (z*spherescale));
set(Bg,'facecolor','texturemap','cdata',U_im,'edgecolor','none');
daspect([1 1 1]);
campos([1 0 0]);
axis off
The effect that I am trying to reproduce can be seen at 20:45 in this video: https://uk.mathworks.com/videos/modeling-and-simulation-with-matlab-a-case-study-in-problem-based-learning-90422.html I'm sure I am just missing a simple solution but I have done lots of research on google and I can't find any examples of what I am trying to do.
Also, when I rotate the figure the camera moves itself out of the sphere which is also something I would like to stop happening. If anyone can help me out that would be greatly appreciated. Thanks!
  7 Comments
Daire Vickers
Daire Vickers on 21 May 2021
Edited: Daire Vickers on 21 May 2021
Thank you guys for your help, I just realised that in the image I shared the camera view angle is 170 degrees and thats why it looks weird. Adam I will review that documentation, it looks like it will be helpful as well! The image I am using is from here: https://www.eso.org/public/images/eso0932a/ and I have used it as a texture map for a sphere to be a spherical background.

Sign in to comment.

Answers (2)

Tiago Padovan
Tiago Padovan on 10 Sep 2021
Any update in this matter? I just started facing the same issue.
I have an animation where the camera rotates around the ISS (which I obtained from an STL file).
When I try adding an oversized sphere with the image of the night sky covering it and plot the other elemrnts inside it, it does not work. The image of the stars appears and it actually rotates as expected from a backgorund (oposite to the objects' rotation), but the objects insite are not visible...

Image Analyst
Image Analyst on 10 Sep 2021
See the examples in the documentation for pcshow() in the Computer Vision Toolbox.

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!