-
Notifications
You must be signed in to change notification settings - Fork 7
/
rtbExportTestScene.m
37 lines (30 loc) · 1.21 KB
/
rtbExportTestScene.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
% Sandbox to export the test scene from makeTestScene
%% Make and export the scene.
clear;
clc;
pathHere = fileparts(which('exportTestScene.m'));
scene = makeTestScene();
format = 'collada';
colladaFile = fullfile(pathHere, 'test-export.dae');
status = mexximpExport(scene, format, colladaFile, []);
%% Try to render with RenderToolbox4!
hints.imageWidth = 320;
hints.imageHeight = 240;
hints.recipeName = 'mexximpExportTest';
rtbChangeToWorkingFolder(hints);
setpref('Mitsuba', 'adjustments', which('scratch-mitsuba-adjustments.xml'));
setpref('PBRT', 'adjustments', which('scratch-pbrt-adjustments.xml'));
mappingsFile = which('scratch-mappings.txt');
%% Render with Mitsuba and PBRT.
toneMapFactor = 100;
isScale = true;
for renderer = {'PBRT', 'Mitsuba'}
hints.renderer = renderer{1};
nativeSceneFiles = rtbMakeSceneFiles(colladaFile, '', mappingsFile, hints);
radianceDataFiles = rtbBatchRender(nativeSceneFiles, hints);
montageName = sprintf('%s (%s)', hints.recipeName, hints.renderer);
montageFile = [montageName '.png'];
[SRGBMontage, XYZMontage] = ...
rtbMakeMontage(radianceDataFiles, montageFile, toneMapFactor, isScale, hints);
rtbShowXYZAndSRGB([], SRGBMontage, montageName);
end