Clear Filters
Clear Filters

Render an accurate image of 3D Moon

8 views (last 30 days)
Mauro De Francesco
Mauro De Francesco on 28 Jun 2019
Edited: Mauro De Francesco on 28 Jun 2019
I want to create an accurate image of a 3D Moon model as if it were seen by a camera. I am using a rendering software to compare the image resulting (POV-Ray).
I am using the code below to produce the image on Matlab and the result is
With POV-Ray, setting the same value for distance of the moon and radius I obtain
I obtain with Matlab a smaller Moon with respect to the POV-ray one and I am sure that there is some camera issue that Matlab does not take into account, do you know which one of it should it be?
% Create Moon Ellipsoid
[x, y, z] = ellipsoid(MoonCam(1),MoonCam(2),MoonCam(3),...
R_moon(1),R_moon(2),R_moon(3),2000); % Moon ellipsoid centered at MoonCam
% Init Figure
figure()
axis equal
hold on
% Plot Moon Triaxial Ellipsoid with textures
planet = surf(x,y,z,'Edgecolor', 'none');
moon = imread('moon.jpg');
set(planet,'FaceColor','texturemap','Cdata', moon,'BackFaceLighting','unlit')
% Camera Settings
set(gca,'CameraPosition', [0 0 0], ... % Position of camera at LUMIO center
'CameraTarget',MoonCam,... % Target of camera
'CameraViewAngle',6,... % Field of view of the camera
'CameraUpVector',[0 1 0], ...% Camera Up vector (y axis)
'Projection','perspective', ... % Projection of ccamera
'visible','off',... % Untoggle axis
'Color','k',... % Set background color of the rectagle to black
'xdir','reverse') % Set x-axis positive toward right
% Image settings
set(gcf,'color','k',... % Set all background to black
'PaperUnits', 'centimeters',... % Units in centimeters
'PaperPosition',[0 0 8.67 8.67] ); % Set Image to 1024x1024 pixels (or 8.67x8.67 cm)

Answers (0)

Categories

Find more on Earth and Planetary Science 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!