diff --git a/Admin/EpicSceneTest/Rhino/epic-scene-test.sh b/Admin/EpicSceneTest/Rhino/epic-scene-test.sh old mode 100755 new mode 100644 diff --git a/Admin/ReleaseUtilities/create-release-tags.sh b/Admin/ReleaseUtilities/create-release-tags.sh old mode 100755 new mode 100644 diff --git a/Admin/mexopts/XCode-6.4-Matlab-2014b/mexopts.sh b/Admin/mexopts/OSX-10.10-XCode-6.4-Matlab-2014b/mexopts.sh old mode 100755 new mode 100644 similarity index 100% rename from Admin/mexopts/XCode-6.4-Matlab-2014b/mexopts.sh rename to Admin/mexopts/OSX-10.10-XCode-6.4-Matlab-2014b/mexopts.sh diff --git a/Admin/mexopts/OSX-10.11-XCode-7.0-Matlab-2015b/mexopts.sh b/Admin/mexopts/OSX-10.11-XCode-7.0-Matlab-2015b/mexopts.sh new file mode 100755 index 00000000..6def3bda --- /dev/null +++ b/Admin/mexopts/OSX-10.11-XCode-7.0-Matlab-2015b/mexopts.sh @@ -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" +#---------------------------------------------------------------------------- +############################################################################# diff --git a/BatchRenderer/Mappings/ResolveMappingsValues.m b/BatchRenderer/Mappings/ResolveMappingsValues.m index f795fb1a..83d9a73a 100644 --- a/BatchRenderer/Mappings/ResolveMappingsValues.m +++ b/BatchRenderer/Mappings/ResolveMappingsValues.m @@ -103,7 +103,19 @@ map.right.value = fileInfo.resolvedPath; if ~fileInfo.isRootFolderMatch - 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 diff --git a/ExampleScenes/Dragon/MakeDragonMaterials.m b/ExampleScenes/Dragon/MakeDragonMaterials.m index b4bf69be..cc2d34ce 100644 --- a/ExampleScenes/Dragon/MakeDragonMaterials.m +++ b/ExampleScenes/Dragon/MakeDragonMaterials.m @@ -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); diff --git a/ExampleScenes/LightFieldSphere/LightFieldSphere.dae b/ExampleScenes/LightFieldSphere/LightFieldSphere.dae old mode 100755 new mode 100644 diff --git a/RendererPlugins/PBRT/ColladaToPBRT/ConvertNode.m b/RendererPlugins/PBRT/ColladaToPBRT/ConvertNode.m index 1ae90bab..817f6919 100644 --- a/RendererPlugins/PBRT/ColladaToPBRT/ConvertNode.m +++ b/RendererPlugins/PBRT/ColladaToPBRT/ConvertNode.m @@ -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 diff --git a/RendererPlugins/PBRT/RTB_ImportCollada_PBRT.m b/RendererPlugins/PBRT/RTB_ImportCollada_PBRT.m index 868e01cf..d33b5a54 100644 --- a/RendererPlugins/PBRT/RTB_ImportCollada_PBRT.m +++ b/RendererPlugins/PBRT/RTB_ImportCollada_PBRT.m @@ -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); diff --git a/RendererPlugins/PBRT/RunPBRT.m b/RendererPlugins/PBRT/RunPBRT.m index 8227e27c..3af96caa 100644 --- a/RendererPlugins/PBRT/RunPBRT.m +++ b/RendererPlugins/PBRT/RunPBRT.m @@ -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) + % 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) diff --git a/Utilities/BlenderPython/SceneUtilsV1.py b/Utilities/BlenderPython/SceneUtilsV1.py index 1a96cdea..59b314c0 100644 --- a/Utilities/BlenderPython/SceneUtilsV1.py +++ b/Utilities/BlenderPython/SceneUtilsV1.py @@ -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 diff --git a/Utilities/InitializeRenderToolbox.m b/Utilities/InitializeRenderToolbox.m index e6d88cd5..d4e4f5a3 100644 --- a/Utilities/InitializeRenderToolbox.m +++ b/Utilities/InitializeRenderToolbox.m @@ -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()