Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified Admin/EpicSceneTest/Rhino/epic-scene-test.sh
100755 → 100644
Empty file.
Empty file modified Admin/ReleaseUtilities/create-release-tags.sh
100755 → 100644
Empty file.
File renamed without changes.
205 changes: 205 additions & 0 deletions Admin/mexopts/OSX-10.11-XCode-7.0-Matlab-2015b/mexopts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
#
# mexopts.sh Shell script for configuring MEX-file creation script,
# mex. These options were tested with the specified compiler.
#
# usage: Do not call this file directly; it is sourced by the
# mex shell script. Modify only if you don't like the
# defaults after running mex. No spaces are allowed
# around the '=' in the variable assignment.
#
# Note: For the version of system compiler supported with this release,
# refer to the Supported and Compatible Compiler List at:
# http://www.mathworks.com/support/compilers/current_release/
#
#
# SELECTION_TAGs occur in template option files and are used by MATLAB
# tools, such as mex and mbuild, to determine the purpose of the contents
# of an option file. These tags are only interpreted when preceded by '#'
# and followed by ':'.
#
#SELECTION_TAG_MEX_OPT: Template Options file for building MEX-files
#
# Copyright 1984-2011 The MathWorks, Inc.
#----------------------------------------------------------------------------
#
TMW_ROOT="$MATLAB"
MFLAGS=''
if [ "$ENTRYPOINT" = "mexLibrary" ]; then
MLIBS="-L$TMW_ROOT/bin/$Arch -lmx -lmex -lmat -lmwservices -lut"
else
MLIBS="-L$TMW_ROOT/bin/$Arch -lmx -lmex -lmat"
fi
case "$Arch" in
Undetermined)
#----------------------------------------------------------------------------
# Change this line if you need to specify the location of the MATLAB
# root directory. The script needs to know where to find utility
# routines so that it can determine the architecture; therefore, this
# assignment needs to be done while the architecture is still
# undetermined.
#----------------------------------------------------------------------------
MATLAB="$MATLAB"
;;
glnx86)
#----------------------------------------------------------------------------
echo "Error: Did not imbed 'options.sh' code"; exit 1 #imbed options.sh glnx86 12
#----------------------------------------------------------------------------
;;
glnxa64)
#----------------------------------------------------------------------------
RPATH="-Wl,-rpath-link,$TMW_ROOT/bin/$Arch"
# StorageVersion: 1.0
# CkeyName: GNU C
# CkeyManufacturer: GNU
# CkeyLanguage: C
# CkeyVersion:
# CkeyLinkerName: GNU ld
# CkeyLinkerVersion:
CC='gcc'
CFLAGS='-ansi -D_GNU_SOURCE'
CFLAGS="$CFLAGS -fexceptions"
CFLAGS="$CFLAGS -fPIC -fno-omit-frame-pointer -pthread"
CLIBS="$RPATH $MLIBS -lm"
COPTIMFLAGS='-O -DNDEBUG'
CDEBUGFLAGS='-g'
CLIBS="$CLIBS -lstdc++"
#
# C++keyName: GNU C++
# C++keyManufacturer: GNU
# C++keyLanguage: C++
# C++keyVersion:
# C++keyLinkerName: GNU ld
# C++keyLinkerVersion:
CXX='g++'
CXXFLAGS='-ansi -D_GNU_SOURCE'
CXXFLAGS="$CXXFLAGS -fPIC -fno-omit-frame-pointer -pthread"
CXXLIBS="$RPATH $MLIBS -lm"
CXXOPTIMFLAGS='-O -DNDEBUG'
CXXDEBUGFLAGS='-g'
#
# FortrankeyName: gfortran
# FortrankeyManufacturer: GNU
# FortrankeyLanguage: Fortran
# FortrankeyVersion:
# FortrankeyLinkerName: GNU ld
# FortrankeyLinkerVersion:
#
FC='gfortran'
FFLAGS='-fexceptions -fbackslash'
FFLAGS="$FFLAGS -fPIC -fno-omit-frame-pointer"
FLIBS="$RPATH $MLIBS -lm"
FOPTIMFLAGS='-O'
FDEBUGFLAGS='-g'
#
LD="$COMPILER"
LDEXTENSION='.mexa64'
LDFLAGS="-pthread -shared -Wl,--version-script,$TMW_ROOT/extern/lib/$Arch/$MAPFILE -Wl,--no-undefined"
LDOPTIMFLAGS='-O'
LDDEBUGFLAGS='-g'
#
POSTLINK_CMDS=':'
#----------------------------------------------------------------------------
;;
sol64)
#----------------------------------------------------------------------------
echo "Error: Did not imbed 'options.sh' code"; exit 1 #imbed options.sh sol64 12
#----------------------------------------------------------------------------
;;
mac)
#----------------------------------------------------------------------------
echo "Error: Did not imbed 'options.sh' code"; exit 1 #imbed options.sh mac 12
#----------------------------------------------------------------------------
;;
maci)
#----------------------------------------------------------------------------
echo "Error: Did not imbed 'options.sh' code"; exit 1 #imbed options.sh maci 12
#----------------------------------------------------------------------------
;;
maci64)
#----------------------------------------------------------------------------
# StorageVersion: 1.0
# CkeyName: Clang
# CkeyManufacturer: Apple
# CkeyLanguage: C
# CkeyVersion:
# CkeyLinkerName:
# CkeyLinkerVersion:
CC='xcrun -sdk macosx10.11 clang'
## workaround clang defect temporarily use line below SDKROOT='/Developer/SDKs/MacOSX10.6.sdk'
# compute SDK root on the fly
# target 10.8
MW_SDKROOT_TMP="find `xcode-select -print-path` -name MacOSX10.11.sdk"
MW_SDKROOT=`$MW_SDKROOT_TMP`
MACOSX_DEPLOYMENT_TARGET='10.11'
ARCHS='x86_64'
CFLAGS="-fno-common -arch $ARCHS -isysroot $MW_SDKROOT -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET"
CFLAGS="$CFLAGS -fexceptions"
CLIBS="$MLIBS"
COPTIMFLAGS='-O2 -DNDEBUG'
CDEBUGFLAGS='-g'
#
CLIBS="$CLIBS -lstdc++"
# C++keyName: Clang++
# C++keyManufacturer: Apple
# C++keyLanguage: C++
# C++keyVersion:
# C++keyLinkerName:
# C++keyLinkerVersion:
CXX='xcrun -sdk macosx10.11 clang++'
CXXFLAGS="-fno-common -fexceptions -arch $ARCHS -isysroot $MW_SDKROOT -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET"
CXXLIBS="$MLIBS -lstdc++"
CXXOPTIMFLAGS='-O2 -DNDEBUG'
CXXDEBUGFLAGS='-g'
#
# FortrankeyName: GNU Fortran
# FortrankeyManufacturer: GNU
# FortrankeyLanguage: Fortran
# FortrankeyVersion:
# FortrankeyLinkerName:
# FortrankeyLinkerVersion:
FC='gfortran'
FFLAGS='-fexceptions -m64 -fbackslash'
FC_LIBDIR=`$FC -print-file-name=libgfortran.dylib 2>&1 | sed -n '1s/\/*libgfortran\.dylib//p'`
FC_LIBDIR2=`$FC -print-file-name=libgfortranbegin.a 2>&1 | sed -n '1s/\/*libgfortranbegin\.a//p'`
FLIBS="$MLIBS -L$FC_LIBDIR -lgfortran -L$FC_LIBDIR2 -lgfortranbegin"
FOPTIMFLAGS='-O'
FDEBUGFLAGS='-g'
#
LD="$CC"
LDEXTENSION='.mexmaci64'
LDFLAGS="-arch $ARCHS -Wl,-syslibroot,$MW_SDKROOT -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET"
LDFLAGS="$LDFLAGS -bundle -Wl,-exported_symbols_list,$TMW_ROOT/extern/lib/$Arch/$MAPFILE"
# BSH - add linker flags! why were they missing?
LDFLAGS="$LDFLAGS $MLIBS"
LDOPTIMFLAGS='-O'
LDDEBUGFLAGS='-g'
#
POSTLINK_CMDS=':'
#----------------------------------------------------------------------------
;;
esac
#############################################################################
#
# Architecture independent lines:
#
# Set and uncomment any lines which will apply to all architectures.
#
#----------------------------------------------------------------------------
# CC="$CC"
# CFLAGS="$CFLAGS"
# COPTIMFLAGS="$COPTIMFLAGS"
# CDEBUGFLAGS="$CDEBUGFLAGS"
# CLIBS="$CLIBS"
#
# FC="$FC"
# FFLAGS="$FFLAGS"
# FOPTIMFLAGS="$FOPTIMFLAGS"
# FDEBUGFLAGS="$FDEBUGFLAGS"
# FLIBS="$FLIBS"
#
# LD="$LD"
# LDFLAGS="$LDFLAGS"
# LDOPTIMFLAGS="$LDOPTIMFLAGS"
# LDDEBUGFLAGS="$LDDEBUGFLAGS"
#----------------------------------------------------------------------------
#############################################################################
14 changes: 13 additions & 1 deletion BatchRenderer/Mappings/ResolveMappingsValues.m
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,19 @@
map.right.value = fileInfo.resolvedPath;

if ~fileInfo.isRootFolderMatch
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. I like what you did here. I think copying files to the resource folder could be useful in other cases as well. Would you be interested in making this a separate behavior, independent of the renderer or Docker?

We could define a separate hint like copyResources. Then it could be

if hints.copyResources

instead of

if(hints.dockerFlag == 0 || strcmp(hints.renderer,'Mitsuba'))

A downside would be that docker users would have to remember to set the value of this new flag. But I think it would be worth it to gain a nice, modular behavior.

disp(['Using absolute resource path: ' fileInfo.resolvedPath])
if(hints.dockerFlag == 0 || strcmp(hints.renderer,'Mitsuba'))
disp(['Using absolute resource path: ' fileInfo.resolvedPath])
else
% Copy absolute resources over to recipe folder
resources = GetWorkingFolder('resources', true, hints);
copyfile(fileInfo.resolvedPath,resources);
fprintf('Copied %s to %s \n',fileInfo.resolvedPath,resources);

% Rename path to be written in generated PBRT file. We
% specify with respect to the recipe root folder.
outputLoc = fullfile('resources',hints.renderer,fileInfo.verbatimName);
map.right.value = outputLoc;
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion ExampleScenes/Dragon/MakeDragonMaterials.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
%% Render with Mitsuba and PBRT.
toneMapFactor = 10;
isScale = true;
for renderer = {'PBRT', 'Mitsuba'}
for renderer = {'Mitsuba', 'PBRT'}
hints.renderer = renderer{1};
nativeSceneFiles = MakeSceneFiles(parentSceneFile, conditionsFile, mappingsFile, hints);
radianceDataFiles = BatchRender(nativeSceneFiles, hints);
Expand Down
Empty file modified ExampleScenes/LightFieldSphere/LightFieldSphere.dae
100755 → 100644
Empty file.
5 changes: 5 additions & 0 deletions RendererPlugins/PBRT/ColladaToPBRT/ConvertNode.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
case 'matrix'
value = getConvertedMatrix(colladaIDMap, childPath);
AddTransform(stubIDMap, id, childSid, 'ConcatTransform', value);

case 'lookat'
value = GetSceneValue(colladaIDMap, childPath);
AddTransform(stubIDMap, id, childSid, 'LookAt', value);

end
end

Expand Down
10 changes: 6 additions & 4 deletions RendererPlugins/PBRT/RTB_ImportCollada_PBRT.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@
[pbrtDoc, pbrtIDMap] = CreateStubDOM(colladaIDMap, 'pbrt_xml');
PopulateStubDOM(pbrtIDMap, colladaIDMap, hints);

% add a film node to the to the adjustments document
% make sure the adjustments document has a film node
filmNodeID = 'film';
filmPBRTIdentifier = 'Film';
adjustRoot = adjustments.docNode.getDocumentElement();
filmNode = CreateElementChild(adjustRoot, filmPBRTIdentifier, filmNodeID);
adjustments.idMap(filmNodeID) = filmNode;
if ~adjustments.idMap.isKey(filmNodeID)
adjustRoot = adjustments.docNode.getDocumentElement();
filmNode = CreateElementChild(adjustRoot, filmPBRTIdentifier, filmNodeID);
adjustments.idMap(filmNodeID) = filmNode;
end

% fill in the film parameters
SetType(adjustments.idMap, filmNodeID, filmPBRTIdentifier, hints.filmType);
Expand Down
56 changes: 48 additions & 8 deletions RendererPlugins/PBRT/RunPBRT.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,57 @@
output = fullfile(renderings, [sceneBase '.dat']);

%% Invoke PBRT.
% set the dynamic library search path
[newLibPath, originalLibPath, libPathName] = SetRenderToolboxLibraryPath();

% find the PBRT executable
renderCommand = sprintf('%s --outfile %s %s', pbrt.executable, output, sceneCopy);
fprintf('%s\n', renderCommand);
[status, result] = RunCommand(renderCommand, hints);
if(hints.dockerFlag == 1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. This is cool too.

May I propose 3 changes? I think these are just fussy organizational things.

  1. How about moving the dockerFlag into the pbrt struct, rather than hints struct. This would keep the Docker choice local to pbrt. We could think of the dockerFlag as roughly on the same level as the pbrt executable path, which is already in the pbrt struct.
  2. Instead of a true/false dockerFlag, what about a string field like dockerImageName? Then the literal value of vistalab/pbrt could be broken out and configured using this field instead of hard-coded into the function. Users could leave the field empty if they want to use local pbrt.
  3. What about moving the docker pull command into the RTB configuration script, rather than RunPBRT() itself?

If you're on board with these changes, you could edit RenderToolbox3ConfigurationTemplate to add expected fields to the pbrt struct and put the docker pull command there.

% We assume docker is installed on this system and we execute the
% function in a docker container
s = system('which docker');
if s
warning('Docker not found! \n (OSX) Are you sure you''re running MATLAB in a Docker Quickstart Terminal? ');
% TODO: add in option to run on local if docker is not found
else
% Initialize the docker container
dHub = 'vistalab/pbrt'; % Docker container at dockerhub
fprintf('Checking for most recent docker container\n');
system(sprintf('docker pull %s',dHub));

% Start the docker container that runs pbrt
dCommand = 'pbrt'; % Command run in the dockers
[~,n,e] = fileparts(sceneCopy); % Get name of pbrt input file
[~,outstem,outext] = fileparts(output); % Get name of output file

% We need this line because RTB wants to place the output in
% renderings and not just the recipe folder
outputFile = fullfile('renderings','PBRT',[outstem outext]);

% rm = clears the container when it is finished running
% -t = terminal to grab tty output
% -i = interactive (not sure it's needed)
cmd = sprintf('docker run -t -i --rm -v %s:/data %s %s /data/%s --outfile /data/%s',copyDir,dHub,dCommand,[n,e],outputFile);

% restore the library search path
setenv(libPathName, originalLibPath);
% Execute the docker call
[status,result] = system(cmd);
if status, error('Docker execution failure %s\n',result);
else disp('Docker appears to have run succesfully')
end
% disp(r);

% Tell the user where the result iss
fprintf('Wrote: %s\n',outputFile);
end
else
% Use local PBRT
% set the dynamic library search path
[newLibPath, originalLibPath, libPathName] = SetRenderToolboxLibraryPath();

% find the PBRT executable
renderCommand = sprintf('%s --outfile %s %s', pbrt.executable, output, sceneCopy);
fprintf('%s\n', renderCommand);
[status, result] = RunCommand(renderCommand, hints);

% restore the library search path
setenv(libPathName, originalLibPath);
end
%% Show a warning or figure?
if status ~= 0
warning(result)
Expand Down
10 changes: 9 additions & 1 deletion Utilities/BlenderPython/SceneUtilsV1.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,15 @@ def generateCameraType(self, params):
theCameraType = bpy.data.cameras.new('CAMERA');
# configure the camera type
theCameraType.type = 'PERSP' ; # perspective camera
theCameraType.angle = params['fieldOfViewInDegrees']/180*math.pi;
theCameraType.angle_x = params['fieldOfViewInDegrees']/180*math.pi;
if 'widthToHeightAspectRatio' in params:
print('before camera sensor: {} x {}; image resolution: {} x {}; horiz FOV = {}'.format(theCameraType.sensor_width, theCameraType.sensor_height, bpy.data.scenes[0].render.resolution_x, bpy.data.scenes[0].render.resolution_y, theCameraType.angle_x));
aspectRatio = theCameraType.sensor_width / theCameraType.sensor_height;
theCameraType.sensor_height = theCameraType.sensor_width / params['widthToHeightAspectRatio'];
bpy.data.scenes[0].render.resolution_x = params['pixelSamplesAlongWidth'];
bpy.data.scenes[0].render.resolution_y = bpy.data.scenes[0].render.resolution_x / params['widthToHeightAspectRatio'];
print('after camera sensor: {} x {}; image resolution: {} x {}; horiz FOV = {}'.format(theCameraType.sensor_width, theCameraType.sensor_height, bpy.data.scenes[0].render.resolution_x, bpy.data.scenes[0].render.resolution_y, theCameraType.angle_x));

theCameraType.clip_start = params['clipRange'][0];
theCameraType.clip_end = params['clipRange'][1];
theCameraType.draw_size = params['drawSize']; # apparent size of Camera object in 3D View
Expand Down
1 change: 1 addition & 0 deletions Utilities/InitializeRenderToolbox.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ function InitializeRenderToolbox(isForce)
defaultConfig.isParallel = false;
defaultConfig.isPlot = true;
defaultConfig.isCaptureCommandResults = true;
defaultConfig.dockerFlag = 0;

% default dynamic library path names and default values
% these are applied automatically, via SetRenderToolboxLibraryPath()
Expand Down