diff --git a/README.md b/README.md index 30306dd..f8a9bf8 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ under an Apache 2.0 open source license. #### Requirements * Softimage 2015 SP1 -* Arnold 5.2.2.0 or newer +* Arnold 5.4.0.1 or newer * Python 2.6 or newer * Visual Studio 2012 (Windows) * GCC 4.2.4 (Linux) @@ -65,13 +65,15 @@ VS_HOME = r'C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC' WINDOWS_KIT = r'C:/Program Files (x86)/Windows Kits/8.0' XSISDK_ROOT = r'C:/Program Files/Autodesk/Softimage 2015/XSISDK' -ARNOLD_HOME = r'C:/SolidAngle/Arnold-5.2.2.0/win64' +ARNOLD_HOME = r'C:/SolidAngle/Arnold-5.4.0.1/win64' TARGET_WORKGROUP_PATH = r'./Softimage_2015/Addons/SItoA' WARN_LEVEL = 'strict' MODE = 'debug' SHOW_CMDS = True + +PATCH_ADLM = True ``` Default configuration files for Windows and Linux reside in `config`. If you diff --git a/SConstruct b/SConstruct index 5297b98..a272f64 100644 --- a/SConstruct +++ b/SConstruct @@ -20,7 +20,7 @@ import SCons def make_package(target, source, env): package_name = str(target[0]) + ".xsiaddon" zip_name = str(target[0]) - base_pkg_dir = os.path.join('dist', 'package_temp' + get_softimage_version(env['XSISDK_ROOT'])); + base_pkg_dir = os.path.join('dist', 'package_temp' + get_softimage_version(env['XSISDK_ROOT'])) # First we make sure the temp directory doesn't exist #if os.path.exists(base_pkg_dir): @@ -46,6 +46,10 @@ def make_package(target, source, env): for f in file_list: shutil.copy2(f, target_dir) + if env['PATCH_ADLM']: + wg_bin_path = os.path.join(base_pkg_dir, 'Addons', 'SItoA', bin_path) + patch_adlm(wg_bin_path, env) + # Now we generate deploy scripts f = open(os.path.join(base_pkg_dir, 'deploy_sitoa.js'), 'w') f.write(''' @@ -115,6 +119,8 @@ vars.AddVariables( BoolVariable('UPDATE_REFERENCE', 'Update the reference log/image for the specified targets', False), ('TEST_PATTERN' , 'Glob pattern of tests to be run', 'test_*'), + BoolVariable('PATCH_ADLM' , 'Patches AdLM so that SItoA doesn\'t crash. See GitHub #74 for background info.', False), + PathVariable('XSISDK_ROOT', 'Where to find XSI libraries', get_default_path('XSISDK_ROOT', '.')), PathVariable('ARNOLD_HOME', 'Base Arnold dir', '.'), PathVariable('VS_HOME', 'Visual Studio 11 home', '.'), @@ -403,6 +409,7 @@ PACKAGE_FILES = [ [os.path.join('plugins', 'helpers', '*.py'), os.path.join(addon_path, plugins_path)], [os.path.join('plugins', 'helpers', 'Pictures', '*.bmp'), os.path.join(addon_path, pictures_path)], [os.path.join('shaders', 'metadata', '*.mtd'), os.path.join(addon_path, bin_path)], +[os.path.join('plugins', 'metadata', '*.mtd'), os.path.join(addon_path, bin_path)], [os.path.join(ARNOLD_HOME, 'license', 'lmuti*'), os.path.join(addon_path, license_path)], [os.path.join(ARNOLD_HOME, 'license', 'rl*'), os.path.join(addon_path, license_path)], [os.path.join(ARNOLD_HOME, 'license', 'solidangle.*'), os.path.join(addon_path, license_path)], @@ -453,6 +460,72 @@ env['BUILDERS']['PackageDeploy'] = Builder(action = Action(deploy, "Deploying DEPLOY = env.PackageDeploy('deploy', package_name) +################################ +## PATCH ADLM +################################ + +def make_patch_adlm(target, source, env): + if env['PATCH_ADLM']: + wg_bin_path = os.path.normpath(os.path.join(env['TARGET_WORKGROUP_PATH'], bin_path)) + patch_adlm(wg_bin_path, env) + +def patch_adlm(wg_bin_path, env): + new_adlmint_last_char = '2' # ONLY ONE CHARACTER + if system.os() == 'windows': + adclmhub_name = 'AdClmHub_1.dll' + adlmint_name = 'adlmint.dll' + size = 383280 + seek_pos = 266236 + else: + adclmhub_name = 'libAdClmHub.so' + adlmint_name = 'libadlmint.so' + size = 1853576 + seek_pos = 779034 + + new_adlmint_name = os.path.splitext(adlmint_name)[0][:-1] + new_adlmint_last_char + get_library_extension() + + adclmhub_path = os.path.join(wg_bin_path, adclmhub_name) + adlmint_path = os.path.join(wg_bin_path, adlmint_name) + new_adlmint_path = os.path.join(wg_bin_path, new_adlmint_name) + + need_to_patch = False + + if os.path.isfile(adclmhub_path): + # check file size as a way to see if patching is needed + if os.path.getsize(adclmhub_path) == size: + need_to_patch = True + + if not os.path.isfile(adlmint_path): + need_to_patch = False + + if need_to_patch: + # patch AdClmHub_1 + with open(adclmhub_path, 'r+b') as f: + f.seek(seek_pos) + letter = f.read(1) + if letter == 't': + print 'Patching {} ...'.format(adclmhub_name) + f.seek(seek_pos) + f.write(new_adlmint_last_char) + print '{} patched!'.format(adclmhub_name) + else: + print '{} already patched. Skipping ...'.format(adclmhub_name) + + # rename adlmint.dll + if os.path.isfile(new_adlmint_path): + print 'Removing old {} ...'.format(new_adlmint_name) + os.remove(new_adlmint_path) + print 'Renaming {} to {} ...'.format(adlmint_name, new_adlmint_name) + os.rename(adlmint_path, new_adlmint_path) + + print 'done patching ADLM.' + + else: + print 'No need to patch.' + +env['BUILDERS']['Patch'] = Builder(action = Action(make_patch_adlm, None)) +PATCH = env.Patch('patch', SITOA) + ################################ ## INSTALL TO WORKGROUP ################################ @@ -461,7 +534,7 @@ env.Install(os.path.join(env['TARGET_WORKGROUP_PATH'], bin_path), [str(SITOA[0]) str(SITOA_SHADERS[0])]) env.Install(os.path.join(env['TARGET_WORKGROUP_PATH'], bin_path), [glob.glob(os.path.join(ARNOLD_BINARIES, '*'))]) -env.Install(os.path.join(env['TARGET_WORKGROUP_PATH'], bin_path, '..'), [glob.glob(ARNOLD_PLUGINS)]) +env.Install(os.path.join(env['TARGET_WORKGROUP_PATH'], bin_path, '..', 'plugins'), [glob.glob(os.path.join(ARNOLD_PLUGINS, '*'))]) # Copying Scripting Plugins # (if you modify the files directly on workgroup they will be overwritted with trunk version) @@ -475,6 +548,7 @@ env.Install(os.path.join(env['TARGET_WORKGROUP_PATH'], pictures_path), [glob.glo env.Install(os.path.join(env['TARGET_WORKGROUP_PATH'], license_path), [glob.glob(os.path.join(ARNOLD_HOME, 'license', '*'))]) env.Install(os.path.join(env['TARGET_WORKGROUP_PATH'], pit_path), [glob.glob(os.path.join(ARNOLD_HOME, 'license', 'pit', '*'))]) env.Install(os.path.join(env['TARGET_WORKGROUP_PATH'], bin_path), [glob.glob(os.path.join('shaders', 'metadata', '*.mtd'))]) +env.Install(os.path.join(env['TARGET_WORKGROUP_PATH'], bin_path), [glob.glob(os.path.join('plugins', 'metadata', '*.mtd'))]) ################################ ## TARGETS ALIASES AND DEPENDENCIES @@ -501,6 +575,7 @@ env.Depends(PACKAGE, SITOA_SHADERS) env.Depends(DEPLOY, PACKAGE) env.Depends('install', SITOA) env.Depends('install', SITOA_SHADERS) +env.Depends('install', PATCH) Default(['sitoa', 'shaders']) diff --git a/abuild.bat b/abuild.bat index 91d944b..429e709 100644 --- a/abuild.bat +++ b/abuild.bat @@ -1,3 +1,15 @@ +@echo off +set py=python + +REM Use python launcher if it's found in PATH. +WHERE py >nul 2>nul +IF NOT ERRORLEVEL 1 ( + set "py=py -2" +) + +@echo on + @REM invokes a local install of scons (forwarding all arguments) +@%py% contrib\scons\scons --site-dir=tools\site_scons %* -@python contrib\scons\scons --site-dir=tools\site_scons %* +@set py= diff --git a/config/custom_linux.py b/config/custom_linux.py index e39af3e..e6ba45e 100644 --- a/config/custom_linux.py +++ b/config/custom_linux.py @@ -6,7 +6,7 @@ SHCXX = r'/usr/bin/gcc-4.2.4/bin/gcc-4.2.4' XSISDK_ROOT = r'/usr/Softimage/Softimage_2015/XSISDK' -ARNOLD_HOME = r'/usr/SolidAngle/Arnold-5.2.2.1/linux' +ARNOLD_HOME = r'/usr/SolidAngle/Arnold-5.4.0.1/linux' TARGET_WORKGROUP_PATH = './Softimage_2015/Addons/SItoA' diff --git a/config/custom_windows.py b/config/custom_windows.py index f622202..61cd468 100644 --- a/config/custom_windows.py +++ b/config/custom_windows.py @@ -9,10 +9,12 @@ WINDOWS_KIT = r'C:/Program Files (x86)/Windows Kits/8.0' XSISDK_ROOT = r'C:/Program Files/Autodesk/Softimage 2015/XSISDK' -ARNOLD_HOME = r'C:/SolidAngle/Arnold-5.2.2.1/win64' +ARNOLD_HOME = r'C:/SolidAngle/Arnold-5.4.0.1/win64' TARGET_WORKGROUP_PATH = r'./Softimage_2015/Addons/SItoA' WARN_LEVEL = 'strict' MODE = 'opt' SHOW_CMDS = True + +PATCH_ADLM = True diff --git a/plugins/helpers/ArnoldLightShaderDef.js b/plugins/helpers/ArnoldLightShaderDef.js index c03bd54..7dd41f7 100644 --- a/plugins/helpers/ArnoldLightShaderDef.js +++ b/plugins/helpers/ArnoldLightShaderDef.js @@ -49,7 +49,7 @@ function XSIUnloadPlugin(in_reg) var lightLabelMinPixels = 100; var lightLabelPcg = 25; -function LightCommonParams(in_params, in_normalize, in_exposeColor, in_is_skydome) +function LightCommonParams(in_params, in_normalize, in_exposeColor, in_has_visibility, in_visible) { var h = SItoAShaderDefHelpers(); // helper object h.AddColor3 (in_params, "color", 1, 1, 1, true, in_exposeColor, true, h.UiLightColorGuid); @@ -64,10 +64,13 @@ function LightCommonParams(in_params, in_normalize, in_exposeColor, in_is_skydom h.AddColor3 (in_params, "shadow_color", 0, 0, 0, true, false, true); h.AddScalar (in_params, "shadow_density", 1, 0, 1000000, 0, 1, true, false, true); - if (in_is_skydome) + if (in_has_visibility) { - h.AddScalar (in_params, "camera", 1, 0, 1, 0, 1, true, false, true); - h.AddScalar (in_params, "transmission", 1, 0, 1, 0, 1, true, false, true); + var default_visibility = 0; + if (in_visible) + default_visibility = 1; + h.AddScalar (in_params, "camera", default_visibility, 0, 1, 0, 1, true, false, true); + h.AddScalar (in_params, "transmission", default_visibility, 0, 1, 0, 1, true, false, true); } h.AddScalar (in_params, "diffuse", 1, 0, 1, 0, 1, true, false, true); h.AddScalar (in_params, "specular", 1, 0, 1, 0, 1, true, false, true); @@ -98,10 +101,10 @@ function LightCommonLayoutColor(in_layout) in_layout.EndGroup(); } -function LightCommonLayoutContribution(in_layout, in_is_skydome) +function LightCommonLayoutContribution(in_layout, in_has_visibility) { in_layout.AddGroup("Contribution"); - if (in_is_skydome) + if (in_has_visibility) { item = in_layout.AddItem("camera", "Camera"); SetLabelPixelsAndPcg(item, lightLabelMinPixels, lightLabelPcg); @@ -261,7 +264,7 @@ function ArnoldLightShaders_arnold_cylinder_light_1_0_Define(in_ctxt) // INPUT params = shaderDef.InputParamDefs; - LightCommonParams(params, true, false, false); + LightCommonParams(params, true, false, true, false); // OUTPUT h.AddOutputColor4(shaderDef.OutputParamDefs); @@ -278,7 +281,7 @@ function arnold_cylinder_light_Layout(in_layout) in_layout.SetAttribute(siUIHelpFile, "https://support.solidangle.com/display/A5SItoAUG/Cylinder+Light"); LightCommonLayoutColor(in_layout); - LightCommonLayoutContribution(in_layout, false); + LightCommonLayoutContribution(in_layout, true); in_layout.AddGroup("Area"); LightCommonLayoutArea(in_layout); in_layout.EndGroup(); @@ -304,7 +307,7 @@ function ArnoldLightShaders_arnold_disk_light_1_0_Define(in_ctxt) // INPUT params = shaderDef.InputParamDefs; - LightCommonParams(params, true, false, false); + LightCommonParams(params, true, false, true, false); h.AddScalar(params, "spread", 1, 0, 1, 0, 1, true, false, true); // OUTPUT @@ -321,7 +324,7 @@ function arnold_disk_light_Layout(in_layout) in_layout.Clear(); in_layout.SetAttribute(siUIHelpFile, "https://support.solidangle.com/display/A5SItoAUG/Disk+Light"); LightCommonLayoutColor(in_layout); - LightCommonLayoutContribution(in_layout, false); + LightCommonLayoutContribution(in_layout, true); in_layout.AddGroup("Area"); LightCommonLayoutArea(in_layout); item = in_layout.AddItem("spread", "Spread"); @@ -350,7 +353,7 @@ function ArnoldLightShaders_arnold_distant_light_1_0_Define(in_ctxt) // INPUT params = shaderDef.InputParamDefs; - LightCommonParams(params, true, false, false); + LightCommonParams(params, true, false, false, false); h.AddScalar(params, "angle", 0, 0, 180, 0, 10, true, false, true); // OUTPUT @@ -395,7 +398,7 @@ function ArnoldLightShaders_arnold_mesh_light_1_0_Define(in_ctxt) // INPUT params = shaderDef.InputParamDefs; - LightCommonParams(params, true, true, false); + LightCommonParams(params, true, true, false, false); // OUTPUT h.AddOutputColor4(shaderDef.OutputParamDefs); @@ -438,7 +441,7 @@ function ArnoldLightShaders_arnold_photometric_light_1_0_Define(in_ctxt) // INPUT params = shaderDef.InputParamDefs; - LightCommonParams(params, true, false, false); + LightCommonParams(params, true, false, false, false); h.AddLightProfile(params, "filename"); h.AddScalar(params, "radius", 0, 0, 1000000, 0, 2, true, false, true); @@ -490,7 +493,7 @@ function ArnoldLightShaders_arnold_point_light_1_0_Define(in_ctxt) // INPUT params = shaderDef.InputParamDefs; - LightCommonParams(params, true, false, false); + LightCommonParams(params, true, false, true, false); h.AddScalar (params, "radius", 0, 0, 1000000, 0, 10, true, false, true); // OUTPUT @@ -508,7 +511,7 @@ function arnold_point_light_Layout(in_layout) in_layout.SetAttribute(siUIHelpFile, "https://support.solidangle.com/display/A5SItoAUG/Point+Light"); LightCommonLayoutColor(in_layout); - LightCommonLayoutContribution(in_layout, false); + LightCommonLayoutContribution(in_layout, true); in_layout.AddGroup("Area"); item = in_layout.AddItem("radius", "Radius"); SetLabelPixelsAndPcg(item, lightLabelMinPixels, lightLabelPcg); @@ -536,7 +539,7 @@ function ArnoldLightShaders_arnold_quad_light_1_0_Define(in_ctxt) // INPUT params = shaderDef.InputParamDefs; - LightCommonParams(params, true, true, false); + LightCommonParams(params, true, true, true, false); h.AddInteger(params, "resolution", 512, 1, 1000000, 1, 4096, true, false, true); h.AddScalar(params, "spread", 1, 0, 1, 0, 1, true, false, true); h.AddBoolean(params, "portal", false, true, false, true); @@ -558,7 +561,7 @@ function arnold_quad_light_Layout(in_layout) in_layout.SetAttribute(siUIHelpFile, "https://support.solidangle.com/display/A5SItoAUG/Quad+Light"); LightCommonLayoutColor(in_layout); - LightCommonLayoutContribution(in_layout, false); + LightCommonLayoutContribution(in_layout, true); in_layout.AddGroup("Area"); item = in_layout.AddItem("portal", "Portal"); SetLabelPixelsAndPcg(item, lightLabelMinPixels, lightLabelPcg); @@ -595,7 +598,7 @@ function ArnoldLightShaders_arnold_skydome_light_1_0_Define(in_ctxt) // INPUT params = shaderDef.InputParamDefs; - LightCommonParams(params, false, true, true); // no "normalize" param, yes texturable color, yes camera and transmission + LightCommonParams(params, false, true, true, true); // no "normalize" param, yes texturable color, yes camera and transmission, yes camera and transmission on by default h.AddInteger(params, "resolution", 1000, 1, 1000000, 1, 4096, true, false, true); h.AddInteger(params, "format", 1, 0, 2, 0, 2, true, false, true); h.AddInteger(params, "portal_mode", 1, 0, 2, 0, 2, true, false, true); @@ -655,7 +658,7 @@ function ArnoldLightShaders_arnold_spot_light_1_0_Define(in_ctxt) // INPUT params = shaderDef.InputParamDefs; - LightCommonParams(params, true, false, false); + LightCommonParams(params, true, false, false, false); h.AddScalar(params, "radius", 0, 0, 1000000, 0, 10, true, false, true); h.AddScalar(params, "lens_radius", 0, 0, 1000000, 0, 10); h.AddScalar(params, "cone_angle", 65, 0, 1000000, 0, 100); diff --git a/plugins/helpers/ArnoldLights.js b/plugins/helpers/ArnoldLights.js index cbd9bf8..5d70ab3 100644 --- a/plugins/helpers/ArnoldLights.js +++ b/plugins/helpers/ArnoldLights.js @@ -75,8 +75,8 @@ function AddPointLight_Execute(in_name) light.Parameters("LightArea").value = true; light.Parameters("LightAreaGeom").value = 3; // Mapping Arnold Light Parameter to XSI Light Parameter.. - var spotRadius = light.Parameters("LightAreaXformSX"); - spotRadius.AddExpression(light.FullName+".light.arnold_point_light.radius"); + var lightRadius = light.Parameters("LightAreaXformSX"); + lightRadius.AddExpression("this.light.point_light.radius"); return light; // return the light } @@ -110,8 +110,10 @@ function AddSpotLight_Execute(in_name) ApplyLightShader(lightPrim, "arnold_spot_light"); // Mapping Arnold Light Parameters to XSI Light Parameters.. - var spotRadius = lightPrim.Parameters("LightAreaXformSX"); - spotRadius.AddExpression(lightPrim.FullName+".light.arnold_spot_light.radius") + var coneAngle = lightPrim.Parameters("LightCone"); + coneAngle.AddExpression("this.light.spot_light.cone_angle"); + var lightRadius = lightPrim.Parameters("LightAreaXformSX"); + lightRadius.AddExpression("this.light.spot_light.radius"); lightPrim.LightArea = true; lightPrim.LightAreaGeom = 2; return lightPrim; @@ -143,6 +145,8 @@ function AddQuadLight_Execute(in_name) var name = in_name == null ? "Quad" : in_name; var light = GetPrimLight("Light_Box.Preset", name, "", null, null, null); var lightPrim = light.Light; + var lightType = lightPrim.Parameters("Type"); + lightType.Value = 1; // Infinite light gizmo ApplyLightShader(lightPrim, "arnold_quad_light"); return lightPrim; diff --git a/plugins/helpers/ArnoldMenu.js b/plugins/helpers/ArnoldMenu.js index 741141f..80a2dc7 100644 --- a/plugins/helpers/ArnoldMenu.js +++ b/plugins/helpers/ArnoldMenu.js @@ -278,7 +278,9 @@ function AddShadersSubMenu(in_menu) in_menu.AddSeparatorItem(); in_menu.AddCallbackItem("Standard Volume", "OnShadersMenu"); in_menu.AddSeparatorItem(); - in_menu.AddCallbackItem("Physical Sky", "OnShadersMenu"); + in_menu.AddCallbackItem("Physical Sky", "OnShadersMenu"); + in_menu.AddSeparatorItem(); + in_menu.AddCallbackItem("Clip Geo", "OnShadersMenu"); } @@ -290,6 +292,8 @@ function ArnoldPassShaders_Init(io_Context) xsiMenu.AddCallbackItem("Fog", "OnShadersMenu"); xsiMenu.AddSeparatorItem(); xsiMenu.AddCallbackItem("Cryptomatte", "OnShadersMenu"); + xsiMenu.AddSeparatorItem(); + xsiMenu.AddCallbackItem("Operator", "OnShadersMenu"); } // lights sub-menu @@ -516,6 +520,12 @@ function OnShadersMenu(in_ctxt) case "Cryptomatte": SITOA_AddShaderStack("Arnold.cryptomatte.1.0", "OutputShaderStack"); break; + case "Operator": + SITOA_AddShaderStack("Arnold.operator.1.0", "OutputShaderStack"); + break; + case "Clip Geo": + SITOA_AddShader("Arnold.clip_geo.1.0", "surface"); + break; } } diff --git a/plugins/helpers/ArnoldProperties.js b/plugins/helpers/ArnoldProperties.js index 68e2743..7a1fd95 100644 --- a/plugins/helpers/ArnoldProperties.js +++ b/plugins/helpers/ArnoldProperties.js @@ -510,6 +510,7 @@ function AddParamsShape(in_prop) in_prop.AddParameter2("self_shadows", siBool, 1, 0, 1, 0, 5, 0, siPersistable|siAnimatable); in_prop.AddParameter2("receive_shadows", siBool, 1, 0, 1, 0, 5, 0, siPersistable|siAnimatable); in_prop.AddParameter2("export_pref", siBool, false, null, null, null, null); + in_prop.AddParameter2("export_nref", siBool, false, null, null, null, null); in_prop.AddParameter2("subdiv_smooth_derivs", siBool, false, null, null, null, null); in_prop.AddParameter2("sss_setname", siString, "", null, null, null, null, 0, siPersistable|siAnimatable); in_prop.AddParameter2("toon_id", siString, "", null, null, null, null, 0, siPersistable|siAnimatable); @@ -541,7 +542,15 @@ function AddParamsSubdivision(in_prop, strands) in_prop.AddParameter2("disp_padding", siFloat, 0.0, -100000, 100000, 0.0, 10.0, 0, siPersistable|siAnimatable); in_prop.AddParameter2("subdiv_iterations", siInt4, 0, 0, 255, 0, 10, 0, siPersistable|siAnimatable); in_prop.AddParameter2("subdiv_adaptive_error", siFloat, 2.0, 0.0, 100.0, 0.0, 10.0, 0, siPersistable|siAnimatable); - in_prop.AddParameter2("disp_autobump", siBool, 1, 0, 1, 0, 1, 0, siPersistable|siAnimatable); + + in_prop.AddParameter2("disp_autobump", siBool, 1, 0, 1, 0, 1, 0, siPersistable|siAnimatable); + in_prop.AddParameter2("autobump_camera", siBool, 1, 0, 1, 0, 1, 0, siPersistable|siAnimatable); + in_prop.AddParameter2("autobump_diffuse_reflection", siBool, 0, 0, 1, 0, 1, 0, siPersistable|siAnimatable); + in_prop.AddParameter2("autobump_specular_reflection", siBool, 0, 0, 1, 0, 1, 0, siPersistable|siAnimatable); + in_prop.AddParameter2("autobump_diffuse_transmission", siBool, 0, 0, 1, 0, 1, 0, siPersistable|siAnimatable); + in_prop.AddParameter2("autobump_specular_transmission", siBool, 0, 0, 1, 0, 1, 0, siPersistable|siAnimatable); + in_prop.AddParameter2("autobump_volume_scattering", siBool, 0, 0, 1, 0, 1, 0, siPersistable|siAnimatable); + in_prop.AddParameter2("adaptive_subdivision", siBool, 0, 0, 1, 0, 1, 0, siPersistable|siAnimatable); in_prop.AddParameter2("subdiv_adaptive_metric", siString, "auto", null, null, null, null, 0, siPersistable|siAnimatable); in_prop.AddParameter2("subdiv_adaptive_space", siString, "raster", null, null, null, null, 0, siPersistable|siAnimatable); @@ -678,7 +687,8 @@ function arnold_parameters_DefineLayout(io_Context) xsiLayout.AddItem("invert_normals", "Invert Normals"); xsiLayout.AddItem("self_shadows", "Self Shadows"); xsiLayout.AddItem("receive_shadows", "Receive Shadows"); - xsiLayout.AddItem("export_pref", "Export Bind Pose (Pref)"); + xsiLayout.AddItem("export_pref", "Export Bind Pose Positions (Pref)"); + xsiLayout.AddItem("export_nref", "Export Bind Pose Normals (Nref)"); xsiLayout.AddItem("subdiv_smooth_derivs", "Smooth Subdiv Tangents"); xsiLayout.EndGroup(); @@ -726,7 +736,15 @@ function arnold_parameters_DefineLayout(io_Context) item = xsiLayout.AddItem("disp_zero_value", "Zero Value"); item.setAttribute(siUILabelMinPixels, 130); item.SetAttribute(siUILabelPercentage, 50); - item = xsiLayout.AddItem("disp_autobump", "AutoBump"); + item = xsiLayout.AddItem("disp_autobump", "Autobump"); + xsiLayout.AddGroup("Autobump Visibility", true); + item = xsiLayout.AddItem("autobump_camera", "Camera (primary)"); + item = xsiLayout.AddItem("autobump_diffuse_reflection", "Diffuse Reflection"); + item = xsiLayout.AddItem("autobump_specular_reflection", "Specular Reflection"); + item = xsiLayout.AddItem("autobump_diffuse_transmission", "Diffuse Transmission"); + item = xsiLayout.AddItem("autobump_specular_transmission", "Specular Transmission"); + item = xsiLayout.AddItem("autobump_volume_scattering", "Volume Scattering"); + xsiLayout.EndGroup(); xsiLayout.EndGroup(); xsiLayout.AddGroup("Subdivision", true); item = xsiLayout.AddItem("subdiv_iterations", "Additional Iterations"); @@ -1159,6 +1177,9 @@ function arnold_parameters_OnInit() var oCustomProperty = PPG.Inspected.Item(0); if (oCustomProperty.Parameters("override_motion_step") != null) arnold_parameters_override_motion_step_OnChanged(); + + if (oCustomProperty.Parameters("disp_autobump") != null) + arnold_parameters_disp_autobump_OnChanged(); if (oCustomProperty.Parameters("adaptive_subdivision") != null) arnold_parameters_adaptive_subdivision_OnChanged(); @@ -1202,6 +1223,20 @@ function arnold_parameters_motion_deform_OnChanged() arnold_parameters_override_motion_step_OnChanged(); } +function arnold_parameters_disp_autobump_OnChanged() +{ + var oCustomProperty = PPG.Inspected.Item(0); + var autobump_on = PPG.disp_autobump.Value; + if (oCustomProperty.Parameters("autobump_camera") != null) + { + PPG.autobump_camera.Enable(autobump_on); + PPG.autobump_diffuse_reflection.Enable(autobump_on); + PPG.autobump_specular_reflection.Enable(autobump_on); + PPG.autobump_diffuse_transmission.Enable(autobump_on); + PPG.autobump_specular_transmission.Enable(autobump_on); + PPG.autobump_volume_scattering.Enable(autobump_on); + } +} function arnold_parameters_adaptive_subdivision_OnChanged() { diff --git a/plugins/helpers/ArnoldScenePreferences.js b/plugins/helpers/ArnoldScenePreferences.js index b7eeca1..c0253d3 100644 --- a/plugins/helpers/ArnoldScenePreferences.js +++ b/plugins/helpers/ArnoldScenePreferences.js @@ -74,8 +74,22 @@ function SetSceneForArnold() SIConnectShaderToCnxPoint(shader, light.ActivePrimitive + ".LightShader", true); DisconnectAndDeleteOrUnnestShaders("light.light.soft_light", "light.light"); + SetValue(shader + ".intensity", 4.0, ""); + SetValue(shader + ".angle", 0.53, ""); } + // Modify Scene_Material to use standard_surface + var sceneMaterial = Dictionary.GetObject("Sources.Materials.DefaultLib.Scene_Material"); + var currentShader = sceneMaterial.Surface.Source.Parent; + if (currentShader.Name == "Phong") + { + var shader = CreateShaderFromProgID("Arnold.standard_surface.1.0", sceneMaterial, null); + var closure = CreateShaderFromProgID("Arnold.closure.1.0", sceneMaterial, null); + SIConnectShaderToCnxPoint(shader, closure.closure, false); + SIConnectShaderToCnxPoint(closure, sceneMaterial.Surface, false); + DisconnectAndDeleteOrUnnestShaders(sceneMaterial + ".Phong", sceneMaterial); + } + // Use pass render options as the view render options are not supported for the moment SetValue("Views.ViewA.RenderRegion.UsePassOptions,Views.ViewB.RenderRegion.UsePassOptions,"+ "Views.ViewC.RenderRegion.UsePassOptions,Views.ViewD.RenderRegion.UsePassOptions", diff --git a/plugins/helpers/ArnoldShaderDef.js b/plugins/helpers/ArnoldShaderDef.js index 5ee9f3c..0f60aa8 100644 --- a/plugins/helpers/ArnoldShaderDef.js +++ b/plugins/helpers/ArnoldShaderDef.js @@ -24,6 +24,10 @@ function XSILoadPlugin( in_reg ) in_reg.RegisterShader("abs", 1, 0); in_reg.RegisterShader("add", 1, 0); in_reg.RegisterShader("ambient_occlusion", 1, 0); + in_reg.RegisterShader("aov_read_float", 1, 0); + in_reg.RegisterShader("aov_read_int", 1, 0); + in_reg.RegisterShader("aov_read_rgb", 1, 0); + in_reg.RegisterShader("aov_read_rgba", 1, 0); in_reg.RegisterShader("aov_write_float", 1, 0); in_reg.RegisterShader("aov_write_int", 1, 0); in_reg.RegisterShader("aov_write_rgb", 1, 0); @@ -39,13 +43,14 @@ function XSILoadPlugin( in_reg ) in_reg.RegisterShader("cell_noise", 1, 0); in_reg.RegisterShader("checkerboard", 1, 0); in_reg.RegisterShader("clamp", 1, 0); + in_reg.RegisterShader("clip_geo", 1, 0); in_reg.RegisterShader("closure", 1, 0); // SItoA in_reg.RegisterShader("color_convert", 1, 0); in_reg.RegisterShader("color_correct", 1, 0); in_reg.RegisterShader("color_jitter", 1, 0); in_reg.RegisterShader("compare", 1, 0); in_reg.RegisterShader("complement", 1, 0); - in_reg.RegisterShader("complex_ior", 1, 0); + in_reg.RegisterShader("complex_ior", 1, 0); // deprecated in_reg.RegisterShader("composite", 1, 0); in_reg.RegisterShader("cross", 1, 0); in_reg.RegisterShader("cryptomatte", 1, 0); @@ -71,6 +76,7 @@ function XSILoadPlugin( in_reg ) in_reg.RegisterShader("layer_shader", 1, 0); in_reg.RegisterShader("length", 1, 0); in_reg.RegisterShader("log", 1, 0); + in_reg.RegisterShader("matrix_interpolate", 1, 0); in_reg.RegisterShader("matrix_multiply_vector", 1, 0); in_reg.RegisterShader("matrix_transform", 1, 0); in_reg.RegisterShader("matte", 1, 0); @@ -129,6 +135,7 @@ function XSILoadPlugin( in_reg ) in_reg.RegisterShader("user_data_rgba", 1, 0); in_reg.RegisterShader("user_data_string", 1, 0); in_reg.RegisterShader("utility", 1, 0); + in_reg.RegisterShader("uv_projection", 1, 0); in_reg.RegisterShader("uv_transform", 1, 0); in_reg.RegisterShader("vector_displacement", 1, 0); // extra, clone of vector_map with float output in_reg.RegisterShader("vector_map", 1, 0); @@ -137,6 +144,16 @@ function XSILoadPlugin( in_reg ) in_reg.RegisterShader("volume_sample_float", 1, 0); in_reg.RegisterShader("volume_sample_rgb", 1, 0); in_reg.RegisterShader("wireframe", 1, 0); + // operators + in_reg.RegisterShader("disable", 1, 0); + in_reg.RegisterShader("collection", 1, 0); + in_reg.RegisterShader("include_graph", 1, 0); + in_reg.RegisterShader("materialx", 1, 0); + in_reg.RegisterShader("merge", 1, 0); + in_reg.RegisterShader("operator", 1, 0); + in_reg.RegisterShader("set_parameter", 1, 0); + in_reg.RegisterShader("set_transform", 1, 0); + in_reg.RegisterShader("switch_operator", 1, 0); // in_reg.Help = "https://support.solidangle.com/display/A5SItoAUG/Shaders"; @@ -151,6 +168,14 @@ function Arnold_add_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_add_1_0_Define(in_ctxt) { return true; } function Arnold_ambient_occlusion_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_ambient_occlusion_1_0_Define(in_ctxt) { return true; } +function Arnold_aov_read_float_1_0_DefineInfo(in_ctxt) { return true; } +function Arnold_aov_read_float_1_0_Define(in_ctxt) { return true; } +function Arnold_aov_read_int_1_0_DefineInfo(in_ctxt) { return true; } +function Arnold_aov_read_int_1_0_Define(in_ctxt) { return true; } +function Arnold_aov_read_rgb_1_0_DefineInfo(in_ctxt) { return true; } +function Arnold_aov_read_rgb_1_0_Define(in_ctxt) { return true; } +function Arnold_aov_read_rgba_1_0_DefineInfo(in_ctxt) { return true; } +function Arnold_aov_read_rgba_1_0_Define(in_ctxt) { return true; } function Arnold_aov_write_float_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_aov_write_float_1_0_Define(in_ctxt) { return true; } function Arnold_aov_write_int_1_0_DefineInfo(in_ctxt) { return true; } @@ -181,6 +206,8 @@ function Arnold_checkerboard_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_checkerboard_1_0_Define(in_ctxt) { return true; } function Arnold_clamp_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_clamp_1_0_Define(in_ctxt) { return true; } +function Arnold_clip_geo_1_0_DefineInfo(in_ctxt) { return true; } +function Arnold_clip_geo_1_0_Define(in_ctxt) { return true; } function Arnold_closure_1_0_DefineInfo(in_ctxt) { return true; } // SItoA function Arnold_closure_1_0_Define(in_ctxt) { return true; } // SItoA function Arnold_color_convert_1_0_DefineInfo(in_ctxt) { return true; } @@ -193,8 +220,8 @@ function Arnold_compare_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_compare_1_0_Define(in_ctxt) { return true; } function Arnold_complement_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_complement_1_0_Define(in_ctxt) { return true; } -function Arnold_complex_ior_1_0_DefineInfo(in_ctxt) { return true; } -function Arnold_complex_ior_1_0_Define(in_ctxt) { return true; } +function Arnold_complex_ior_1_0_DefineInfo(in_ctxt) { return true; } // deprecated +function Arnold_complex_ior_1_0_Define(in_ctxt) { return true; } // deprecated function Arnold_composite_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_composite_1_0_Define(in_ctxt) { return true; } function Arnold_cross_1_0_DefineInfo(in_ctxt) { return true; } @@ -245,6 +272,8 @@ function Arnold_length_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_length_1_0_Define(in_ctxt) { return true; } function Arnold_log_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_log_1_0_Define(in_ctxt) { return true; } +function Arnold_matrix_interpolate_1_0_DefineInfo(in_ctxt) { return true; } +function Arnold_matrix_interpolate_1_0_Define(in_ctxt) { return true; } function Arnold_matrix_multiply_vector_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_matrix_multiply_vector_1_0_Define(in_ctxt) { return true; } function Arnold_matrix_transform_1_0_DefineInfo(in_ctxt) { return true; } @@ -277,7 +306,7 @@ function Arnold_osl_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_osl_1_0_Define(in_ctxt) { return true; } function Arnold_passthrough_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_passthrough_1_0_Define(in_ctxt) { return true; } -// function Arnold_physical_sky_1_0_DefineInfo(in_ctxt) { return true; } +function Arnold_physical_sky_1_0_DefineInfo(in_ctxt) { return true; } // function Arnold_physical_sky_1_0_Define(in_ctxt) { return true; } function Arnold_pow_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_pow_1_0_Define(in_ctxt) { return true; } @@ -361,6 +390,8 @@ function Arnold_user_data_string_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_user_data_string_1_0_Define(in_ctxt) { return true; } function Arnold_utility_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_utility_1_0_Define(in_ctxt) { return true; } +function Arnold_uv_projection_1_0_DefineInfo(in_ctxt) { return true; } +function Arnold_uv_projection_1_0_Define(in_ctxt) { return true; } function Arnold_uv_transform_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_uv_transform_1_0_Define(in_ctxt) { return true; } function Arnold_vector_displacement_1_0_DefineInfo(in_ctxt) { return true; } // extra, clone of vector_map with float output @@ -377,44 +408,33 @@ function Arnold_volume_sample_rgb_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_volume_sample_rgb_1_0_Define(in_ctxt) { return true; } function Arnold_wireframe_1_0_DefineInfo(in_ctxt) { return true; } function Arnold_wireframe_1_0_Define(in_ctxt) { return true; } - + +// operators +function Arnold_collection_1_0_DefineInfo(in_ctxt) { return true; } +function Arnold_collection_1_0_Define(in_ctxt) { return true; } +function Arnold_disable_1_0_DefineInfo(in_ctxt) { return true; } +function Arnold_disable_1_0_Define(in_ctxt) { return true; } +function Arnold_include_graph_1_0_DefineInfo(in_ctxt) { return true; } +function Arnold_include_graph_1_0_Define(in_ctxt) { return true; } +function Arnold_materialx_1_0_DefineInfo(in_ctxt) { return true; } +function Arnold_materialx_1_0_Define(in_ctxt) { return true; } +function Arnold_merge_1_0_DefineInfo(in_ctxt) { return true; } +function Arnold_merge_1_0_Define(in_ctxt) { return true; } +function Arnold_set_parameter_1_0_DefineInfo(in_ctxt) { return true; } +//function Arnold_set_parameter_1_0_Define(in_ctxt) { return true; } +function Arnold_set_transform_1_0_DefineInfo(in_ctxt) { return true; } +function Arnold_set_transform_1_0_Define(in_ctxt) { return true; } +function Arnold_switch_operator_1_0_DefineInfo(in_ctxt) { return true; } +function Arnold_switch_operator_1_0_Define(in_ctxt) { return true; } + + /////////////////////////////////////////////////// /////////////// shaders that require a dedicated UI /////////////////////////////////////////////////// -function Arnold_physical_sky_1_0_DefineInfo(in_ctxt) -{ - return true; -} - -function Arnold_physical_sky_1_0_Define(in_ctxt) +function Arnold_physical_sky_1_0_Define(in_ctxt) { - var h = SItoAShaderDefHelpers(); // helper object - var shaderDef = in_ctxt.GetAttribute("Definition"); - shaderDef.AddShaderFamily(siShaderFamilyTexture); - - // INPUT - params = shaderDef.InputParamDefs; - h.AddScalar (params, "turbidity", 3.0, 1.0, 10.0, 1.0, 10.0, true, false, true); - h.AddColor3 (params, "ground_albedo", 0.1, 0.1, 0.1, true, false, true); - h.AddScalar (params, "elevation", 45.0, 0.0, 180.0, 0.0, 180.0, true, false, true); - h.AddScalar (params, "azimuth", 90.0, 0.0, 360.0, 0.0, 360.0, true, false, true); - h.AddBoolean(params, "enable_sun", true, true, false, true); - h.AddScalar (params, "sun_size", 0.51, 0.0, 180.0, 0.0, 5.0, true, false, true); - h.AddScalar (params, "intensity", 1.0, 0.0, 10.0, 0.0, 10.0, true, false, true); - h.AddColor3 (params, "sky_tint", 1.0, 1.0, 1.0, true, false, true); - h.AddColor3 (params, "sun_tint", 1.0, 1.0, 1.0, true, false, true); - h.AddVector3(params, "X", 1.0, 0.0, 0.0, -1.0, 1.0, -1.0, 1.0); - h.AddVector3(params, "Y", 0.0, 1.0, 0.0, -1.0, 1.0, -1.0, 1.0); - h.AddVector3(params, "Z", 0.0, 0.0, 1.0, -1.0, 1.0, -1.0, 1.0); - - // OUTPUT - h.AddOutputColor4(shaderDef.OutputParamDefs); - - // Renderer definition - h.AddArnoldRendererDef(shaderDef); - physical_sky_Layout(shaderDef.PPGLayout); return true; @@ -422,29 +442,12 @@ function Arnold_physical_sky_1_0_Define(in_ctxt) function physical_sky_Layout(in_layout) { - in_layout.Clear(); - in_layout.SetAttribute(siUIHelpFile, "https://support.solidangle.com/display/SItoAUG/Physical+Sky"); - - item = in_layout.AddItem("turbidity", "Turbidity"); - item = in_layout.AddItem("ground_albedo", "Ground Albedo"); - item = in_layout.AddItem("elevation", "Elevation"); - item = in_layout.AddItem("azimuth", "Azimuth"); - item = in_layout.AddItem("intensity", "Intensity"); - item = in_layout.AddItem("sky_tint", "Sky Tint"); - item = in_layout.AddItem("enable_sun", "Enable Sun"); - item = in_layout.AddItem("sun_tint", "Sun Tint"); - item = in_layout.AddItem("sun_size", "Sun Size"); - in_layout.AddGroup("Orientation"); - in_layout.AddGroup(""); - item = in_layout.AddItem("X", "X"); - item = in_layout.AddItem("Y", "Y"); - item = in_layout.AddItem("Z", "Z"); - in_layout.EndGroup(); - in_layout.AddRow(); - item = in_layout.AddButton("SetExpression", "Set Expression"); - item = in_layout.AddButton("RemoveExpression", "Remove Expression"); - in_layout.EndRow(); - in_layout.EndGroup(); + in_layout.SetAttribute(siUIHelpFile, "https://support.solidangle.com/display/SItoAUG/Physical+Sky"); + + in_layout.AddRow(); + item = in_layout.AddButton("SetExpression", "Set Expression"); + item = in_layout.AddButton("RemoveExpression", "Remove Expression"); + in_layout.EndRow(); in_layout.SetAttribute(siUILogicPrefix, "physical_sky_"); } @@ -452,12 +455,20 @@ function physical_sky_Layout(in_layout) function physical_sky_OnInit() { physical_sky_enable_sun_OnChanged(); + physical_sky_use_degrees_OnChanged(); +} + +function physical_sky_use_degrees_OnChanged() +{ + PPG.azimuth.Enable(PPG.use_degrees.Value); + PPG.elevation.Enable(PPG.use_degrees.Value); + PPG.sun_direction.Enable(!PPG.use_degrees.Value); } function physical_sky_enable_sun_OnChanged() { - PPG.sun_size.Enable(PPG.enable_sun.Value); - PPG.sun_tint.Enable(PPG.enable_sun.Value); + PPG.sun_size.Enable(PPG.enable_sun.Value); + PPG.sun_tint.Enable(PPG.enable_sun.Value); } // Xx = cy*cz; @@ -516,3 +527,89 @@ function physical_sky_RemoveExpression_OnClicked() RemoveAnimation(pset + ".Z.y", null, null, null, null, null); RemoveAnimation(pset + ".Z.z", null, null, null, null, null); } + +function Arnold_operator_1_0_DefineInfo(in_ctxt) +{ + in_ctxt.SetAttribute("DisplayName", "operator"); + in_ctxt.SetAttribute("Category", "Arnold/Operators"); + return true; +} + +function Arnold_operator_1_0_Define(in_ctxt) +{ + var h = SItoAShaderDefHelpers(); // helper object + + var shaderDef = in_ctxt.GetAttribute("Definition"); + shaderDef.AddShaderFamily(siShaderFamilyTexture); + + // INPUT + params = shaderDef.InputParamDefs; + h.AddNode(params, "operator"); + + // OUTPUT + h.AddOutputColor4(shaderDef.OutputParamDefs); + + // Renderer definition + h.AddArnoldRendererDef(shaderDef); + + return true; +} + +function Arnold_set_parameter_1_0_Define(in_ctxt) +{ + var h = SItoAShaderDefHelpers(); // helper object + + var shaderDef = in_ctxt.GetAttribute("Definition"); + shaderDef.AddShaderFamily(siShaderFamilyTexture); + + // INPUT + params = shaderDef.InputParamDefs; + + h.AddBoolean(params, "enable", true, true, false, true); + + paramOptions = XSIFactory.CreateShaderParamDefOptions(); + paramOptions.SetLongName("Inputs"); + h.SetCapability(paramOptions, false, true, true); + params.AddArrayParamDef("inputs", siShaderDataTypeReference, paramOptions); + + h.AddString(params, "selection", ""); + + paramOptions = XSIFactory.CreateShaderParamDefOptions(); + paramOptions.SetLongName("Assignments"); + var paramDef = params.AddArrayParamDef("assignments", siShaderDataTypeStructure, paramOptions); + var subParamDefs = paramDef.ItemDef.SubParamDefs; + + paramOptions = XSIFactory.CreateShaderParamDefOptions(); + h.SetCapability(paramOptions, true, false, true); + paramOptions.SetDefaultValue(true); + paramOptions.SetLongName("Enable"); + subParamDefs.AddParamDef("enable_assignment", siShaderDataTypeBoolean, paramOptions); + + paramOptions = XSIFactory.CreateShaderParamDefOptions(); + h.SetCapability(paramOptions, false, false, true); + paramOptions.SetLongName("Assignment"); + subParamDefs.AddParamDef("assignment", siShaderDataTypeString, paramOptions); + + // OUTPUT + h.AddOutputNode(shaderDef.OutputParamDefs); + + // Renderer definition + h.AddArnoldRendererDef(shaderDef); + + set_parameter_Layout(shaderDef.PPGLayout); + + return true; +} + +function set_parameter_Layout(in_layout) +{ + in_layout.Clear(); + in_layout.SetAttribute(siUIHelpFile, "https://docs.arnoldrenderer.com/display/A5NodeRef/set_parameter"); + + item = in_layout.AddItem("enable", "Enable"); + item = in_layout.AddItem("inputs", "Inputs"); + item = in_layout.AddItem("selection", "Selection"); + item = in_layout.AddItem("assignments"); + + in_layout.SetAttribute(siUILogicPrefix, "set_parameter_"); +} diff --git a/plugins/helpers/ArnoldShaderDefHelpers.js b/plugins/helpers/ArnoldShaderDefHelpers.js index f50f1d3..71fe774 100644 --- a/plugins/helpers/ArnoldShaderDefHelpers.js +++ b/plugins/helpers/ArnoldShaderDefHelpers.js @@ -202,6 +202,13 @@ function ShaderHelperObj() var paramDef = in_params.AddParamDef(in_name, siShaderDataTypeImage, paramOptions); } + this.AddNode = function(in_params, in_name) + { + paramOptions = XSIFactory.CreateShaderParamDefOptions(); + this.SetCapability(paramOptions, false, true, false); + var paramDef = in_params.AddParamDef(in_name, siShaderDataTypeReference, paramOptions); + } + this.AddOutputColor3 = function(in_params) { paramOptions = XSIFactory.CreateShaderParamDefOptions(); @@ -238,6 +245,13 @@ function ShaderHelperObj() paramDef.MainPort = false; } + this.AddOutputNode = function(in_params) + { + paramOptions = XSIFactory.CreateShaderParamDefOptions(); + paramDef = in_params.AddParamDef("out", siShaderDataTypeReference, paramOptions); + paramDef.MainPort = false; + } + this.AddArnoldRendererDef = function(in_shaderDef) { var h = SItoAToolHelper(); diff --git a/plugins/metadata/arnold_operators.mtd b/plugins/metadata/arnold_operators.mtd new file mode 100644 index 0000000..e1fbeb8 --- /dev/null +++ b/plugins/metadata/arnold_operators.mtd @@ -0,0 +1,103 @@ +##################################################################################################################################### +# Copyright 2017 Autodesk, Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. +# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under the License. +##################################################################################################################################### + +########################################################################### +[node collection] + +[attr enable] +linkable BOOL false + +########################################################################### +[node disable] + +[attr enable] +linkable BOOL false + +[attr mode] +linkable BOOL false + +[attr shapes] +linkable BOOL false + +[attr lights] +linkable BOOL false + +[attr shaders] +linkable BOOL false + +[attr operators] +linkable BOOL false + +########################################################################### +[node materialx] + +[attr enable] +linkable BOOL false + +[attr assign_materials] +linkable BOOL false + +[attr assign_properties] +linkable BOOL false + +[attr assign_visibilities] +linkable BOOL false + +########################################################################### +[node merge] + +[attr enable] +linkable BOOL false + +########################################################################### +[node set_parameter] + +[attr enable] +linkable BOOL false + +[attr assignment] +linkable BOOL false + +########################################################################### +[node set_transform] + +[attr enable] +linkable BOOL false + +[attr translate] +linkable BOOL false + +[attr rotate] +linkable BOOL false + +[attr scale] +linkable BOOL false + +########################################################################### +[node switch_operator] + +[attr enable] +linkable BOOL false + +[attr index] +linkable BOOL false + +########################################################################### +[node include_graph] + +[attr enable] +linkable BOOL false + +[attr filename] +linkable BOOL false + +[attr target] +linkable BOOL false diff --git a/plugins/sitoa/common/ParamsCommon.cpp b/plugins/sitoa/common/ParamsCommon.cpp index 91cccab..835f3cd 100644 --- a/plugins/sitoa/common/ParamsCommon.cpp +++ b/plugins/sitoa/common/ParamsCommon.cpp @@ -79,6 +79,9 @@ CStatus LoadParameterValue(AtNode *in_node, const CString &in_entryName, const C in_entryName == L"ScalarSwitch" || in_entryName == L"Vector3Switch") return LoadArraySwitcherParameter(in_node, in_param, in_frame, arrayElement, in_ref); + + if (in_entryName == L"set_parameter" && in_paramName == L"assignments") + return LoadArrayAssignmentParameter(in_node, in_param, in_frame, arrayElement, in_ref); } // Compound param (with subcomponents) diff --git a/plugins/sitoa/common/ParamsShader.cpp b/plugins/sitoa/common/ParamsShader.cpp index 66eb625..a4a6c6b 100644 --- a/plugins/sitoa/common/ParamsShader.cpp +++ b/plugins/sitoa/common/ParamsShader.cpp @@ -175,10 +175,27 @@ CStatus LoadShaderParameter(AtNode* in_node, const CString &in_entryName, Parame CNodeSetter::SetPointer(in_node, paramScriptName.GetAsciiString(), shaderLinked); else { - if (in_arrayElement != -1) - paramScriptName = in_arrayParamName + L"[" + CString(CValue(in_arrayElement).GetAsText()) + L"]"; + // if we have an arrayParamName then let's get the arnold array type + if(!in_arrayParamName.IsEmpty()) + paramType = GetArnoldParameterType(in_node, in_arrayParamName.GetAsciiString(), true); + + // if we have an arnold node array type and in_arrayElement was passed in + if (paramType == AI_TYPE_NODE && in_arrayElement != -1) + { + AtArray* nodes = AiNodeGetArray(in_node, in_arrayParamName.GetAsciiString()); + if (nodes) + { + AiArraySetPtr(nodes, in_arrayElement, shaderLinked); + AiNodeSetArray(in_node, in_arrayParamName.GetAsciiString(), nodes); + } + } + else + { + if (in_arrayElement != -1) + paramScriptName = in_arrayParamName + L"[" + CString(CValue(in_arrayElement).GetAsText()) + L"]"; - AiNodeLink(shaderLinked, paramScriptName.GetAsciiString(), in_node); + AiNodeLink(shaderLinked, paramScriptName.GetAsciiString(), in_node); + } } } else if (sourceID == siShaderArrayParameterID) @@ -236,6 +253,14 @@ CStatus LoadShaderParameter(AtNode* in_node, const CString &in_entryName, Parame AiNodeSetArray(in_node, "values", values); AiNodeSetArray(in_node, "index", index); } + else if (in_entryName == L"set_parameter") + { + AtArray* assignments = AiArrayAllocate(paramArray.GetCount(), 1, AI_TYPE_STRING); + AtArray* enable_assignments = AiArrayAllocate(paramArray.GetCount(), 1, AI_TYPE_BOOLEAN); + + AiNodeSetArray(in_node, "assignment", assignments); + AiNodeSetArray(in_node, "enable_assignment", enable_assignments); + } else { // array type @@ -411,11 +436,107 @@ CStatus LoadArraySwitcherParameter(AtNode *in_node, const Parameter &in_param, d } +// Load the n-th element of the asignments array parameter of the set_parameter operator. A dedicated function +// is needed, because the array has elements of struct type (enable_assignment-assignment) that can't be parsed otherwise +// +// @param *in_node the Arnold shader node +// @param in_param the n-th Item parameter of the assignments array +// @param in_frame the frame time. +// @param in_arrayElement the index of the array, so the n that in_param refers to +// @param in_ref the object owning the shader. +// +// @return CStatus::OK +// +CStatus LoadArrayAssignmentParameter(AtNode *in_node, const Parameter &in_param, double in_frame, int in_arrayElement, CRef in_ref) +{ + AtArray *assignments = AiNodeGetArray(in_node, "assignment"); + AtArray *enable_assignments = AiNodeGetArray(in_node, "enable_assignment"); + + // this gets the Item container, with the index-value pair + CParameterRefArray paramsArray = in_param.GetParameters(); + + for (LONG i=0; iShaderMap().Get(surfaceShader, in_frame); + if (!shaderNode) + shaderNode = LoadShader(surfaceShader, in_frame, in_ref, RECURSE_FALSE); + } + } + + if (shaderNode) + { + CString shaderName = CNodeUtilities().GetName(shaderNode); + CString newParamValue = L"shader = \"" + shaderName + "\""; + AiArraySetStr(assignments, in_arrayElement, newParamValue.GetAsciiString()); + ordinaryParamLoad = false; + } + } + } + if (ordinaryParamLoad) + AiArraySetStr(assignments, in_arrayElement, paramValue.GetAsciiString()); + } + + return CStatus::OK; +} + + Shader GetShaderFromSource(const CRef &in_refCnxSrc) { if (in_refCnxSrc.IsA(siShaderID)) - return in_refCnxSrc; + { + // check if it's a closure node and bypass it + Shader thisShader = in_refCnxSrc; + CString shaderName = GetShaderNameFromProgId(thisShader.GetProgID()); + if (shaderName == L"closure") + { + CRef nextShader = GetParameterSource(ParAcc_GetParameter(thisShader, L"closure")); + if (nextShader.IsA(siShaderID)) + return nextShader; + } + else + return in_refCnxSrc; + } // If the source is a parameter of any type, get the parent, and attempt to return it as a shader. if (in_refCnxSrc.IsA(siParameterID)) diff --git a/plugins/sitoa/common/ParamsShader.h b/plugins/sitoa/common/ParamsShader.h index a2079ee..ec11ee0 100644 --- a/plugins/sitoa/common/ParamsShader.h +++ b/plugins/sitoa/common/ParamsShader.h @@ -27,6 +27,8 @@ CStatus LoadShaderParameters(AtNode* in_node, CRefArray &in_paramsArray, double CStatus LoadShaderParameter(AtNode* in_node, const CString &in_entryName, Parameter &in_param, double in_frame, const CRef &in_ref, bool in_recursively, const CString& in_arrayParamName=CString(), int in_arrayElement=-1); // Load the n-th element of the array parameters of the array switcher shaders. CStatus LoadArraySwitcherParameter(AtNode *in_node, const Parameter &in_param, double in_frame, int in_arrayElement, CRef in_ref); +// Load the n-th element of the asignments array parameter of the set_parameter operator. +CStatus LoadArrayAssignmentParameter(AtNode *in_node, const Parameter &in_param, double in_frame, int in_arrayElement, CRef in_ref); // Get the shader from a given source Shader GetShaderFromSource(const CRef &in_refCnxSrc); // Get the shader from a parameter diff --git a/plugins/sitoa/common/Tools.cpp b/plugins/sitoa/common/Tools.cpp index 68770d3..0fd3dca 100644 --- a/plugins/sitoa/common/Tools.cpp +++ b/plugins/sitoa/common/Tools.cpp @@ -510,6 +510,34 @@ bool CStringUtilities::EndsWith(CString in_string, CString in_subString) } +// Converts a parameter name to prettier Title Case formated string +// +// @param in_string The input string +// +// @return the string in Title Case format +// +CString CStringUtilities::PrettifyParameterName(CString in_string) +{ + CString label; + // replace "_" with " ". "_" is very common in the Arnold nodes + // Ex: "emission_color" -> "emission color: + CString t_label = CStringUtilities().ReplaceString(L"_", L" ", in_string); + // capitalize the first char of the name, and each token after a space, as we do for the SItoA shaders + // Ex: "emission color" -> "Emission Color: + for (ULONG i=0; im_points.size(), (uint8_t)nbDefKeys, AI_TYPE_VECTOR); - nlist = NULL; - // Give the arrays to the cloned node - AiNodeSetArray(cloneNode, "points", vlist); - } - else - { - // Allocate as many vertices and normals as needed. - // We need to allocate, instead of re-using the master vectors, since the number - // of mb keys could differ from the master ones. - vlist = AiArrayAllocate((int)strandInstance->m_points.size(), (uint8_t)nbDefKeys, AI_TYPE_VECTOR); - nlist = AiArrayAllocate((int)strandInstance->m_normals.size(), (uint8_t)nbDefKeys, AI_TYPE_VECTOR); - // Give the arrays to the cloned node - AiNodeSetArray(cloneNode, "vlist", vlist); - AiNodeSetArray(cloneNode, "nlist", nlist); - } } else // Retrieve the clone from the currentStrandIndex-th strand, so to store the extra mb points/vectors - { cloneNode = clonedNodes[currentStrandIndex][j]; - if (CNodeUtilities().GetEntryName(cloneNode) == L"curves") - { - // for curves, get the points array into vlist - vlist = AiNodeGetArray(cloneNode, "points"); - nlist = NULL; - } - else - { - vlist = AiNodeGetArray(cloneNode, "vlist"); - nlist = AiNodeGetArray(cloneNode, "nlist"); - } + + if (CNodeUtilities().GetEntryName(cloneNode) == L"curves") + { + // allocate the points array for the curves node + vlist = AiArrayAllocate((int)strandInstance->m_points.size(), (uint8_t)nbDefKeys, AI_TYPE_VECTOR); + nlist = NULL; + } + else + { + // Allocate as many vertices and normals as needed. + // We need to allocate, instead of re-using the master vectors, since the number + // of mb keys could differ from the master ones. + vlist = AiArrayAllocate((int)strandInstance->m_points.size(), (uint8_t)nbDefKeys, AI_TYPE_VECTOR); + nlist = AiArrayAllocate((int)strandInstance->m_normals.size(), (uint8_t)nbDefKeys, AI_TYPE_VECTOR); } // Bend the instanced objects along the strand @@ -960,6 +942,15 @@ CStatus LoadSingleHairInstance(const X3DObject &in_xsiObj, SIObject in_group, do // Assign the bended points/normals to the iDefKey-th array of vlist and nlist strandInstance->Get(vlist, nlist, iDefKey); + // Give the arrays to the cloned node + if (CNodeUtilities().GetEntryName(cloneNode) == L"curves") + AiNodeSetArray(cloneNode, "points", vlist); + else + { + AiNodeSetArray(cloneNode, "vlist", vlist); + AiNodeSetArray(cloneNode, "nlist", nlist); + } + // Set the matrices on the clone. Let's do it only once, not for every deform step if (iDefKey == 0) { diff --git a/plugins/sitoa/loader/ICE.cpp b/plugins/sitoa/loader/ICE.cpp index e82cd7a..57875a4 100644 --- a/plugins/sitoa/loader/ICE.cpp +++ b/plugins/sitoa/loader/ICE.cpp @@ -887,6 +887,7 @@ CStatus LoadSinglePointCloud(const X3DObject &in_xsiObj, double in_frame, { strandIndex = 0; int offset=0; + int nbStrandPoints; for (LONG pointOffset=0; pointOffset < pointCount; pointOffset+=ICE_CHUNK_SIZE) { LONG nbPoints = pointCount - pointOffset < ICE_CHUNK_SIZE ? pointCount - pointOffset : ICE_CHUNK_SIZE; @@ -901,9 +902,10 @@ CStatus LoadSinglePointCloud(const X3DObject &in_xsiObj, double in_frame, // just once in one of the previous points loops if (iceAttributes.GetStrandPosition(pointIndex, strandPos) && (strandPos.GetCount() > 1)) { - iceObjects.m_strands[0].DeclareAttributes(&iceAttributes, in_frame, pointIndex, strandIndex, offset); + nbStrandPoints = (int)strandPos.GetCount(); + iceObjects.m_strands[0].DeclareAttributes(&iceAttributes, in_frame, pointIndex, strandIndex, offset, nbStrandPoints); // the index for the array to be written. So, increment it by the strand's number of points - offset+= (int)iceObjects.m_strands[0].m_strands[strandIndex].m_points.size(); + offset+= nbStrandPoints; strandIndex++; } } diff --git a/plugins/sitoa/loader/ICE.h b/plugins/sitoa/loader/ICE.h index c94f92d..d104202 100644 --- a/plugins/sitoa/loader/ICE.h +++ b/plugins/sitoa/loader/ICE.h @@ -437,7 +437,7 @@ class CIceObjectBase // Attach a given attributes to this node void DeclareICEAttributeOnNode(LONG in_index, LONG in_dataArrayIndex, CIceAttribute* in_attribute, double in_frame, eDeclICEAttr in_declareType = eDeclICEAttr_Constant, LONG in_count=0, LONG in_offset=0, - int in_strandCount=0); + int in_strandCount=0, int in_nbStrandPoints=0); // Attach a given attributes to a polymesh node void DeclareICEAttributeOnMeshNode(CIceAttribute* in_attribute, const AtArray *in_indices); // Attach a given attributes to a volume node @@ -831,7 +831,7 @@ class CIceObjectStrand : public CIceObjectBase, public CHair // Build all the curves stuff bool MakeCurve(CustomProperty in_arnoldParameters, double in_frame, CDoubleArray in_defKeys, float in_secondsPerFrame, bool in_exactMb); // Attach all the required attributes for a strand - void DeclareAttributes(CIceAttributesSet *in_attributes, double in_frame, int in_pointIndex, int in_dataArrayIndex, int in_offset); + void DeclareAttributes(CIceAttributesSet *in_attributes, double in_frame, int in_pointIndex, int in_dataArrayIndex, int in_offset, int nbStrandPoints); // Set the Arnold Parameters set void SetArnoldParameters(CustomProperty in_property, double in_frame); }; diff --git a/plugins/sitoa/loader/ICEHelpers.cpp b/plugins/sitoa/loader/ICEHelpers.cpp index 508408e..6b810f4 100644 --- a/plugins/sitoa/loader/ICEHelpers.cpp +++ b/plugins/sitoa/loader/ICEHelpers.cpp @@ -1904,10 +1904,11 @@ bool CIceObjectBase::SetICEAttributeAsNodeParameter(CIceAttribute *in_attr, CMat // @param in_count: The size of the array to be allocated // @param in_offset: Used only for varying type, ie for strands. It's the offset where to start writing data into the array // @param in_strandCount: For strands only: the total number of strands +// @param in_nbStrandPoints: For strands only: The number of points on this single strand // void CIceObjectBase::DeclareICEAttributeOnNode(LONG in_index, LONG in_dataArrayIndex, CIceAttribute *in_attr, double in_frame, eDeclICEAttr in_declareType, LONG in_count, - LONG in_offset, int in_strandCount) + LONG in_offset, int in_strandCount, int in_nbStrandPoints) { // check if pointers are valid if (m_node == NULL || in_attr == NULL || !in_attr->m_isDefined) @@ -2254,6 +2255,9 @@ void CIceObjectBase::DeclareICEAttributeOnNode(LONG in_index, LONG in_dataArrayI { case siICENodeDataBool: { + // get the subarray + in_attr->m_bData2D.GetSubArray(attrIndex, in_attr->m_bData); + int nbAttributeValues = in_attr->m_bData.GetCount(); if (in_index == 0) { // The first time we try to write into the array, we must also allocate it. @@ -2262,8 +2266,7 @@ void CIceObjectBase::DeclareICEAttributeOnNode(LONG in_index, LONG in_dataArrayI // so we must default to "uniform", which in the case of curves means "one data per curve strand". // For instance, one could use "Set Particle Color" on a strand, to give the same color to the entire strand. // In this case, the size of the array to be allocated is, of course, equal to the number of strands - in_attr->m_bData2D.GetSubArray(attrIndex, in_attr->m_bData); - if (in_attr->m_bData.GetCount() == 1) + if (nbAttributeValues == 1) { if (AiNodeDeclare(m_node, in_attr->m_name.GetAsciiString(), "uniform BOOL")) AiNodeSetArray(m_node, in_attr->m_name.GetAsciiString(), AiArrayAllocate(in_strandCount, 1, AI_TYPE_BOOLEAN)); @@ -2276,21 +2279,35 @@ void CIceObjectBase::DeclareICEAttributeOnNode(LONG in_index, LONG in_dataArrayI } AtArray * dataArray = AiNodeGetArray(m_node, in_attr->m_name.GetAsciiString()); - // get the sub array - in_attr->m_bData2D.GetSubArray(attrIndex, in_attr->m_bData); - if (in_attr->m_bData2D.GetCount() == 1) // the offset, so WHERE to write, is then equal to incoming strand index + int nbArrayValues = nbAttributeValues; + if (nbAttributeValues == 1) // the offset, so WHERE to write, is then equal to incoming strand index in_offset = in_index; + else + { + if (nbAttributeValues != in_nbStrandPoints) + { + nbArrayValues = in_nbStrandPoints; // override nbArrayValues if it's mismatch so that we always set the right amount ov values to the array, Github #70 + GetMessageQueue()->LogMsg(L"[sitoa] Strand #" + CString(in_index) + L": " + in_attr->m_name + L" array count mismatch. ("+ in_attr->m_name + L": " + CString(nbAttributeValues) + L", StrandPosition: " + CString(in_nbStrandPoints) + L")", siWarningMsg); + } + } - for (ULONG i=0; im_bData.GetCount(); i++, in_offset++) - AiArraySetBool(dataArray, in_offset, in_attr->GetBool(i)); + for (ULONG i=0; iGetBool(i)); + else + AiArraySetBool(dataArray, in_offset, false); + } break; } // all the other cases work the same way, except for the data type case siICENodeDataLong: { + // get the sub array + in_attr->m_lData2D.GetSubArray(attrIndex, in_attr->m_lData); + int nbAttributeValues = in_attr->m_lData.GetCount(); if (in_index == 0) { - in_attr->m_lData2D.GetSubArray(attrIndex, in_attr->m_lData); - if (in_attr->m_lData.GetCount() == 1) + if (nbAttributeValues == 1) { if (AiNodeDeclare(m_node, in_attr->m_name.GetAsciiString(), "uniform INT")) AiNodeSetArray(m_node, in_attr->m_name.GetAsciiString(), AiArrayAllocate(in_strandCount, 1, AI_TYPE_INT)); @@ -2303,21 +2320,35 @@ void CIceObjectBase::DeclareICEAttributeOnNode(LONG in_index, LONG in_dataArrayI } AtArray * dataArray = AiNodeGetArray(m_node, in_attr->m_name.GetAsciiString()); - // get the sub array - in_attr->m_lData2D.GetSubArray(attrIndex, in_attr->m_lData); - if (in_attr->m_lData2D.GetCount() == 1) + int nbArrayValues = nbAttributeValues; + if (nbAttributeValues == 1) in_offset = in_index; + else + { + if (nbAttributeValues != in_nbStrandPoints) + { + nbArrayValues = in_nbStrandPoints; // override nbArrayValues if it's mismatch so that we always set the right amount ov values to the array, Github #70 + GetMessageQueue()->LogMsg(L"[sitoa] Strand #" + CString(in_index) + L": " + in_attr->m_name + L" array count mismatch. ("+ in_attr->m_name + L": " + CString(nbAttributeValues) + L", StrandPosition: " + CString(in_nbStrandPoints) + L")", siWarningMsg); + } + } - for (ULONG i=0; im_lData.GetCount(); i++, in_offset++) - AiArraySetInt(dataArray, in_offset, in_attr->GetInt(i)); + for (ULONG i=0; iGetInt(i)); + else + AiArraySetInt(dataArray, in_offset, 0); + } break; } case siICENodeDataFloat: { + // get the sub array + in_attr->m_fData2D.GetSubArray(attrIndex, in_attr->m_fData); + int nbAttributeValues = in_attr->m_fData.GetCount(); if (in_index == 0) { - in_attr->m_fData2D.GetSubArray(attrIndex, in_attr->m_fData); - if (in_attr->m_fData.GetCount() == 1) + if (nbAttributeValues == 1) { if (AiNodeDeclare(m_node, in_attr->m_name.GetAsciiString(), "uniform FLOAT")) AiNodeSetArray(m_node, in_attr->m_name.GetAsciiString(), AiArrayAllocate(in_strandCount, 1, AI_TYPE_FLOAT)); @@ -2330,20 +2361,35 @@ void CIceObjectBase::DeclareICEAttributeOnNode(LONG in_index, LONG in_dataArrayI } AtArray * dataArray = AiNodeGetArray(m_node, in_attr->m_name.GetAsciiString()); - in_attr->m_fData2D.GetSubArray(attrIndex, in_attr->m_fData); - if (in_attr->m_fData.GetCount() == 1) + int nbArrayValues = nbAttributeValues; + if (nbAttributeValues == 1) in_offset = in_index; + else + { + if (nbAttributeValues != in_nbStrandPoints) + { + nbArrayValues = in_nbStrandPoints; // override nbArrayValues if it's mismatch so that we always set the right amount ov values to the array, Github #70 + GetMessageQueue()->LogMsg(L"[sitoa] Strand #" + CString(in_index) + L": " + in_attr->m_name + L" array count mismatch. ("+ in_attr->m_name + L": " + CString(nbAttributeValues) + L", StrandPosition: " + CString(in_nbStrandPoints) + L")", siWarningMsg); + } + } - for (ULONG i=0; im_fData.GetCount(); i++, in_offset++) - AiArraySetFlt(dataArray, in_offset, in_attr->GetFloat(i)); + for (ULONG i=0; iGetFloat(i)); + else + AiArraySetFlt(dataArray, in_offset, 0.0f); + } break; } case siICENodeDataVector3: { + // get the sub array + in_attr->m_v3Data2D.GetSubArray(attrIndex, in_attr->m_v3Data); + int nbAttributeValues = in_attr->m_v3Data.GetCount(); if (in_index == 0) { - in_attr->m_v3Data2D.GetSubArray(attrIndex, in_attr->m_v3Data); - if (in_attr->m_v3Data2D.GetCount() == 1) + if (nbAttributeValues == 1) { if (AiNodeDeclare(m_node, in_attr->m_name.GetAsciiString(), "uniform VECTOR")) AiNodeSetArray(m_node, in_attr->m_name.GetAsciiString(), AiArrayAllocate(in_strandCount, 1, AI_TYPE_VECTOR)); @@ -2356,25 +2402,37 @@ void CIceObjectBase::DeclareICEAttributeOnNode(LONG in_index, LONG in_dataArrayI } AtArray * dataArray = AiNodeGetArray(m_node, in_attr->m_name.GetAsciiString()); - // get the sub array - in_attr->m_v3Data2D.GetSubArray(attrIndex, in_attr->m_v3Data); - if (in_attr->m_v3Data2D.GetCount() == 1) + int nbArrayValues = nbAttributeValues; + if (nbAttributeValues == 1) in_offset = in_index; + else + { + if (nbAttributeValues != in_nbStrandPoints) + { + nbArrayValues = in_nbStrandPoints; // override nbArrayValues if it's mismatch so that we always set the right amount ov values to the array, Github #70 + GetMessageQueue()->LogMsg(L"[sitoa] Strand #" + CString(in_index) + L": " + in_attr->m_name + L" array count mismatch. ("+ in_attr->m_name + L": " + CString(nbAttributeValues) + L", StrandPosition: " + CString(in_nbStrandPoints) + L")", siWarningMsg); + } + } AtVector vec; - for (ULONG i=0; im_v3Data.GetCount(); i++, in_offset++) + for (ULONG i=0; iGetVector3f(i), vec); + if (i < nbAttributeValues) + CUtilities().S2A(in_attr->GetVector3f(i), vec); + else + vec = AtVector(0.0f, 0.0f, 0.0f); AiArraySetVec(dataArray, in_offset, vec); } break; } case siICENodeDataColor4: { + // get the sub array + in_attr->m_cData2D.GetSubArray(attrIndex, in_attr->m_cData); + int nbAttributeValues = in_attr->m_cData.GetCount(); if (in_index == 0) { - in_attr->m_cData2D.GetSubArray(attrIndex, in_attr->m_cData); - if (in_attr->m_cData.GetCount() == 1) + if (nbAttributeValues == 1) { if (AiNodeDeclare(m_node, in_attr->m_name.GetAsciiString(), "uniform RGBA")) AiNodeSetArray(m_node, in_attr->m_name.GetAsciiString(), AiArrayAllocate(in_strandCount, 1, AI_TYPE_RGBA)); @@ -2387,25 +2445,37 @@ void CIceObjectBase::DeclareICEAttributeOnNode(LONG in_index, LONG in_dataArrayI } AtArray * dataArray = AiNodeGetArray(m_node, in_attr->m_name.GetAsciiString()); - // get the sub array - in_attr->m_cData2D.GetSubArray(attrIndex, in_attr->m_cData); - if (in_attr->m_cData.GetCount() == 1) + int nbArrayValues = nbAttributeValues; + if (nbAttributeValues == 1) in_offset = in_index; + else + { + if (nbAttributeValues != in_nbStrandPoints) + { + nbArrayValues = in_nbStrandPoints; // override nbArrayValues if it's mismatch so that we always set the right amount ov values to the array, Github #70 + GetMessageQueue()->LogMsg(L"[sitoa] Strand #" + CString(in_index) + L": " + in_attr->m_name + L" array count mismatch. ("+ in_attr->m_name + L": " + CString(nbAttributeValues) + L", StrandPosition: " + CString(in_nbStrandPoints) + L")", siWarningMsg); + } + } AtRGBA rgba; - for (ULONG i=0; im_cData.GetCount(); i++, in_offset++) + for (ULONG i=0; iGetColor4f(i), rgba); + if (i < nbAttributeValues) + CUtilities().S2A(in_attr->GetColor4f(i), rgba); + else + rgba = AI_RGBA_ZERO; AiArraySetRGBA(dataArray, in_offset, rgba); } break; } case siICENodeDataMatrix44: { + // get the sub array + in_attr->m_m4Data2D.GetSubArray(attrIndex, in_attr->m_m4Data); + int nbAttributeValues = in_attr->m_m4Data.GetCount(); if (in_index == 0) { - in_attr->m_m4Data2D.GetSubArray(attrIndex, in_attr->m_m4Data); - if (in_attr->m_m4Data2D.GetCount() == 1) + if (nbAttributeValues == 1) { if (AiNodeDeclare(m_node, in_attr->m_name.GetAsciiString(), "uniform MATRIX")) AiNodeSetArray(m_node, in_attr->m_name.GetAsciiString(), AiArrayAllocate(in_strandCount, 1, AI_TYPE_MATRIX)); @@ -2418,15 +2488,25 @@ void CIceObjectBase::DeclareICEAttributeOnNode(LONG in_index, LONG in_dataArrayI } AtArray * dataArray = AiNodeGetArray(m_node, in_attr->m_name.GetAsciiString()); - // get the sub array - in_attr->m_m4Data2D.GetSubArray(attrIndex, in_attr->m_m4Data); - if (in_attr->m_m4Data2D.GetCount() == 1) + int nbArrayValues = nbAttributeValues; + if (nbAttributeValues == 1) in_offset = in_index; + else + { + if (nbAttributeValues != in_nbStrandPoints) + { + nbArrayValues = in_nbStrandPoints; // override nbArrayValues if it's mismatch so that we always set the right amount ov values to the array, Github #70 + GetMessageQueue()->LogMsg(L"[sitoa] Strand #" + CString(in_index) + L": " + in_attr->m_name + L" array count mismatch. ("+ in_attr->m_name + L": " + CString(nbAttributeValues) + L", StrandPosition: " + CString(in_nbStrandPoints) + L")", siWarningMsg); + } + } AtMatrix matrix; - for (ULONG i=0; im_m4Data.GetCount(); i++, in_offset++) + for (ULONG i=0; iGetMatrix4f(i), matrix); + if (i < nbAttributeValues) + CUtilities().S2A(in_attr->GetMatrix4f(i), matrix); + else + matrix = AiM4Identity(); AiArraySetMtx(dataArray, in_offset, matrix); } break; @@ -3971,12 +4051,13 @@ bool CIceObjectStrand::MakeCurve(CustomProperty in_arnoldParameters, double in_f // @param in_pointIndex: The index of the ice point // @param in_dataArrayIndex: The index of the point. // @param in_offset: Where the strand points begin in the points array +// @param in_nbStrandPoints: Number of strand points on this strand // -void CIceObjectStrand::DeclareAttributes(CIceAttributesSet *in_attributes, double in_frame, int in_pointIndex, int in_dataArrayIndex, int in_offset) +void CIceObjectStrand::DeclareAttributes(CIceAttributesSet *in_attributes, double in_frame, int in_pointIndex, int in_dataArrayIndex, int in_offset, int in_nbStrandPoints) { AttrMap::iterator attribIt; for (attribIt = in_attributes->m_requiredAttributesMap.begin(); attribIt != in_attributes->m_requiredAttributesMap.end(); attribIt++) - DeclareICEAttributeOnNode(in_pointIndex, in_dataArrayIndex, attribIt->second, in_frame, eDeclICEAttr_Varying, m_nbPoints, in_offset, this->GetNbStrands()); + DeclareICEAttributeOnNode(in_pointIndex, in_dataArrayIndex, attribIt->second, in_frame, eDeclICEAttr_Varying, m_nbPoints, in_offset, this->GetNbStrands(), in_nbStrandPoints); } @@ -4758,10 +4839,6 @@ bool CIceObjectStrandInstance::LoadStrandInstance(Model in_modelMaster, CRefArra vlist = AiArrayAllocate((int)strandInstance->m_points.size(), (uint8_t)nbDefKeys, AI_TYPE_VECTOR); nlist = AiArrayAllocate((int)strandInstance->m_normals.size(), (uint8_t)nbDefKeys, AI_TYPE_VECTOR); - // Give the arrays to the cloned node - AiNodeSetArray(shape.m_node, "vlist", vlist); - AiNodeSetArray(shape.m_node, "nlist", nlist); - if (nbDefKeys == 1) { // Bend the instanced objects along the strand @@ -4802,6 +4879,10 @@ bool CIceObjectStrandInstance::LoadStrandInstance(Model in_modelMaster, CRefArra } } + // Give the arrays to the cloned node + AiNodeSetArray(shape.m_node, "vlist", vlist); + AiNodeSetArray(shape.m_node, "nlist", nlist); + // get the matrices of the masterNode, just to get their count AtArray* masterNodeMatrices = AiNodeGetArray(masterNode, "matrix"); // allocs the same number matrices for the cloned shape, and set them to identity. diff --git a/plugins/sitoa/loader/Loader.cpp b/plugins/sitoa/loader/Loader.cpp index d5b6b87..9f1c2b6 100644 --- a/plugins/sitoa/loader/Loader.cpp +++ b/plugins/sitoa/loader/Loader.cpp @@ -18,6 +18,7 @@ See the License for the specific language governing permissions and limitations #include "loader/Polymeshes.h" #include "loader/Shaders.h" #include "loader/Procedurals.h" +#include "loader/Operators.h" #include "renderer/RenderMessages.h" #include "renderer/Renderer.h" @@ -110,16 +111,18 @@ CStatus LoadScene(const Property &in_arnoldOptions, const CString& in_renderType int output_cameras = AI_NODE_CAMERA; int output_lights = AI_NODE_LIGHT; int output_shaders = AI_NODE_SHADER; + int output_operators = AI_NODE_OPERATOR; CPathString outputAssDir, assOutputName; bool useTranslation; output_options = toRender || GetRenderOptions()->m_output_options ? AI_NODE_OPTIONS + AI_NODE_COLOR_MANAGER: 0; output_drivers_filters = toRender || GetRenderOptions()->m_output_drivers_filters ? AI_NODE_DRIVER + AI_NODE_FILTER : 0; - output_geometry = toRender || GetRenderOptions()->m_output_geometry ? AI_NODE_SHAPE : 0; - output_cameras = toRender || GetRenderOptions()->m_output_cameras ? AI_NODE_CAMERA : 0; - output_lights = toRender || GetRenderOptions()->m_output_lights ? AI_NODE_LIGHT : 0; - output_shaders = toRender || GetRenderOptions()->m_output_shaders ? AI_NODE_SHADER : 0; + output_geometry = toRender || GetRenderOptions()->m_output_geometry ? AI_NODE_SHAPE : 0; + output_cameras = toRender || GetRenderOptions()->m_output_cameras ? AI_NODE_CAMERA : 0; + output_lights = toRender || GetRenderOptions()->m_output_lights ? AI_NODE_LIGHT : 0; + output_shaders = toRender || GetRenderOptions()->m_output_shaders ? AI_NODE_SHADER : 0; + output_operators = toRender || GetRenderOptions()->m_output_operators ? AI_NODE_OPERATOR : 0; SceneRenderProperty sceneRenderProp(app.GetActiveProject().GetActiveScene().GetPassContainer().GetProperties().GetItem(L"Scene Render Options")); @@ -258,6 +261,19 @@ CStatus LoadScene(const Property &in_arnoldOptions, const CString& in_renderType } } + //////////// Operators //////////// + if (!in_createStandIn) + { + AiMsgDebug("[sitoa] Loading Operators"); + status = LoadPassOperator(iframe); + + if (progressBar.IsCancelPressed() || status == CStatus::Abort) + { + AbortFrameLoadScene(); + break; + } + } + //////////// Cameras //////////// if (!in_createStandIn && output_cameras == AI_NODE_CAMERA) { @@ -382,9 +398,8 @@ CStatus LoadScene(const Property &in_arnoldOptions, const CString& in_renderType AiMsgDebug("[sitoa] Writing ASS file"); - // BypassClosurePassthroughForAss(); AiASSWrite(assOutputName.GetAsciiString(), - output_cameras + output_drivers_filters + output_lights + output_options + output_geometry + output_shaders, + output_cameras + output_drivers_filters + output_lights + output_options + output_geometry + output_shaders + output_operators, GetRenderOptions()->m_open_procs, GetRenderOptions()->m_binary_ass ); @@ -518,46 +533,3 @@ CStatus PostLoadSingleObject(const CRef in_ref, double in_frame, CRefArray &in_s return CStatus::Unexpected; } - -// remove all the SItoA closure nodes, for a clean ass. -// -/* -void BypassClosurePassthroughForAss() -{ - set closures; - AtNodeIterator *iter = AiUniverseGetNodeIterator(AI_NODE_SHAPE); - while (!AiNodeIteratorFinished(iter)) - { - AtNode *node = AiNodeIteratorGetNext(iter); - if (!node) - break; - - const AtNodeEntry* node_entry = AiNodeGetNodeEntry(node); - if (AiNodeEntryLookUpParameter(node_entry, "shader")) - { - AtNode* shader = (AtNode*)AiNodeGetPtr(node, "shader"); - if (shader) - { - const AtNodeEntry* shader_node_entry = AiNodeGetNodeEntry(shader); - AtString shader_node_entry_name(AiNodeEntryGetName(shader_node_entry)); - if (shader_node_entry_name == ATSTRING::closure) - { - // bypass: - AtNode* main_shader = AiNodeGetLink(shader, "closure"); - if (main_shader) - { - AiNodeSetPtr(node, "shader", main_shader); - closures.insert(shader); // add to the set of closure nodes, to be destroyed at the end - } - } - } - } - } - - AiNodeIteratorDestroy(iter); - - for (set ::iterator it = closures.begin(); it != closures.end(); it++) - AiNodeDestroy(*it); -} -*/ - diff --git a/plugins/sitoa/loader/Loader.h b/plugins/sitoa/loader/Loader.h index cc3872f..dd773f0 100644 --- a/plugins/sitoa/loader/Loader.h +++ b/plugins/sitoa/loader/Loader.h @@ -23,5 +23,3 @@ CStatus LoadScene(const Property &in_arnoldOptions, const CString& in_renderType void AbortFrameLoadScene(); // postload a single object. CStatus PostLoadSingleObject(const CRef in_ref, double in_frame, CRefArray &in_selectedObjs, bool in_selectionOnly); -//void BypassClosurePassthroughForAss(); - diff --git a/plugins/sitoa/loader/Operators.cpp b/plugins/sitoa/loader/Operators.cpp new file mode 100644 index 0000000..4838237 --- /dev/null +++ b/plugins/sitoa/loader/Operators.cpp @@ -0,0 +1,71 @@ +/************************************************************************************************************************************ +Copyright 2017 Autodesk, Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. +You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and limitations under the License. +************************************************************************************************************************************/ + +#include "common/ParamsShader.h" +#include "loader/Shaders.h" +#include "renderer/Renderer.h" + +#include +#include +#include +#include +#include + +// Load the operators connected to a RenderPass into Arnold +// +// @return CStatus::OK if all went well, else the error code +// +CStatus LoadPassOperator(double in_frame) +{ + CStatus status(CStatus::OK); + + Pass pass(Application().GetActiveProject().GetActiveScene().GetActivePass()); + + CRef outputStackRef; + outputStackRef.Set(pass.GetFullName() + L".OutputShaderStack"); + ShaderArrayParameter arrayParam = ShaderArrayParameter(outputStackRef); + + AtNode* options = AiUniverseGetOptions(); + + if (arrayParam.GetCount() > 0) + { + Shader operatorShader; + for (LONG i=0; i + +using namespace XSI; + +// Load operators into Arnold +CStatus LoadPassOperator(double in_frame); diff --git a/plugins/sitoa/loader/Options.cpp b/plugins/sitoa/loader/Options.cpp index 217b0eb..1485389 100644 --- a/plugins/sitoa/loader/Options.cpp +++ b/plugins/sitoa/loader/Options.cpp @@ -534,7 +534,7 @@ bool LoadDrivers(AtNode *in_optionsNode, Pass &in_pass, double in_frame, bool in // Do checks if Arnold Denoising AOVs already exist and if they have the right filter if they do if (masterFb.m_fullName == mainFb.m_fullName) // only check if it's a layer in the same exr as main (multilayer-exr) { - if (thisFb.m_layerName == L"diffuse_albedo") + if (thisFb.m_layerName == L"denoise_albedo") noiceDA = L"exist"; if (thisFb.m_layerName == L"N") @@ -591,7 +591,7 @@ bool LoadDrivers(AtNode *in_optionsNode, Pass &in_pass, double in_frame, bool in int i = 0; if (noiceDA != L"exist") { - AiArraySetStr(outputs, activeBuffers+i, CString(L"diffuse_albedo RGB " + colorFilter + L" " + mainFb.m_fullName).GetAsciiString()); + AiArraySetStr(outputs, activeBuffers+i, CString(L"denoise_albedo RGB " + colorFilter + L" " + mainFb.m_fullName).GetAsciiString()); i++; } if (noiceN != L"exist") @@ -737,10 +737,12 @@ void LoadOptionsParameters(AtNode* in_optionsNode, const Property &in_arnoldOpti CNodeSetter::SetBoolean(in_optionsNode, "ignore_subdivision", GetRenderOptions()->m_ignore_subdivision); CNodeSetter::SetBoolean(in_optionsNode, "ignore_displacement", GetRenderOptions()->m_ignore_displacement); CNodeSetter::SetBoolean(in_optionsNode, "ignore_bump", GetRenderOptions()->m_ignore_bump); - CNodeSetter::SetBoolean(in_optionsNode, "ignore_motion_blur", GetRenderOptions()->m_ignore_motion_blur); + CNodeSetter::SetBoolean(in_optionsNode, "ignore_motion", GetRenderOptions()->m_ignore_motion); + CNodeSetter::SetBoolean(in_optionsNode, "ignore_motion_blur", GetRenderOptions()->m_ignore_motion_blur); // property is located in motion blur tab on PPG CNodeSetter::SetBoolean(in_optionsNode, "ignore_smoothing", GetRenderOptions()->m_ignore_smoothing); CNodeSetter::SetBoolean(in_optionsNode, "ignore_sss", GetRenderOptions()->m_ignore_sss); CNodeSetter::SetBoolean(in_optionsNode, "ignore_dof", GetRenderOptions()->m_ignore_dof); + CNodeSetter::SetBoolean(in_optionsNode, "ignore_operators", GetRenderOptions()->m_ignore_operators); // Error colors CNodeSetter::SetRGB(in_optionsNode, "error_color_bad_texture", GetRenderOptions()->m_error_color_bad_map.GetR(), @@ -799,9 +801,57 @@ void LoadOptionsParameters(AtNode* in_optionsNode, const Property &in_arnoldOpti int nb_threads = GetRenderOptions()->m_autodetect_threads ? 0 : GetRenderOptions()->m_threads; CNodeSetter::SetInt(in_optionsNode, "threads", nb_threads); - // GPU devices - CNodeSetter::SetString(in_optionsNode, "gpu_default_names", GetRenderOptions()->m_gpu_default_names.GetAsciiString()); - CNodeSetter::SetInt(in_optionsNode, "gpu_default_min_memory_MB", GetRenderOptions()->m_gpu_default_min_memory_MB); + // Devices + CNodeSetter::SetString(in_optionsNode, "render_device", GetRenderOptions()->m_render_device.GetAsciiString()); + CNodeSetter::SetString(in_optionsNode, "render_device_fallback", GetRenderOptions()->m_render_device_fallback.GetAsciiString()); + bool gpuRender = (GetRenderOptions()->m_render_device == L"GPU"); + bool optixDenoiser = GetRenderOptions()->m_use_optix_on_main; + + if (gpuRender) + CNodeSetter::SetInt(in_optionsNode, "gpu_max_texture_resolution", GetRenderOptions()->m_gpu_max_texture_resolution); + + // For GPU render, we want to force options.enable_progressive_render to be ON, even if its value is ignored by Arnold. + // At least we can take this parameter into account later on, for example when IPR needs to do special things depending on + // whether this option is enabled or not. See MtoA #3627 + if (gpuRender && Application().IsInteractive() && (renderType != L"Export")) + CNodeSetter::SetBoolean(in_optionsNode, "enable_progressive_render", true); + + // Only export GPU settings if we use a GPU for something; + if (gpuRender || optixDenoiser) + { + CNodeSetter::SetString(in_optionsNode, "gpu_default_names", GetRenderOptions()->m_gpu_default_names.GetAsciiString()); + CNodeSetter::SetInt(in_optionsNode, "gpu_default_min_memory_MB", GetRenderOptions()->m_gpu_default_min_memory_MB); + + // Device Selection + bool autoDeviceSelect = true; + bool tryManualDeviceSelect = GetRenderOptions()->m_enable_manual_devices; + if (tryManualDeviceSelect) + { + CString manualDeviceSelectionString = GetRenderOptions()->m_manual_device_selection; + if (manualDeviceSelectionString != L"") + { + CStringArray manualDevices = manualDeviceSelectionString.Split(L";"); + int numManualDevicesSelected = manualDevices.GetCount(); + AtArray* selectedDevices = AiArrayAllocate(1, (uint8_t)numManualDevicesSelected, AI_TYPE_UINT); + for (LONG i=0; iLogMsg(L"[sitoa] Could not select manual rendering device. Automatic selection will be used.", siWarningMsg); + + AiArrayDestroy(selectedDevices); + } + } + + if (autoDeviceSelect) + AiDeviceAutoSelect(); + } // #680 LoadUserOptions(in_optionsNode, in_arnoldOptions, in_frame); diff --git a/plugins/sitoa/loader/Polymeshes.cpp b/plugins/sitoa/loader/Polymeshes.cpp index 4a271f9..fd80ba2 100644 --- a/plugins/sitoa/loader/Polymeshes.cpp +++ b/plugins/sitoa/loader/Polymeshes.cpp @@ -1602,6 +1602,46 @@ void CMesh::ExportPref(double in_frame) } +// Export the nref normals, ie the normals at the modeling stage +// https://github.com/Autodesk/sitoa/issues/78 +// +// @param in_frame The frame time +// +void CMesh::ExportNref(double in_frame) +{ + // Export the Nref data if checked + if (!(bool)ParAcc_GetValue(m_paramProperty, L"export_nref", in_frame)) + return; + + AiNodeDeclare(m_node, "Nref", "indexed VECTOR"); // Nrefidxs seems to be defined automatically by this. + + PolygonMesh polyMeshBindPose = CObjectUtilities().GetGeometryAtFrame(m_xsiObj, siConstructionModeModeling, in_frame); + CGeometryAccessor geoAccessorBindPose = polyMeshBindPose.GetGeometryAccessor(siConstructionModeModeling, siCatmullClark, 0, false, + m_useDiscontinuity, m_discontinuityAngle); + + CLongArray NodeIndicesBindPose; + geoAccessorBindPose.GetNodeIndices(NodeIndicesBindPose); + AtArray* nidxsBindPose = AiArrayCopy(LongArrayToUIntArray(NodeIndicesBindPose)); + LONG nodeCountBindPose = AiArrayGetNumElements(nidxsBindPose); + + AtArray* nlistBindPose = AiArrayAllocate(nodeCountBindPose, 1, AI_TYPE_VECTOR); + CFloatArray nodeNormalsBindPose; + + if (m_hasIceNodeUserNormal) + GetIceNodeUserNormals(polyMeshBindPose, nodeNormalsBindPose); + else // Eric Mootz for #704 + GetGeoAccessorNormals(geoAccessorBindPose, nodeCountBindPose, nodeNormalsBindPose); + + for (LONG i=0; i < nodeCountBindPose; ++i) + { + AiArraySetVec(nlistBindPose, i, AtVector((float)nodeNormalsBindPose[3*i], (float)nodeNormalsBindPose[3*i + 1], (float)nodeNormalsBindPose[3*i + 2])); + } + + AiNodeSetArray(m_node, "Nrefidxs", nidxsBindPose); + AiNodeSetArray(m_node, "Nref", nlistBindPose); +} + + // Export the visibility, sidedness, custom parameters, user options and blob data // // @param in_frame The frame time @@ -1727,6 +1767,7 @@ CStatus LoadSinglePolymesh(X3DObject &in_xsiObj, double in_frame, CRefArray &in_ mesh.ExportEnvironment(); mesh.ExportLightGroup(); mesh.ExportPref(in_frame); + mesh.ExportNref(in_frame); mesh.ExportMotionStartEnd(); mesh.ExportVizSidednessAndOptions(in_frame); diff --git a/plugins/sitoa/loader/Polymeshes.h b/plugins/sitoa/loader/Polymeshes.h index 4afef51..92e1104 100644 --- a/plugins/sitoa/loader/Polymeshes.h +++ b/plugins/sitoa/loader/Polymeshes.h @@ -119,6 +119,8 @@ class CMesh void ExportSubdivision(double in_frame); // Export the pref points, ie the points at the modeling stage void ExportPref(double in_frame); + // Export the nref normals, ie the normals at the modeling stage + void ExportNref(double in_frame); // Export the visibility, sidedness, custom parameters, user options and blob data void ExportVizSidednessAndOptions(double in_frame); // Export motion_start, motion_end diff --git a/plugins/sitoa/loader/Properties.cpp b/plugins/sitoa/loader/Properties.cpp index 7234a7f..c192ec5 100644 --- a/plugins/sitoa/loader/Properties.cpp +++ b/plugins/sitoa/loader/Properties.cpp @@ -297,6 +297,7 @@ void LoadArnoldParameters(AtNode* in_node, CParameterRefArray &in_paramsArray, d { // sss does not apply on curves, points, etc (just polymesh), so skip these params if ( !strcmp(charParamName, "export_pref") || + !strcmp(charParamName, "export_nref") || !strcmp(charParamName, "sss_setname")) { if (!isMesh) @@ -365,6 +366,15 @@ void LoadArnoldParameters(AtNode* in_node, CParameterRefArray &in_paramsArray, d AiNodeSetArray(in_node, "trace_sets", a); } + // Skip Autobump Visibility. We handle it later. + if (!strcmp(charParamName, "autobump_camera") || + !strcmp(charParamName, "autobump_diffuse_reflection") || + !strcmp(charParamName, "autobump_specular_reflection") || + !strcmp(charParamName, "autobump_diffuse_transmission") || + !strcmp(charParamName, "autobump_specular_transmission") || + !strcmp(charParamName, "autobump_volume_scatter")) + continue; + // As XSI Custom Parameter, colors are defined as individual parameters // we need to treat it as special & very ugly case. if (strstr(charParamName, "_R") == NULL) @@ -386,9 +396,55 @@ void LoadArnoldParameters(AtNode* in_node, CParameterRefArray &in_paramsArray, d i+=2; } } + + // set the autobump visibility introduced in arnold 5.3 + // need to do some logic from LoadParameterValue manually here because that function can't be used for this. + const char* aiParamName = "autobump_visibility"; + int aiParamType = GetArnoldParameterType(in_node, aiParamName, true); + if (aiParamType != AI_TYPE_NONE) + AiNodeUnlink(in_node, aiParamName); + if (aiParamType == AI_TYPE_BYTE) + CNodeSetter::SetByte(in_node, aiParamName, GetAutobumpVisibility(in_paramsArray, in_frame)); } +// Return the rays visibility of autobump +// +// Evaluates the Autobump Visibility in the Arnold Parameter property and returns a bitfield that specifies +// the visibility for each ray type. +// +// @param in_paramsArray Array of parameters +// @param in_frame the evaluation time +// +// @return the autobump visibility bitfield +// +uint8_t GetAutobumpVisibility(CParameterRefArray &in_paramsArray, double in_frame) +{ + uint8_t autobump_visibility = AI_RAY_CAMERA; // default is camera only + + CRef ab_camera = in_paramsArray.GetItem(L"autobump_camera"); + if (ab_camera.IsValid()) + { + autobump_visibility = AI_RAY_UNDEFINED; + + bool camera = (bool)in_paramsArray.GetValue(L"autobump_camera", in_frame); + bool diffuse_reflection = (bool)in_paramsArray.GetValue(L"autobump_diffuse_reflection", in_frame); + bool specular_reflection = (bool)in_paramsArray.GetValue(L"autobump_specular_reflection", in_frame); + bool diffuse_transmission = (bool)in_paramsArray.GetValue(L"autobump_diffuse_transmission", in_frame); + bool specular_transmission = (bool)in_paramsArray.GetValue(L"autobump_specular_transmission", in_frame); + bool volume = (bool)in_paramsArray.GetValue(L"autobump_volume", in_frame); + + if (camera) autobump_visibility += AI_RAY_CAMERA; + if (diffuse_reflection) autobump_visibility += AI_RAY_DIFFUSE_REFLECT; + if (specular_reflection) autobump_visibility += AI_RAY_SPECULAR_REFLECT; + if (diffuse_transmission) autobump_visibility += AI_RAY_DIFFUSE_TRANSMIT; + if (specular_transmission) autobump_visibility += AI_RAY_SPECULAR_TRANSMIT; + if (volume) autobump_visibility += AI_RAY_VOLUME; + } + + return autobump_visibility; +} + // Evaluate the Arnold Matte property // // @param in_node The node diff --git a/plugins/sitoa/loader/Properties.h b/plugins/sitoa/loader/Properties.h index 88c6ded..87f19f4 100644 --- a/plugins/sitoa/loader/Properties.h +++ b/plugins/sitoa/loader/Properties.h @@ -25,6 +25,8 @@ uint8_t GetVisibility(const CRefArray &in_polyProperties, double in_frame, bool uint8_t GetVisibilityFromObject(const X3DObject in_obj, double in_frame, const bool in_checkHideMasterFlag=true); // Returns the rays visibility of an xsi object by its id uint8_t GetVisibilityFromObjectId(const int in_id, double in_frame, const bool in_checkHideMasterFlag=true); +// Returns the autobump visibility from Arnold Parameters +uint8_t GetAutobumpVisibility(CParameterRefArray &in_paramsArray, double in_frame); // Evaluates the Arnold Sidedness property and compute the sidedness bitfield. bool GetSidedness(const CRefArray &in_polyProperties, double in_frame, uint8_t &out_result); // Load the Arnold Parameters property for an Arnold node diff --git a/plugins/sitoa/loader/ShaderDef.cpp b/plugins/sitoa/loader/ShaderDef.cpp index 0100b13..8ac9640 100644 --- a/plugins/sitoa/loader/ShaderDef.cpp +++ b/plugins/sitoa/loader/ShaderDef.cpp @@ -117,7 +117,10 @@ siShaderReferenceFilterType GetShaderReferenceFilterType(CString in_type) else if (in_type == L"userdata") return siUserDataBlobReferenceFilter; else + { + GetMessageQueue()->LogMsg(L"[sitoa] Unknown ReferenceFilterType: \"" + in_type + L"\". Check your metadata file.", siWarningMsg); return siUnknownReferenceFilter; + } } @@ -226,35 +229,60 @@ void CShaderDefParameter::Define(ShaderParamDefContainer &in_paramDef, const CSt else if (!m_has_softmin && m_has_softmax) GetMessageQueue()->LogMsg(L"[sitoa] " + in_shader_name + L"." + m_name + " has softmax metadata, but no softmin.", siWarningMsg); - // if the Arnold type is an array, we create a single parameter of the type of the array elements - int paramType = m_type == AI_TYPE_ARRAY ? m_arrayType : m_type; - ShaderParamDef pDef; - if (m_type == AI_TYPE_CLOSURE) - pDef = in_paramDef.AddParamDef(m_name, L"closure", defOptions); - else + + bool paramIsArray = m_type == AI_TYPE_ARRAY; + int paramType = paramIsArray ? m_arrayType : m_type; + CString customNodeType = L""; + + // check for node type overrides + // strings can also be overriden to nodes + if ((paramType == AI_TYPE_STRING || paramType == AI_TYPE_NODE) && m_has_node_type) { - // adds the ability for string types to have a node picker - // also implements filter for the node types - if ((m_type == AI_TYPE_STRING || m_type == AI_TYPE_NODE) && m_has_node_type) - { - CStringArray nodeTypes = CStringUtilities().ToLower(m_node_type).Split(L" "); - defOptions.SetAttribute(siReferenceFilterAttribute, GetShaderReferenceFilterType(nodeTypes[0])); + // override node type be AI_TYPE_NODE + paramType = AI_TYPE_NODE; + CStringArray nodeTypes = CStringUtilities().ToLower(m_node_type).Split(L" "); + CString nodeType = nodeTypes[0]; - if (nodeTypes.GetCount() > 1) - { - if (nodeTypes[1] == L"array") - { - // shaderarrays doesn't use the label but uses SetLongName instead - // label has to be specified in .mtd or else it will just show the parameter name - if (m_has_label) - defOptions.SetLongName(m_label); + // force node type even if string (toon shader uses this) + paramType = AI_TYPE_NODE; + // set the reference filter type + defOptions.SetAttribute(siReferenceFilterAttribute, GetShaderReferenceFilterType(nodeType)); - pDef = in_paramDef.AddArrayParamDef(m_name, siShaderDataTypeReference, defOptions); - } + if (nodeTypes.GetCount() > 1) + { + if (nodeTypes[1] == L"array") + { + // if array is specified in the soft.node_type metadata, a parameter array will be created even though it's not an array in arnold + // toon shader uses this for lights, but it's data is converted to semicolon-delimited string on rendering/export + paramIsArray = true; } else - pDef = in_paramDef.AddParamDef(m_name, siShaderDataTypeReference, defOptions); + GetMessageQueue()->LogMsg(L"[sitoa] " + in_shader_name + L"." + m_name + " has unknown node type override: " + m_node_type, siWarningMsg); } + } + else if (paramType == AI_TYPE_CLOSURE) + customNodeType = L"closure"; + + ShaderParamDef pDef; + if (paramIsArray) + { + // shaderarrays doesn't use the label but uses SetLongName instead + CString label; + if (m_has_label) + label = m_label; + else + label = CStringUtilities().PrettifyParameterName(m_name); + defOptions.SetLongName(label); + + if (customNodeType != "") + pDef = in_paramDef.AddArrayParamDef(m_name, customNodeType, defOptions); + else + pDef = in_paramDef.AddArrayParamDef(m_name, GetParamSdType(paramType), defOptions); + } + else + { + if (customNodeType != "") + pDef = in_paramDef.AddParamDef(m_name, customNodeType, defOptions); else pDef = in_paramDef.AddParamDef(m_name, GetParamSdType(paramType), defOptions); } @@ -343,23 +371,7 @@ void CShaderDefParameter::Layout(PPGLayout &in_layout) if (m_has_label) label = m_label; else - { - // replace "_" with " ". "_" is very common in the Arnold nodes - // Ex: "emission_color" -> "emission color: - CString t_label = CStringUtilities().ReplaceString(L"_", L" ", m_name); - - // capitalize the first char of the name, and each token after a space, as we do for the SItoA shaders - // Ex: "emission color" -> "Emission Color: - for (ULONG i=0; i::iterator it; @@ -566,6 +581,8 @@ CString CShaderDefShader::Define(const bool in_clone_vector_map) if (m_is_passthrough_closure) // hack the closure output for the closure connector to color outParamDef.AddParamDef("out", siShaderDataTypeColor4, outOpts); + else if (m_is_operator_node) + outParamDef.AddParamDef("out", siShaderDataTypeReference, outOpts); else { if (m_type == AI_TYPE_CLOSURE) @@ -736,22 +753,7 @@ void CShaderDefShader::Layout() } // unfortunately the following does not work (in the case the definition already exists) else // if there is no specific desc metadata, set the help to the shader page - layout.PutAttribute(siUIHelpFile, m_has_desc ? m_desc : SITOA_SHADERS_URL); - - // setup ppg logic - layout.PutLanguage(L"JScript"); - if (m_name == L"closure") - { - // github issue #33 - // for closure connector node whenever it's inspected show the shader connected to it - layout.PutLogic( - L"function OnInit()\n" - L"{\n" - L" var src = PPG.closure.Source;\n" - L" if (src != null) InspectObj(src.Parent);\n" - L"}\n" - ); - } + layout.PutAttribute(siUIHelpFile, m_has_desc ? m_desc : SITOA_SHADERS_URL); } @@ -771,14 +773,19 @@ void CShaderDefSet::Load(const CString &in_plugin_origin_path) // load the plugins (installation, + the ones in the shader search path) GetRenderInstance()->GetPluginsSearchPath().Put(in_plugin_origin_path, true); GetRenderInstance()->GetPluginsSearchPath().LoadPlugins(); - // load the metadata file + // load the shader metadata file CString metadata_path = CUtils::BuildPath(in_plugin_origin_path, L"arnold_shaders.mtd"); bool metadata_exists = AiMetaDataLoadFile(metadata_path.GetAsciiString()); if (!metadata_exists) GetMessageQueue()->LogMsg(L"[sitoa] Missing shader metadata file " + metadata_path, siWarningMsg); + // load the operator metadata file + metadata_path = CUtils::BuildPath(in_plugin_origin_path, L"arnold_operators.mtd"); + metadata_exists = AiMetaDataLoadFile(metadata_path.GetAsciiString()); + if (!metadata_exists) + GetMessageQueue()->LogMsg(L"[sitoa] Missing operator metadata file " + metadata_path, siWarningMsg); // iterate the nodes - AtNodeEntryIterator* node_entry_it = AiUniverseGetNodeEntryIterator(AI_NODE_SHADER | AI_NODE_CAMERA); + AtNodeEntryIterator* node_entry_it = AiUniverseGetNodeEntryIterator(AI_NODE_SHADER | AI_NODE_CAMERA | AI_NODE_OPERATOR); while (!AiNodeEntryIteratorFinished(node_entry_it)) { AtNodeEntry* node_entry = AiNodeEntryIteratorGetNext(node_entry_it); @@ -806,6 +813,15 @@ void CShaderDefSet::Load(const CString &in_plugin_origin_path) if (shader_def.m_so_name == L"core" && shader_def.m_is_camera_node) continue; + // xsibatch needs to completely skip the shaders defined in ArnoldShaderDef.js + // there's no need to categorize them when in batch anyway + // https://github.com/Autodesk/sitoa/issues/77 + if (!Application().IsInteractive()) + { + if (node_name == L"set_parameter") + continue; + } + progId = shader_def.Define(); // build parameters and the UI if (!progId.IsEmpty()) // enter in the list only the shaders whose definition was actually created diff --git a/plugins/sitoa/loader/ShaderDef.h b/plugins/sitoa/loader/ShaderDef.h index 72c53df..bcf14ba 100644 --- a/plugins/sitoa/loader/ShaderDef.h +++ b/plugins/sitoa/loader/ShaderDef.h @@ -120,6 +120,7 @@ class CShaderDefShader CString m_so_name; // the so/dll file name bool m_is_camera_node; // is this a custom camera node? bool m_is_passthrough_closure; // is this the SItoA shader called "closure" ? + bool m_is_operator_node; // is this an operator node? bool m_has_skip; bool m_skip; @@ -144,6 +145,7 @@ class CShaderDefShader m_so_name(in_arg.m_so_name), m_is_camera_node(in_arg.m_is_camera_node), m_is_passthrough_closure(in_arg.m_is_passthrough_closure), + m_is_operator_node(in_arg.m_is_operator_node), m_has_skip(in_arg.m_has_skip), m_skip(in_arg.m_skip) { } diff --git a/plugins/sitoa/loader/Shaders.cpp b/plugins/sitoa/loader/Shaders.cpp index 14fe2f4..5d0fdec 100644 --- a/plugins/sitoa/loader/Shaders.cpp +++ b/plugins/sitoa/loader/Shaders.cpp @@ -399,6 +399,9 @@ CStatus LoadPassShaders(double in_frame, bool in_selectionOnly) Shader outputShader = GetConnectedShader(passParam); if (outputShader.IsValid()) { + // skip 'operator' dummy shader + if (GetShaderNameFromProgId(outputShader.GetProgID()) == L"operator") + continue; outputShadersArray.Add(outputShader.GetRef()); } } diff --git a/plugins/sitoa/renderer/DisplayDriver.cpp b/plugins/sitoa/renderer/DisplayDriver.cpp index 41c6e18..3bd5c12 100644 --- a/plugins/sitoa/renderer/DisplayDriver.cpp +++ b/plugins/sitoa/renderer/DisplayDriver.cpp @@ -203,6 +203,7 @@ driver_process_bucket // don't update progressbar if Main (RGBA) is being denoised if (!displayDriver->m_useOptixOnMain || + displayDriver->m_gpu || // TODO FIXIT: Temporary workaround for GPU to work with Optix Denoiser (displayDriver->m_useOptixOnMain && !strcmp(aov_name, "RGBA_denoise") == 0)) { @@ -381,6 +382,17 @@ void DisplayDriver::UpdateDisplayDriver(RendererContext& in_rendererContext, uns CString layerName = GetLayerName(renderchannel.GetName()); CString layerdataType; + // TODO FIXIT + // Temporary workaround for GPU to work with Optix Denoiser + // GPU can only work with one filter at the time, so we can only send the denoised output. + m_gpu = strcmp(AiNodeGetStr(options, "render_device"), "GPU") == 0; + if (layerName == L"RGBA" && m_useOptixOnMain && m_gpu) + { + layerName = L"RGBA_denoise"; + m_onlyShowDenoise = true; + } + // END TODO FIXIT + if (m_renderContext.GetAttribute(L"FileOutput")) { // Display Driver format will use the DataType of the MAIN framebuffer Softimage @@ -451,7 +463,7 @@ void DisplayDriver::UpdateDisplayDriver(RendererContext& in_rendererContext, uns // if layerName is RGBA (Main) and use_optix_on_main is ON, // we will add the denoised main to the new_outputs - if (layerName == "RGBA" && m_useOptixOnMain) + if (layerName == L"RGBA" && m_useOptixOnMain) { // we need to check if the optix filter exist. If it doesn't exist, we create one. CString optixFilterName = L"sitoa_RGBA_denoise_optix_filter_display"; diff --git a/plugins/sitoa/renderer/DisplayDriver.h b/plugins/sitoa/renderer/DisplayDriver.h index d3219a2..e6ed536 100644 --- a/plugins/sitoa/renderer/DisplayDriver.h +++ b/plugins/sitoa/renderer/DisplayDriver.h @@ -72,6 +72,7 @@ class DisplayDriver int m_paintedDisplayArea; bool m_useOptixOnMain; bool m_onlyShowDenoise; + bool m_gpu; // TODO FIXIT: Temporary workaround for GPU to work with Optix Denoiser }; diff --git a/plugins/sitoa/renderer/IprOperators.cpp b/plugins/sitoa/renderer/IprOperators.cpp new file mode 100644 index 0000000..ca45e68 --- /dev/null +++ b/plugins/sitoa/renderer/IprOperators.cpp @@ -0,0 +1,74 @@ +/************************************************************************************************************************************ +Copyright 2017 Autodesk, Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. +You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and limitations under the License. +************************************************************************************************************************************/ + +#include "common/ParamsShader.h" +#include "renderer/IprShader.h" +#include "renderer/Renderer.h" +#include "loader/Operators.h" + +#include +#include +#include +#include +#include + +// Update the operators connected to a RenderPass into Arnold +// +// @return CStatus::OK if all went well, else the error code +// +CStatus UpdatePassOperator(const Pass &in_pass, double in_frame) +{ + CStatus status(CStatus::OK); + + CRef outputStackRef; + outputStackRef.Set(in_pass.GetFullName() + L".OutputShaderStack"); + ShaderArrayParameter arrayParam = ShaderArrayParameter(outputStackRef); + + AtNode* options = AiUniverseGetOptions(); + + if (arrayParam.GetCount() > 0) + { + Shader operatorShader; + for (LONG i=0; i + +using namespace XSI; + +// Update operators into Arnold +CStatus UpdatePassOperator(const Pass &in_pass, double in_frame); diff --git a/plugins/sitoa/renderer/IprShader.cpp b/plugins/sitoa/renderer/IprShader.cpp index 036fe87..c7f33c4 100644 --- a/plugins/sitoa/renderer/IprShader.cpp +++ b/plugins/sitoa/renderer/IprShader.cpp @@ -309,6 +309,9 @@ void UpdatePassShaderStack(const Pass &in_pass, double in_frame) Shader outputShader = GetConnectedShader(passParam); if (outputShader.IsValid()) { + // skip 'operator' dummy shader + if (GetShaderNameFromProgId(outputShader.GetProgID()) == L"operator") + continue; outputShadersArray.Add(outputShader.GetRef()); } } diff --git a/plugins/sitoa/renderer/RenderInstance.cpp b/plugins/sitoa/renderer/RenderInstance.cpp index 605e83b..ba8c218 100644 --- a/plugins/sitoa/renderer/RenderInstance.cpp +++ b/plugins/sitoa/renderer/RenderInstance.cpp @@ -9,6 +9,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ************************************************************************************************************************************/ +#ifdef _WINDOWS +#include +#endif + #include "common/ParamsCamera.h" #include "common/Tools.h" #include "loader/Cameras.h" @@ -19,6 +23,7 @@ See the License for the specific language governing permissions and limitations #include "renderer/IprCommon.h" #include "renderer/IprCreateDestroy.h" #include "renderer/IprLight.h" +#include "renderer/IprOperators.h" #include "renderer/IprShader.h" #include "renderer/Renderer.h" #include "renderer/RenderInstance.h" @@ -205,7 +210,7 @@ unsigned int CRenderInstance::UpdateRenderRegion(unsigned int in_width, unsigned } -int CRenderInstance::RenderProgressiveScene() +int CRenderInstance::RenderProgressiveScene(int displayArea) { int render_result = AI_INTERRUPT; @@ -214,6 +219,7 @@ int CRenderInstance::RenderProgressiveScene() int aa_max = GetRenderOptions()->m_AA_samples; bool dither = GetRenderOptions()->m_dither; + int bucket_size = GetRenderOptions()->m_bucket_size; int verbosity = AiMsgGetConsoleFlags(); // current log level @@ -225,9 +231,29 @@ int CRenderInstance::RenderProgressiveScene() aa_steps.insert(-2); if ((aa_max > -1) && GetRenderOptions()->m_progressive_minus1) aa_steps.insert(-1); - // if progressive rendering, ignore the 1 aa step because that is already the first step in progressive - if (!GetRenderOptions()->m_enable_progressive_render) + + // calculate a good bucket size for the progressive passes so that the total number of buckets = CPU_cores * 2 + #ifdef _WINDOWS + int numCores = std::thread::hardware_concurrency(); +#else + int numCores = sysconf(_SC_NPROCESSORS_ONLN); +#endif + int progressiveBucketSize = AiMax(((int)sqrt(displayArea / (numCores*2))), bucket_size); + + AtNode* options = AiUniverseGetOptions(); + + // set a larger bucket size if we render progressive (or GPU), Github #67 + if (AiNodeGetBool(options, "enable_progressive_render")) { + if ((progressiveBucketSize > bucket_size) && GetRenderOptions()->m_larger_ipr_buckets) + { + CNodeSetter::SetInt(options, "bucket_size", progressiveBucketSize); + AiMsgInfo(CString(L"[sitoa] Bucket size have been enlarged to " + CString(progressiveBucketSize) + L" to get a faster response in Softimage Render Region.").GetAsciiString()); + } + } + else + { + // if not progressive rendering, we can set the 1 aa step if ((aa_max > 1) && GetRenderOptions()->m_progressive_plus1) aa_steps.insert(1); } @@ -235,7 +261,6 @@ int CRenderInstance::RenderProgressiveScene() aa_steps.insert(aa_max); // the main value for aa, so aa_steps is never empty, and aaMax will always be the final step used // We need to change some values of the aspect ratio and camera when we are in an IPR render - AtNode* options = AiUniverseGetOptions(); // override the aspect ratio, for the viewport is always 1.0 CNodeSetter::SetFloat(options, "pixel_aspect_ratio", 1.0); // disable adaptive sampling during negative aa passes @@ -370,6 +395,7 @@ CRef CRenderInstance::GetUpdateType(const CRef &in_ref, eUpdateType &out_updateT incompatible.Add(L"skip_license_check"); incompatible.Add(L"abort_on_license_fail"); incompatible.Add(L"export_pref"); + incompatible.Add(L"export_nref"); incompatible.Add(L"subdiv_smooth_derivs"); // #1240 incompatible.Add(L"procedurals_path"); @@ -1469,6 +1495,7 @@ CStatus CRenderInstance::ProcessRegion() return status; } + unsigned int displayArea; { // do not remove the {} as we need the local scope for the thread lock (see trac#1044) LockSceneData lock; if (lock.m_status != CStatus::OK) @@ -1484,6 +1511,8 @@ CStatus CRenderInstance::ProcessRegion() // We are going to update always what we have connected to current pass shader stack. UpdatePassShaderStack(m_pass, m_frame); + UpdatePassOperator(m_pass, m_frame); + CRefArray visibleObjects = m_renderContext.GetAttribute(L"ObjectList"); UpdateIsolateSelection(visibleObjects, m_frame); @@ -1511,7 +1540,7 @@ CStatus CRenderInstance::ProcessRegion() } // Updating RenderRegion and DisplayArea - unsigned int displayArea = UpdateRenderRegion(m_renderWidth, m_renderHeight); + displayArea = UpdateRenderRegion(m_renderWidth, m_renderHeight); // for these new render options (1.12), let's check their existance. Else, filterColorAov defaults to false, // and all the previously saved scenes render aliased @@ -1522,7 +1551,7 @@ CStatus CRenderInstance::ProcessRegion() SetLogSettings(L"Region", m_frame); } - int renderStatus = RenderProgressiveScene(); + int renderStatus = RenderProgressiveScene(displayArea); if (renderStatus != AI_SUCCESS) { diff --git a/plugins/sitoa/renderer/RenderInstance.h b/plugins/sitoa/renderer/RenderInstance.h index 0ee1b2c..563a9e3 100644 --- a/plugins/sitoa/renderer/RenderInstance.h +++ b/plugins/sitoa/renderer/RenderInstance.h @@ -212,7 +212,7 @@ class CRenderInstance // Create the directories for all the output filenames of all the buffers bool OutputDirectoryExists(); - int RenderProgressiveScene(); + int RenderProgressiveScene(int displayArea); // Detect what type of Update we have to do for the given Reference CRef GetUpdateType(const CRef &in_ref, eUpdateType &out_updateType); diff --git a/plugins/sitoa/renderer/Renderer.cpp b/plugins/sitoa/renderer/Renderer.cpp index ea628ee..9131c4a 100644 --- a/plugins/sitoa/renderer/Renderer.cpp +++ b/plugins/sitoa/renderer/Renderer.cpp @@ -211,8 +211,6 @@ SITOA_CALLBACK ArnoldRender_Query(CRef &in_ctxt) return CStatus::OK; } - - LockSceneData::LockSceneData() : m_renderer((Renderer) GetRenderInstance()->GetRendererRef()) { diff --git a/plugins/sitoa/renderer/RendererOptions.cpp b/plugins/sitoa/renderer/RendererOptions.cpp index c1a7fc9..8d6f18e 100644 --- a/plugins/sitoa/renderer/RendererOptions.cpp +++ b/plugins/sitoa/renderer/RendererOptions.cpp @@ -35,11 +35,17 @@ void CRenderOptions::Read(const Property &in_cp) m_autodetect_threads = (bool)ParAcc_GetValue(in_cp, L"autodetect_threads", DBL_MAX); m_threads = (int) ParAcc_GetValue(in_cp, L"threads", DBL_MAX); - m_gpu_default_names = ParAcc_GetValue(in_cp, L"gpu_default_names", DBL_MAX).GetAsText(); - m_gpu_default_min_memory_MB = (int) ParAcc_GetValue(in_cp, L"gpu_default_min_memory_MB", DBL_MAX); + m_render_device = ParAcc_GetValue(in_cp, L"render_device", DBL_MAX).GetAsText(); + m_render_device_fallback = ParAcc_GetValue(in_cp, L"render_device_fallback", DBL_MAX).GetAsText(); + m_gpu_max_texture_resolution = (int)ParAcc_GetValue(in_cp, L"gpu_max_texture_resolution", DBL_MAX); + m_gpu_default_names = ParAcc_GetValue(in_cp, L"gpu_default_names", DBL_MAX).GetAsText(); + m_gpu_default_min_memory_MB = (int)ParAcc_GetValue(in_cp, L"gpu_default_min_memory_MB", DBL_MAX); + m_enable_manual_devices = (bool)ParAcc_GetValue(in_cp, L"enable_manual_devices", DBL_MAX); + m_manual_device_selection = ParAcc_GetValue(in_cp, L"manual_device_selection", DBL_MAX).GetAsText(); m_bucket_scanning = ParAcc_GetValue(in_cp, L"bucket_scanning", DBL_MAX).GetAsText(); m_bucket_size = (int)ParAcc_GetValue(in_cp, L"bucket_size", DBL_MAX); + m_larger_ipr_buckets = (bool)ParAcc_GetValue(in_cp, L"larger_ipr_buckets", DBL_MAX); m_progressive_minus3 = (bool)ParAcc_GetValue(in_cp, L"progressive_minus3", DBL_MAX); m_progressive_minus2 = (bool)ParAcc_GetValue(in_cp, L"progressive_minus2", DBL_MAX); m_progressive_minus1 = (bool)ParAcc_GetValue(in_cp, L"progressive_minus1", DBL_MAX); @@ -146,6 +152,7 @@ void CRenderOptions::Read(const Property &in_cp) m_motion_step_deform = (int) ParAcc_GetValue(in_cp, L"motion_step_deform", DBL_MAX); m_exact_ice_mb = (bool)ParAcc_GetValue(in_cp, L"exact_ice_mb", DBL_MAX); + m_ignore_motion_blur = (bool)ParAcc_GetValue(in_cp, L"ignore_motion_blur", DBL_MAX); m_motion_shutter_length = (float)ParAcc_GetValue(in_cp, L"motion_shutter_length", DBL_MAX); m_motion_shutter_custom_start = (float)ParAcc_GetValue(in_cp, L"motion_shutter_custom_start", DBL_MAX); m_motion_shutter_custom_end = (float)ParAcc_GetValue(in_cp, L"motion_shutter_custom_end", DBL_MAX); @@ -209,7 +216,7 @@ void CRenderOptions::Read(const Property &in_cp) m_ignore_displacement = (bool)ParAcc_GetValue(in_cp, L"ignore_displacement", DBL_MAX); m_ignore_bump = (bool)ParAcc_GetValue(in_cp, L"ignore_bump", DBL_MAX); m_ignore_smoothing = (bool)ParAcc_GetValue(in_cp, L"ignore_smoothing", DBL_MAX); - m_ignore_motion_blur = (bool)ParAcc_GetValue(in_cp, L"ignore_motion_blur", DBL_MAX); + m_ignore_motion = (bool)ParAcc_GetValue(in_cp, L"ignore_motion", DBL_MAX); m_ignore_dof = (bool)ParAcc_GetValue(in_cp, L"ignore_dof", DBL_MAX); m_ignore_sss = (bool)ParAcc_GetValue(in_cp, L"ignore_sss", DBL_MAX); m_ignore_hair = (bool)ParAcc_GetValue(in_cp, L"ignore_hair", DBL_MAX); @@ -217,6 +224,7 @@ void CRenderOptions::Read(const Property &in_cp) m_ignore_procedurals = (bool)ParAcc_GetValue(in_cp, L"ignore_procedurals", DBL_MAX); m_ignore_user_options = (bool)ParAcc_GetValue(in_cp, L"ignore_user_options", DBL_MAX); m_ignore_matte = (bool)ParAcc_GetValue(in_cp, L"ignore_matte", DBL_MAX); + m_ignore_operators = (bool)ParAcc_GetValue(in_cp, L"ignore_operators", DBL_MAX); // ass archive m_output_file_tagdir_ass = ParAcc_GetValue(in_cp, L"output_file_tagdir_ass", DBL_MAX).GetAsText(); @@ -232,6 +240,7 @@ void CRenderOptions::Read(const Property &in_cp) m_output_cameras = (bool)ParAcc_GetValue(in_cp, L"output_cameras", DBL_MAX); m_output_lights = (bool)ParAcc_GetValue(in_cp, L"output_lights", DBL_MAX); m_output_shaders = (bool)ParAcc_GetValue(in_cp, L"output_shaders", DBL_MAX); + m_output_operators = (bool)ParAcc_GetValue(in_cp, L"output_operators", DBL_MAX); // denoiser m_use_optix_on_main = (bool)ParAcc_GetValue(in_cp, L"use_optix_on_main", DBL_MAX); @@ -313,11 +322,17 @@ SITOA_CALLBACK CommonRenderOptions_Define(CRef& in_ctxt) cpset.AddParameter(L"autodetect_threads", CValue::siBool, siPersistable, L"", L"", true, CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"threads", CValue::siInt4, siPersistable, L"", L"", 4, -AI_MAX_THREADS, AI_MAX_THREADS, 1, AI_MAX_THREADS, p); - cpset.AddParameter(L"gpu_default_names", CValue::siString, siPersistable, L"", L"", L"*", CValue(), CValue(), CValue(), CValue(), p); - cpset.AddParameter(L"gpu_default_min_memory_MB", CValue::siInt4, siPersistable, L"", L"", 512, 0, 10000000, 256, 1024, p); + cpset.AddParameter(L"render_device", CValue::siString, siPersistable, L"", L"", L"CPU", CValue(), CValue(), CValue(), CValue(), p); + cpset.AddParameter(L"render_device_fallback", CValue::siString, siPersistable, L"", L"", L"error", CValue(), CValue(), CValue(), CValue(), p); + cpset.AddParameter(L"gpu_max_texture_resolution", CValue::siInt4, siPersistable, L"", L"", 0, 0, 10000000, 0, 8192, p); + cpset.AddParameter(L"gpu_default_names", CValue::siString, siPersistable, L"", L"", L"*", CValue(), CValue(), CValue(), CValue(), p); + cpset.AddParameter(L"gpu_default_min_memory_MB", CValue::siInt4, siPersistable, L"", L"", 512, 0, 10000000, 256, 1024, p); + cpset.AddParameter(L"enable_manual_devices", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); + cpset.AddParameter(L"manual_device_selection", CValue::siString, siPersistable, L"", L"", L"", CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"bucket_scanning", CValue::siString, siPersistable, L"", L"", L"spiral", CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"bucket_size", CValue::siInt4, siPersistable, L"", L"", 64, 16, 256, 16, 256, p); + cpset.AddParameter(L"larger_ipr_buckets", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"progressive_minus3", CValue::siBool, siPersistable, L"", L"", true, CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"progressive_minus2", CValue::siBool, siPersistable, L"", L"", true, CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"progressive_minus1", CValue::siBool, siPersistable, L"", L"", true, CValue(), CValue(), CValue(), CValue(), p); @@ -410,8 +425,8 @@ SITOA_CALLBACK CommonRenderOptions_Define(CRef& in_ctxt) cpset.AddParameter(L"enable_progressive_render", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"enable_adaptive_sampling", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); - cpset.AddParameter(L"AA_samples_max", CValue::siInt4, siPersistable, L"", L"", 8, -3, 100, 0, 10, p); - cpset.AddParameter(L"AA_adaptive_threshold", CValue::siDouble, siPersistable, L"", L"", 0.05f, 0.0f, 1.0f, 0.0f, 100.0f, p); + cpset.AddParameter(L"AA_samples_max", CValue::siInt4, siPersistable, L"", L"", 20, -3, 1000, 0, 50, p); + cpset.AddParameter(L"AA_adaptive_threshold", CValue::siDouble, siPersistable, L"", L"", 0.015f, 0.0f, 1.0f, 0.0f, 0.1f, p); cpset.AddParameter(L"indirect_specular_blur", CValue::siDouble, siPersistable | siAnimatable, L"", L"", 1.0f, 0.0f, 2.0f, 0.0f, 100.0f, p); @@ -433,6 +448,7 @@ SITOA_CALLBACK CommonRenderOptions_Define(CRef& in_ctxt) cpset.AddParameter(L"enable_motion_deform", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"motion_step_deform", CValue::siInt4, siPersistable, L"", L"", 2, 2, 200, 2, 15, p); cpset.AddParameter(L"exact_ice_mb", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); + cpset.AddParameter(L"ignore_motion_blur", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"motion_shutter_length", CValue::siDouble, siPersistable | siAnimatable, L"", L"", 0.5f , 0, 999999, 0, 2, p); cpset.AddParameter(L"motion_shutter_custom_start", CValue::siDouble, siPersistable | siAnimatable, L"", L"", -0.25f , -100, 100, -100, 100, p); cpset.AddParameter(L"motion_shutter_custom_end", CValue::siDouble, siPersistable | siAnimatable, L"", L"", 0.25f , -100, 100, -100, 100, p); @@ -496,7 +512,7 @@ SITOA_CALLBACK CommonRenderOptions_Define(CRef& in_ctxt) cpset.AddParameter(L"ignore_displacement", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"ignore_bump", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"ignore_smoothing", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); - cpset.AddParameter(L"ignore_motion_blur", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); + cpset.AddParameter(L"ignore_motion", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"ignore_dof", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"ignore_sss", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"ignore_hair", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); @@ -504,6 +520,7 @@ SITOA_CALLBACK CommonRenderOptions_Define(CRef& in_ctxt) cpset.AddParameter(L"ignore_procedurals", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"ignore_user_options", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"ignore_matte", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); + cpset.AddParameter(L"ignore_operators", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"show_samples", CValue::siString, siPersistable, L"", L"", L"off", 0, 10, 0, 10, p); // ass archive @@ -521,6 +538,7 @@ SITOA_CALLBACK CommonRenderOptions_Define(CRef& in_ctxt) cpset.AddParameter(L"output_cameras", CValue::siBool, siPersistable, L"", L"", true, CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"output_lights", CValue::siBool, siPersistable, L"", L"", true, CValue(), CValue(), CValue(), CValue(), p); cpset.AddParameter(L"output_shaders", CValue::siBool, siPersistable, L"", L"", true, CValue(), CValue(), CValue(), CValue(), p); + cpset.AddParameter(L"output_operators", CValue::siBool, siPersistable, L"", L"", true, CValue(), CValue(), CValue(), CValue(), p); // denoiser cpset.AddParameter(L"use_optix_on_main", CValue::siBool, siPersistable, L"", L"", false, CValue(), CValue(), CValue(), CValue(), p); @@ -612,10 +630,31 @@ SITOA_CALLBACK CommonRenderOptions_DefineLayout(CRef& in_ctxt) item.PutAttribute(siUILabelPercentage, 100); layout.EndGroup(); layout.AddGroup(L"Devices"); - item = layout.AddItem(L"gpu_default_names", L"GPU Names"); - item.PutAttribute(siUILabelMinPixels, 100); - item = layout.AddItem(L"gpu_default_min_memory_MB", L"Min. Memory (MB)"); - item.PutAttribute(siUILabelMinPixels, 100); + CValueArray devices; + devices.Add(L"CPU"); devices.Add(L"CPU"); + devices.Add(L"GPU (BETA)"); devices.Add(L"GPU"); + item = layout.AddEnumControl(L"render_device", devices, L"Render Device", siControlCombo); + item.PutAttribute(siUILabelMinPixels, 120); + CValueArray device_fallbacks; + device_fallbacks.Add(L"error"); device_fallbacks.Add(L"error"); + device_fallbacks.Add(L"CPU"); device_fallbacks.Add(L"CPU"); + item = layout.AddEnumControl(L"render_device_fallback", device_fallbacks, L"Render Device Fallback", siControlCombo); + item.PutAttribute(siUILabelMinPixels, 120); + item = layout.AddItem(L"gpu_max_texture_resolution", L"Max Texture Resolution"); + item.PutAttribute(siUILabelMinPixels, 120); + layout.AddGroup(L"Auto Device Selection"); + item = layout.AddItem(L"gpu_default_names", L"GPU Names"); + item.PutAttribute(siUILabelMinPixels, 120); + item = layout.AddItem(L"gpu_default_min_memory_MB", L"Min. Memory (MB)"); + item.PutAttribute(siUILabelMinPixels, 120); + layout.EndGroup(); + layout.AddGroup(L"Manual Device Selection"); + layout.AddItem(L"enable_manual_devices", L"Enable Manual Device Selection"); + item = layout.AddItem(L"manual_device_selection", L"", siControlListBox); + item.PutAttribute(siUIMultiSelectionListBox, true); + item.PutAttribute(siUIValueOnly, true); // hide label + item.PutAttribute(siUICY, 60); + layout.EndGroup(); layout.EndGroup(); layout.AddGroup(L"Buckets", true, 0); CValueArray scanning; @@ -629,6 +668,7 @@ SITOA_CALLBACK CommonRenderOptions_DefineLayout(CRef& in_ctxt) item.PutAttribute(siUIWidthPercentage, 60); layout.AddItem(L"bucket_size", L"Size"); layout.EndRow(); + layout.AddItem(L"larger_ipr_buckets", L"Enlarge buckets in progressive IPR"); layout.EndGroup(); layout.AddGroup(L"Progressive Refinement", true, 0); layout.AddRow(); @@ -898,6 +938,7 @@ SITOA_CALLBACK CommonRenderOptions_DefineLayout(CRef& in_ctxt) item = layout.AddItem(L"exact_ice_mb", L"Exact ICE Blur"); layout.AddGroup(L"Geometry Shutter", true, 0); + item = layout.AddItem(L"ignore_motion_blur", L"Instantaneous Shutter (overrides camera settings)"); CValueArray onFrame, shutterType; onFrame.Add(L"Start on Frame"); onFrame.Add(eMbPos_Start); onFrame.Add(L"Center on Frame"); onFrame.Add(eMbPos_Center); @@ -1070,7 +1111,7 @@ SITOA_CALLBACK CommonRenderOptions_DefineLayout(CRef& in_ctxt) layout.AddItem(L"ignore_displacement", L"Displacement"); layout.AddItem(L"ignore_bump", L"Bump"); layout.AddItem(L"ignore_smoothing", L"Normal Smoothing"); - layout.AddItem(L"ignore_motion_blur", L"Motion Blur"); + layout.AddItem(L"ignore_motion", L"Motion"); layout.AddItem(L"ignore_dof", L"Depth of Field"); layout.AddItem(L"ignore_sss", L"Sub-Surface Scattering"); layout.AddItem(L"ignore_hair", L"Hair"); @@ -1078,6 +1119,7 @@ SITOA_CALLBACK CommonRenderOptions_DefineLayout(CRef& in_ctxt) layout.AddItem(L"ignore_procedurals", L"Procedurals"); layout.AddItem(L"ignore_user_options", L"User Options"); layout.AddItem(L"ignore_matte", L"Matte Properties"); + layout.AddItem(L"ignore_operators", L"Operators"); layout.EndGroup(); layout.AddTab(L"ASS Archives"); @@ -1104,6 +1146,7 @@ SITOA_CALLBACK CommonRenderOptions_DefineLayout(CRef& in_ctxt) layout.AddItem(L"output_cameras", L"Cameras"); layout.AddItem(L"output_lights", L"Lights"); layout.AddItem(L"output_shaders", L"Shaders"); + layout.AddItem(L"output_operators", L"Operators"); layout.EndGroup(); layout.AddRow(); item = layout.AddButton(L"ExportASS", L"Export Frame"); @@ -1160,6 +1203,7 @@ SITOA_CALLBACK CommonRenderOptions_PPGEvent(const CRef& in_ctxt) MotionBlurTabLogic(cpset); SamplingTabLogic(cpset); SystemTabLogic(cpset); + DeviceSelectionLogic(cpset); OutputTabLogic(cpset); TexturesTabLogic(cpset); ColorManagersTabLogic(cpset, ctxt); @@ -1326,6 +1370,7 @@ SITOA_CALLBACK CommonRenderOptions_PPGEvent(const CRef& in_ctxt) if (paramName == L"enable_motion_blur" || paramName == L"enable_motion_deform" || + paramName == L"ignore_motion_blur" || paramName == L"motion_shutter_onframe") MotionBlurTabLogic(cpset); @@ -1334,7 +1379,8 @@ SITOA_CALLBACK CommonRenderOptions_PPGEvent(const CRef& in_ctxt) paramName == L"output_filter") SamplingTabLogic(cpset); - else if (paramName == L"autodetect_threads") + else if (paramName == L"autodetect_threads" || + paramName == L"render_device") SystemTabLogic(cpset); else if (paramName == L"overscan" || @@ -1395,19 +1441,22 @@ void MotionBlurTabLogic(CustomProperty &in_cp) // Enabling / Disabling Blur settings bool transfOn = (bool)ParAcc_GetValue(in_cp, L"enable_motion_blur", DBL_MAX); bool defOn = (bool)ParAcc_GetValue(in_cp, L"enable_motion_deform", DBL_MAX); + bool ignoreMB = (bool)ParAcc_GetValue(in_cp, L"ignore_motion_blur", DBL_MAX); bool transfOrDefOn = transfOn || defOn; + bool shuttersOn = transfOrDefOn && !ignoreMB; int onFrame = (int)ParAcc_GetValue(in_cp, L"motion_shutter_onframe", DBL_MAX); - bool customOn = transfOrDefOn && (onFrame == eMbPos_Custom); - bool lengthOn = transfOrDefOn && (onFrame != eMbPos_Custom); + bool customOn = shuttersOn && (onFrame == eMbPos_Custom); + bool lengthOn = shuttersOn && (onFrame != eMbPos_Custom); ParAcc_GetParameter(in_cp, L"motion_step_transform").PutCapabilityFlag(siReadOnly, !transfOn); ParAcc_GetParameter(in_cp, L"motion_step_deform").PutCapabilityFlag(siReadOnly, !defOn); ParAcc_GetParameter(in_cp, L"exact_ice_mb").PutCapabilityFlag(siReadOnly, !defOn); + ParAcc_GetParameter(in_cp, L"ignore_motion_blur").PutCapabilityFlag(siReadOnly, !transfOrDefOn); + ParAcc_GetParameter(in_cp, L"motion_shutter_onframe").PutCapabilityFlag(siReadOnly, !shuttersOn); ParAcc_GetParameter(in_cp, L"motion_shutter_length").PutCapabilityFlag(siReadOnly, !lengthOn); ParAcc_GetParameter(in_cp, L"motion_shutter_custom_start").PutCapabilityFlag(siReadOnly, !customOn); ParAcc_GetParameter(in_cp, L"motion_shutter_custom_end").PutCapabilityFlag(siReadOnly, !customOn); - ParAcc_GetParameter(in_cp, L"motion_shutter_onframe").PutCapabilityFlag(siReadOnly, !transfOrDefOn); } @@ -1446,6 +1495,47 @@ void SystemTabLogic(CustomProperty &in_cp) { bool autoDetect = (bool)ParAcc_GetValue(in_cp, L"autodetect_threads", DBL_MAX); ParAcc_GetParameter(in_cp, L"threads").PutCapabilityFlag(siReadOnly, autoDetect); + + // GPU logic + bool useGPU = (bool)(ParAcc_GetValue(in_cp, L"render_device", DBL_MAX) == L"GPU"); + ParAcc_GetParameter(in_cp, L"render_device_fallback").PutCapabilityFlag(siReadOnly, !useGPU); + ParAcc_GetParameter(in_cp, L"gpu_max_texture_resolution").PutCapabilityFlag(siReadOnly, !useGPU); + // When rendering with GPU, disable all secondary sample params on the Sampling tab + ParAcc_GetParameter(in_cp, L"GI_diffuse_samples").PutCapabilityFlag(siReadOnly, useGPU); + ParAcc_GetParameter(in_cp, L"GI_specular_samples").PutCapabilityFlag(siReadOnly, useGPU); + ParAcc_GetParameter(in_cp, L"GI_transmission_samples").PutCapabilityFlag(siReadOnly, useGPU); + ParAcc_GetParameter(in_cp, L"GI_sss_samples").PutCapabilityFlag(siReadOnly, useGPU); + ParAcc_GetParameter(in_cp, L"GI_volume_samples").PutCapabilityFlag(siReadOnly, useGPU); + ParAcc_GetParameter(in_cp, L"enable_progressive_render").PutCapabilityFlag(siReadOnly, useGPU); +} + + +// Logic for Manual Device Selection in the system tab +// +// @param in_cp The arnold rendering options property +// +void DeviceSelectionLogic(CustomProperty &in_cp) +{ + // Get a list of GPU rendering devices + const AtArray* gpuDeviceIdsArray = AiDeviceGetIds(AI_DEVICE_TYPE_GPU); + int gpuDeviceCount = AiArrayGetNumElements(gpuDeviceIdsArray); + CValueArray gpuDevices(gpuDeviceCount*2); + + for (LONG i=0; i #define SITOA_MAJOR_VERSION_NUM 5 -#define SITOA_MINOR_VERSION_NUM 2 +#define SITOA_MINOR_VERSION_NUM 4 #define SITOA_FIX_VERSION L"0" diff --git a/shaders/metadata/arnold_shaders.mtd b/shaders/metadata/arnold_shaders.mtd index 8f256b9..768ad66 100644 --- a/shaders/metadata/arnold_shaders.mtd +++ b/shaders/metadata/arnold_shaders.mtd @@ -85,6 +85,34 @@ desc STRING "If on, the tracing works in inclusive mode, else in exclusive, as d [attr self_only] desc STRING "Gather occlusion against the shaded object only." +############################################################################## +[node aov_read_float] +soft.category STRING "AOV" + +[attr aov_name] +desc STRING "Name of the AOV." + +############################################################################## +[node aov_read_int] +soft.category STRING "AOV" + +[attr aov_name] +desc STRING "Name of the AOV." + +############################################################################## +[node aov_read_rgb] +soft.category STRING "AOV" + +[attr aov_name] +desc STRING "Name of the AOV." + +############################################################################## +[node aov_read_rgba] +soft.category STRING "AOV" + +[attr aov_name] +desc STRING "Name of the AOV." + ############################################################################## [node aov_write_float] soft.label STRING "AOV Write Float" @@ -216,6 +244,7 @@ softmax FLOAT 1 [attr normal] desc STRING "The shader to be evaluated after the normal perturbation has been completed. Then, the perturbed normals are restored.\nIf this method is used the bump2d node should be connected to the surface parameter of the output node and not bump." +soft.inspectable BOOL false ############################################################################## [node bump3d] @@ -239,6 +268,7 @@ softmax FLOAT 1 [attr normal] desc STRING "The shader to be evaluated after the normal perturbation has been done is specified here. Optionally, a shader to specify the color and/or reflectance can be specified here, allowing the node to be connected to the Surface slot of the material (rather than connecting bump3d to the Bump Map slot and the other shader to the Surface slot separately). This may be useful in some situations." +soft.inspectable BOOL false ############################################################################## [node cache] @@ -246,7 +276,7 @@ soft.category STRING "Utility" ############################################################################## [node camera_projection] -soft.category STRING "Texture" +soft.category STRING "Utility" [attr camera] desc STRING "The projecting camera. Leave blank to use the default render camera." @@ -281,6 +311,14 @@ desc STRING "Use the shading normal for visibility tests instead of the " "boundaries that can produce seams if the render camera is used for the " "projection." +[attr coord_space] +desc STRING "Specifies the coordinate space to use." + +[attr pref_name] +desc STRING "Specify the name of the reference position user-data array. Previously, the name was hard-coded as 'Pref', which is still the default. The array type can be RGB/RGBA as well as VECTOR." + +[attr P] + ############################################################################## [node car_paint] soft.category STRING "Surface" @@ -580,6 +618,19 @@ desc STRING "The minimum value for the color channels to be used in the output." [attr max_color] desc STRING "The maximum value for the color channels to be used in the output." +############################################################################## +[node clip_geo] +soft.category STRING "Utility" + +[attr intersection] +desc STRING "The color or shader applied to the result of the clipping." + +[attr trace_set] +desc STRING "It is possible to tag objects to be part of one or many trace sets. You can use trace sets to control which objects are clipped." + +[attr inclusive] +desc STRING "If on, the tracing works in inclusive mode, else in exclusive, as described above." + # SItoA specific ############################################################################## [node closure] @@ -1383,6 +1434,7 @@ desc STRING "Controls how opaque the shader is." [attr normal] desc STRING "If linked, the normal to use." +soft.inspectable BOOL false ############################################################################## [node layer_float] @@ -1868,14 +1920,68 @@ desc STRING "Input to calcute logarithm of." [attr base] desc STRING "Base for use in logarithm calculation." +############################################################################## +[node matrix_interpolate] +soft.category STRING "Math" + +[attr matrix] +desc STRING "The transformation matrix." + +[attr type] +desc STRING "Determines how to interpolate the matrix. This parameter is set to 'time' by default, which uses the current time inside the shutter range and allows to get motion blurred matrices in the shading tree." + +[attr value] +desc STRING "The value used to interpolate between the matrices." +min FLOAT 0 +max FLOAT 1 + ############################################################################## [node matrix_multiply_vector] soft.category STRING "Math" +[attr input] +desc STRING "The vector to transform." + +[attr type] +desc STRING "Specify a vector type (point, vector or normal). For the vector and normal type, the translation component is ignored. For the normal type the inverse transpose matrix is used to avoid streching the normals." + +[attr matrix] +desc STRING "The transformation matrix." + ############################################################################## [node matrix_transform] soft.category STRING "Math" +[attr transform_order] +desc STRING "Transform order of the Scale, Rotation and Translate can be modified." + +[attr rotation_type] +desc STRING "Rotation can be set using Euler-Angles or Axis/Angle." + +[attr units] +desc STRING "Rotation units, set to Radians or Degrees." + +[attr rotation_order] +desc STRING "The axes order in which the rotations are applied." + +[attr rotation] +desc STRING "The rotation angles about the X, Y and Z axes." + +[attr axis] +desc STRING "The direction of the axis of rotation." + +[attr angle] +desc STRING "The rotation angle." + +[attr translate] +desc STRING "The XYZ translation vector used to compose the transformation matrix." + +[attr scale] +desc STRING "The XYZ scaling vector used to compose the transformation matrix." + +[attr pivot] +desc STRING "The XYZ controls that allow you to offset the pivot." + ############################################################################## [node matte] soft.category STRING "Surface" @@ -2188,11 +2294,12 @@ soft.inspectable BOOL false ############################################################################## [node physical_sky] soft.category STRING "Environment" -soft.order STRING "use_degrees azimuth elevation sun_direction enable_sun sun_size sun_tint sky_tint ground_albedo intensity turbidity X Y Z" +soft.order STRING "turbidity ground_albedo use_degrees azimuth elevation sun_direction enable_sun sun_size sun_tint sky_tint intensity " +"BeginGroup Orientation X Y Z EndGroup" [attr use_degrees] linkable BOOL false -soft.label STRING "Azimuth / Elevation" +soft.label STRING "Use Azimuth / Elevation" desc STRING "Switch between Azimuth/Elevation mode and Direction for defining the sun position. " [attr azimuth] @@ -2868,7 +2975,7 @@ soft.order STRING "BeginGroup Base base base_color diffuse_roughness metalness E "BeginGroup Specular specular specular_color specular_roughness specular_IOR specular_anisotropy specular_rotation EndGroup " "BeginGroup Transmission transmission transmission_color transmission_depth transmission_scatter transmission_scatter_anisotropy transmission_dispersion transmission_extra_roughness transmit_aovs EndGroup " "BeginGroup Subsurface subsurface subsurface_color subsurface_radius subsurface_scale subsurface_type subsurface_anisotropy EndGroup " -"BeginGroup Coat coat coat_color coat_roughness coat_IOR coat_normal coat_affect_color coat_affect_roughness EndGroup " +"BeginGroup Coat coat coat_color coat_roughness coat_IOR coat_normal coat_anisotropy coat_rotation coat_affect_color coat_affect_roughness EndGroup " "BeginGroup Sheen sheen sheen_color sheen_roughness EndGroup " "BeginGroup Thin_Film thin_film_thickness thin_film_IOR EndGroup " "BeginGroup Emission emission emission_color EndGroup " @@ -2988,7 +3095,7 @@ softmax FLOAT 100 [attr transmission_extra_roughness] desc STRING "Additional refraction blurriness." soft.label STRING "Extra Roughness" -min FLOAT 0 +min FLOAT -1 max FLOAT 1 [attr transmit_aovs] @@ -3071,6 +3178,18 @@ desc STRING "Affects the Fresnel blending of the coat over the base, so dependin soft.label STRING "Normal" soft.inspectable BOOL false +[attr coat_anisotropy] +desc STRING "Anisotropy." +soft.label STRING "Anisotropy" +min FLOAT 0 +max FLOAT 1 + +[attr coat_rotation] +desc STRING "Rotation." +soft.label STRING "Rotation" +softmin FLOAT 0 +softmax FLOAT 1 + [attr coat_affect_color] desc STRING "Affect Color." soft.label STRING "Affect Color" @@ -3917,6 +4036,42 @@ soft.label STRING "Front Material" desc STRING "The material when the surface normal is opposite to the camera." soft.label STRING "Back Material" +############################################################################## +[node uv_projection] +soft.category STRING "Utility" + +[attr projection_color] +desc STRING "The 2D texture to be used as a map." + +[attr projection_type] + +[attr cord_space] +desc STRING "Specifies the coordinate space to use." + +[attr pref_name] +desc STRING "Specify the name of the reference position user-data array. Previously, the name was hard-coded as 'Pref', which is still the default. The array type can be RGB/RGBA as well as VECTOR." + +[attr P] + +[attr u_angle] +desc STRING "Changes the U angle (for spherical and cylindrical mapping only)." +softmin FLOAT 0 +softmax FLOAT 360 + +[attr v_angle] +desc STRING "Changes the V angle (for spherical mapping only)." +softmin FLOAT 0 +softmax FLOAT 360 + +[attr clamp] +desc STRING "Only applies the projection if the position is inside a unit box/sphere/cylinder (depending on the projection mode), otherwise uses the Default Color (disabled by default)." + +[attr default_color] +desc STRING "The color to be used for unmapped points." + +[attr matrix] +desc STRING "Defines the 3D texture’s positioning and orientation in world space." + ############################################################################## [node user_data_float] soft.category STRING "User Data" diff --git a/testsuite/XSIProject/Scenes/test_0268/README b/testsuite/XSIProject/Scenes/test_0268/README new file mode 100644 index 0000000..cf9805c --- /dev/null +++ b/testsuite/XSIProject/Scenes/test_0268/README @@ -0,0 +1,5 @@ +Pass Operators + +Github #19 and #68 + +author: Steven Caron and Jens Lindgren diff --git a/testsuite/XSIProject/Scenes/test_0268/data/test.scn b/testsuite/XSIProject/Scenes/test_0268/data/test.scn new file mode 100644 index 0000000..8f3c5a1 Binary files /dev/null and b/testsuite/XSIProject/Scenes/test_0268/data/test.scn differ diff --git a/testsuite/XSIProject/Scenes/test_0268/ref/reference.log b/testsuite/XSIProject/Scenes/test_0268/ref/reference.log new file mode 100644 index 0000000..734e136 --- /dev/null +++ b/testsuite/XSIProject/Scenes/test_0268/ref/reference.log @@ -0,0 +1,57 @@ +======================================================= + Autodesk Softimage 13.2.163.0 +======================================================= + +License information: using [Processing] +00:00:00 204MB | log started Sat Apr 13 14:59:16 2019 +00:00:00 204MB | Arnold 5.3.0.2 [f7602f75] windows icc-17.0.2 oiio-2.1.0 osl-1.11.0 vdb-4.0.0 clm-1.0.3.513 rlm-12.4.2 optix-6.0.0 2019/04/09 17:16:44 +00:00:00 204MB | running on Jenus, pid=25616 +00:00:00 204MB | 1 x Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz (4 cores, 8 logical) with 16333MB +00:00:00 204MB | NVIDIA driver version 419.67 +00:00:00 204MB | GPU 0: GeForce GTX 1070 @ 1771MHz (compute 6.1) with 8192MB (6646MB available) (NVLink:0) +00:00:00 204MB | Windows 8 Professional (version 6.2, build 9200) +00:00:00 204MB | soft limit for open files raised from 512 to 2048 +00:00:00 204MB | +00:00:00 204MB | loading plugins from C:\Users\lindg\GitHub\sitoa\dist\Softimage_2015_SP2\Addons\SItoA\Application\Plugins\bin\nt-x86-64\..\plugins ... +00:00:00 204MB | loaded 4 plugins from 2 lib(s) in 0:00.00 +00:00:00 204MB | loading plugins from C:\Users\lindg\GitHub\sitoa\dist\Softimage_2015_SP2\Addons\SItoA\Application\Plugins\bin\nt-x86-64 ... +00:00:00 205MB | loaded 103 plugins from 1 lib(s) in 0:00.03 + + + + +00:00:00 213MB | +00:00:00 213MB | releasing resources +00:00:00 212MB | Arnold shutdown +// INFO : [sitoa] SItoA 5.3.0 win loaded. +// INFO : [sitoa] Arnold 5.3.0.2 detected. +InstallCustomPreferences("ArnoldRenderPreferences", "Arnold Render"); +COMMAND: -processing -script "execute_test.js" -main main +// INFO : C:\Users\lindg\GitHub\sitoa\dist\Softimage_2015_SP2\Addons\SItoA\Application\Plugins\bin\nt-x86-64\ +>Loading: C:\Users\lindg\GitHub\sitoa\build\windows_x86_64\msvc_opt\si_13000\testsuite\test_0268\test.scn... +// INFO : 4034 - Loaded scene was created with build number: 13.2.163.0 - compatibility version: 1300 +OpenScene("C:\\Users\\lindg\\GitHub\\sitoa\\build\\windows_x86_64\\msvc_opt\\si_13000\\testsuite\\test_0268\\test.scn", null, null); +SetValue("Passes.RenderOptions.ImageLockAspectRatio", false, null); +SetValue("Passes.RenderOptions.ImageWidth", 160, null); +SetValue("Passes.RenderOptions.ImageHeight", 120, null); +SetValue("Passes.Default_Pass.Main.Filename", "C:\\Users\\lindg\\GitHub\\sitoa\\build\\windows_x86_64\\msvc_opt\\si_13000\\testsuite\\test_0268\\testrender.####.tif", null); +SetValue("Passes.Default_Pass.Main.Format", "tif", null); +SetValue("Passes.Arnold_Render_Options.output_tiff_tiled", 0, null); +SetValue("Passes.Arnold_Render_Options.enable_log_file", true, null); +SetValue("Passes.Arnold_Render_Options.log_level", 1, null); +SetValue("Passes.Arnold_Render_Options.output_file_tagdir_log", "C:\\Users\\lindg\\GitHub\\sitoa\\build\\windows_x86_64\\msvc_opt\\si_13000\\testsuite\\test_0268", null); +SetValue("Passes.Arnold_Render_Options.textures_path", "C:\\Users\\lindg\\GitHub\\sitoa\\testsuite\\XSIProject\\Pictures", null); +SetValue("Passes.Arnold_Render_Options.save_texture_paths", false, null); +// INFO : Rendering pass 'Default_Pass'... +// INFO : Rendering frame 1 (0.0% done) +// INFO : [sitoa] Frame 1 exported to Arnold in 0.112 sec. +// INFO : Render completed (100% done) +RenderAllPasses(null, null, null, null, siRenderVerbosityDefault); +Warning: return value of the executed script is not an integer +// INFO : Characters has been unloaded. +// INFO : polymatricksPlugin has been unloaded. +// INFO : [sitoa] SItoA 5.3.0 win has been unloaded. +// INFO : TransformUVsPlugin has been unloaded. +// INFO : FBX-XSI import/export Plug-in has been unloaded. +// INFO : Unfold3D Plugin has been unloaded. + diff --git a/testsuite/XSIProject/Scenes/test_0268/ref/reference.tif b/testsuite/XSIProject/Scenes/test_0268/ref/reference.tif new file mode 100644 index 0000000..26bc83a Binary files /dev/null and b/testsuite/XSIProject/Scenes/test_0268/ref/reference.tif differ diff --git a/testsuite/XSIProject/Scenes/test_0269/README b/testsuite/XSIProject/Scenes/test_0269/README new file mode 100644 index 0000000..36e23d0 --- /dev/null +++ b/testsuite/XSIProject/Scenes/test_0269/README @@ -0,0 +1,5 @@ +Visible area lights + +Github #63 and #68 + +author: Jens Lindgren diff --git a/testsuite/XSIProject/Scenes/test_0269/data/test.scn b/testsuite/XSIProject/Scenes/test_0269/data/test.scn new file mode 100644 index 0000000..a5ce1a6 Binary files /dev/null and b/testsuite/XSIProject/Scenes/test_0269/data/test.scn differ diff --git a/testsuite/XSIProject/Scenes/test_0269/ref/reference.log b/testsuite/XSIProject/Scenes/test_0269/ref/reference.log new file mode 100644 index 0000000..ca3e0a6 --- /dev/null +++ b/testsuite/XSIProject/Scenes/test_0269/ref/reference.log @@ -0,0 +1,57 @@ +======================================================= + Autodesk Softimage 13.2.163.0 +======================================================= + +License information: using [Processing] +00:00:00 204MB | log started Fri May 3 00:57:25 2019 +00:00:00 204MB | Arnold 5.3.0.2 [f7602f75] windows icc-17.0.2 oiio-2.1.0 osl-1.11.0 vdb-4.0.0 clm-1.0.3.513 rlm-12.4.2 optix-6.0.0 2019/04/09 17:16:44 +00:00:00 204MB | running on Jenus, pid=57608 +00:00:00 204MB | 1 x Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz (4 cores, 8 logical) with 16333MB +00:00:00 204MB | NVIDIA driver version 419.67 +00:00:00 204MB | GPU 0: GeForce GTX 1070 @ 1771MHz (compute 6.1) with 8192MB (6905MB available) (NVLink:0) +00:00:00 204MB | Windows 8 Professional (version 6.2, build 9200) +00:00:00 204MB | soft limit for open files raised from 512 to 2048 +00:00:00 204MB | +00:00:00 204MB | loading plugins from C:\Users\lindg\GitHub\sitoa\dist\Softimage_2015_SP2\Addons\SItoA\Application\Plugins\bin\nt-x86-64\..\plugins ... +00:00:00 204MB | loaded 4 plugins from 2 lib(s) in 0:00.00 +00:00:00 204MB | loading plugins from C:\Users\lindg\GitHub\sitoa\dist\Softimage_2015_SP2\Addons\SItoA\Application\Plugins\bin\nt-x86-64 ... +00:00:00 204MB | loaded 103 plugins from 1 lib(s) in 0:00.03 + + + + +00:00:00 211MB | +00:00:00 211MB | releasing resources +00:00:00 211MB | Arnold shutdown +# INFO : [sitoa] SItoA 5.3.0 win loaded. +# INFO : [sitoa] Arnold 5.3.0.2 detected. +Application.RefreshCustomPreferences() +COMMAND: -processing -script "execute_test.js" -main main +# INFO : C:\Users\lindg\GitHub\sitoa\dist\Softimage_2015_SP2\Addons\SItoA\Application\Plugins\bin\nt-x86-64\ +>Loading: C:\Users\lindg\GitHub\sitoa\build\windows_x86_64\msvc_opt\si_13000\testsuite\test_0269\test.scn... +# INFO : 4034 - Loaded scene was created with build number: 13.2.163.0 - compatibility version: 1300 +Application.OpenScene("C:\\Users\\lindg\\GitHub\\sitoa\\build\\windows_x86_64\\msvc_opt\\si_13000\\testsuite\\test_0269\\test.scn", "", "") +Application.SetValue("Passes.RenderOptions.ImageLockAspectRatio", False, "") +Application.SetValue("Passes.RenderOptions.ImageWidth", 160, "") +Application.SetValue("Passes.RenderOptions.ImageHeight", 120, "") +Application.SetValue("Passes.Default_Pass.Main.Filename", "C:\\Users\\lindg\\GitHub\\sitoa\\build\\windows_x86_64\\msvc_opt\\si_13000\\testsuite\\test_0269\\testrender.####.tif", "") +Application.SetValue("Passes.Default_Pass.Main.Format", "tif", "") +Application.SetValue("Passes.Arnold_Render_Options.output_tiff_tiled", 0, "") +Application.SetValue("Passes.Arnold_Render_Options.enable_log_file", True, "") +Application.SetValue("Passes.Arnold_Render_Options.log_level", 1, "") +Application.SetValue("Passes.Arnold_Render_Options.output_file_tagdir_log", "C:\\Users\\lindg\\GitHub\\sitoa\\build\\windows_x86_64\\msvc_opt\\si_13000\\testsuite\\test_0269", "") +Application.SetValue("Passes.Arnold_Render_Options.textures_path", "C:\\Users\\lindg\\GitHub\\sitoa\\testsuite\\XSIProject\\Pictures", "") +Application.SetValue("Passes.Arnold_Render_Options.save_texture_paths", False, "") +# INFO : Rendering pass 'Default_Pass'... +# INFO : Rendering frame 1 (0.0% done) +# INFO : [sitoa] Frame 1 exported to Arnold in 0.092 sec. +# INFO : Render completed (100% done) +Application.RenderAllPasses("", "", "", "", "siRenderVerbosityDefault") +Warning: return value of the executed script is not an integer +# INFO : Characters has been unloaded. +# INFO : polymatricksPlugin has been unloaded. +# INFO : [sitoa] SItoA 5.3.0 win has been unloaded. +# INFO : TransformUVsPlugin has been unloaded. +# INFO : FBX-XSI import/export Plug-in has been unloaded. +# INFO : Unfold3D Plugin has been unloaded. + diff --git a/testsuite/XSIProject/Scenes/test_0269/ref/reference.tif b/testsuite/XSIProject/Scenes/test_0269/ref/reference.tif new file mode 100644 index 0000000..c41a87b Binary files /dev/null and b/testsuite/XSIProject/Scenes/test_0269/ref/reference.tif differ diff --git a/testsuite/XSIProject/Scenes/test_0270/README b/testsuite/XSIProject/Scenes/test_0270/README new file mode 100644 index 0000000..07761f4 --- /dev/null +++ b/testsuite/XSIProject/Scenes/test_0270/README @@ -0,0 +1,5 @@ +Autobump visibility + +Github #63 and #68 + +author: Jens Lindgren diff --git a/testsuite/XSIProject/Scenes/test_0270/data/test.scn b/testsuite/XSIProject/Scenes/test_0270/data/test.scn new file mode 100644 index 0000000..26c8925 Binary files /dev/null and b/testsuite/XSIProject/Scenes/test_0270/data/test.scn differ diff --git a/testsuite/XSIProject/Scenes/test_0270/ref/reference.log b/testsuite/XSIProject/Scenes/test_0270/ref/reference.log new file mode 100644 index 0000000..11c5c5a --- /dev/null +++ b/testsuite/XSIProject/Scenes/test_0270/ref/reference.log @@ -0,0 +1,57 @@ +======================================================= + Autodesk Softimage 13.2.163.0 +======================================================= + +License information: using [Processing] +00:00:00 203MB | log started Thu May 2 23:55:18 2019 +00:00:00 203MB | Arnold 5.3.0.2 [f7602f75] windows icc-17.0.2 oiio-2.1.0 osl-1.11.0 vdb-4.0.0 clm-1.0.3.513 rlm-12.4.2 optix-6.0.0 2019/04/09 17:16:44 +00:00:00 203MB | running on Jenus, pid=37272 +00:00:00 203MB | 1 x Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz (4 cores, 8 logical) with 16333MB +00:00:00 203MB | NVIDIA driver version 419.67 +00:00:00 203MB | GPU 0: GeForce GTX 1070 @ 1771MHz (compute 6.1) with 8192MB (6914MB available) (NVLink:0) +00:00:00 203MB | Windows 8 Professional (version 6.2, build 9200) +00:00:00 203MB | soft limit for open files raised from 512 to 2048 +00:00:00 203MB | +00:00:00 203MB | loading plugins from C:\Users\lindg\GitHub\sitoa\dist\Softimage_2015_SP2\Addons\SItoA\Application\Plugins\bin\nt-x86-64\..\plugins ... +00:00:00 203MB | loaded 4 plugins from 2 lib(s) in 0:00.00 +00:00:00 203MB | loading plugins from C:\Users\lindg\GitHub\sitoa\dist\Softimage_2015_SP2\Addons\SItoA\Application\Plugins\bin\nt-x86-64 ... +00:00:00 204MB | loaded 103 plugins from 1 lib(s) in 0:00.03 + + + + +00:00:00 211MB | +00:00:00 211MB | releasing resources +00:00:00 211MB | Arnold shutdown +# INFO : [sitoa] SItoA 5.3.0 win loaded. +# INFO : [sitoa] Arnold 5.3.0.2 detected. +Application.RefreshCustomPreferences() +COMMAND: -processing -script "execute_test.js" -main main +# INFO : C:\Users\lindg\GitHub\sitoa\dist\Softimage_2015_SP2\Addons\SItoA\Application\Plugins\bin\nt-x86-64\ +>Loading: C:\Users\lindg\GitHub\sitoa\build\windows_x86_64\msvc_opt\si_13000\testsuite\test_0270\test.scn... +# INFO : 4034 - Loaded scene was created with build number: 13.2.163.0 - compatibility version: 1300 +Application.OpenScene("C:\\Users\\lindg\\GitHub\\sitoa\\build\\windows_x86_64\\msvc_opt\\si_13000\\testsuite\\test_0270\\test.scn", "", "") +Application.SetValue("Passes.RenderOptions.ImageLockAspectRatio", False, "") +Application.SetValue("Passes.RenderOptions.ImageWidth", 160, "") +Application.SetValue("Passes.RenderOptions.ImageHeight", 120, "") +Application.SetValue("Passes.Default_Pass.Main.Filename", "C:\\Users\\lindg\\GitHub\\sitoa\\build\\windows_x86_64\\msvc_opt\\si_13000\\testsuite\\test_0270\\testrender.####.tif", "") +Application.SetValue("Passes.Default_Pass.Main.Format", "tif", "") +Application.SetValue("Passes.Arnold_Render_Options.output_tiff_tiled", 0, "") +Application.SetValue("Passes.Arnold_Render_Options.enable_log_file", True, "") +Application.SetValue("Passes.Arnold_Render_Options.log_level", 1, "") +Application.SetValue("Passes.Arnold_Render_Options.output_file_tagdir_log", "C:\\Users\\lindg\\GitHub\\sitoa\\build\\windows_x86_64\\msvc_opt\\si_13000\\testsuite\\test_0270", "") +Application.SetValue("Passes.Arnold_Render_Options.textures_path", "C:\\Users\\lindg\\GitHub\\sitoa\\testsuite\\XSIProject\\Pictures", "") +Application.SetValue("Passes.Arnold_Render_Options.save_texture_paths", False, "") +# INFO : Rendering pass 'Default_Pass'... +# INFO : Rendering frame 1 (0.0% done) +# INFO : [sitoa] Frame 1 exported to Arnold in 0.104 sec. +# INFO : Render completed (100% done) +Application.RenderAllPasses("", "", "", "", "siRenderVerbosityDefault") +Warning: return value of the executed script is not an integer +# INFO : Characters has been unloaded. +# INFO : polymatricksPlugin has been unloaded. +# INFO : [sitoa] SItoA 5.3.0 win has been unloaded. +# INFO : TransformUVsPlugin has been unloaded. +# INFO : FBX-XSI import/export Plug-in has been unloaded. +# INFO : Unfold3D Plugin has been unloaded. + diff --git a/testsuite/XSIProject/Scenes/test_0270/ref/reference.tif b/testsuite/XSIProject/Scenes/test_0270/ref/reference.tif new file mode 100644 index 0000000..1615438 Binary files /dev/null and b/testsuite/XSIProject/Scenes/test_0270/ref/reference.tif differ diff --git a/testsuite/XSIProject/Scenes/test_0271/README b/testsuite/XSIProject/Scenes/test_0271/README new file mode 100644 index 0000000..da92f5f --- /dev/null +++ b/testsuite/XSIProject/Scenes/test_0271/README @@ -0,0 +1,5 @@ +GPU rendering + +Github #63 and #68 + +author: Jens Lindgren diff --git a/testsuite/XSIProject/Scenes/test_0271/data/test.scn b/testsuite/XSIProject/Scenes/test_0271/data/test.scn new file mode 100644 index 0000000..6d5dfbd Binary files /dev/null and b/testsuite/XSIProject/Scenes/test_0271/data/test.scn differ diff --git a/testsuite/XSIProject/Scenes/test_0271/ref/reference.log b/testsuite/XSIProject/Scenes/test_0271/ref/reference.log new file mode 100644 index 0000000..b53de0b --- /dev/null +++ b/testsuite/XSIProject/Scenes/test_0271/ref/reference.log @@ -0,0 +1,57 @@ +======================================================= + Autodesk Softimage 13.2.163.0 +======================================================= + +License information: using [Processing] +00:00:00 204MB | log started Fri May 3 00:29:18 2019 +00:00:00 204MB | Arnold 5.3.0.2 [f7602f75] windows icc-17.0.2 oiio-2.1.0 osl-1.11.0 vdb-4.0.0 clm-1.0.3.513 rlm-12.4.2 optix-6.0.0 2019/04/09 17:16:44 +00:00:00 204MB | running on Jenus, pid=54740 +00:00:00 204MB | 1 x Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz (4 cores, 8 logical) with 16333MB +00:00:00 204MB | NVIDIA driver version 419.67 +00:00:00 204MB | GPU 0: GeForce GTX 1070 @ 1771MHz (compute 6.1) with 8192MB (6842MB available) (NVLink:0) +00:00:00 204MB | Windows 8 Professional (version 6.2, build 9200) +00:00:00 204MB | soft limit for open files raised from 512 to 2048 +00:00:00 204MB | +00:00:00 204MB | loading plugins from C:\Users\lindg\GitHub\sitoa\dist\Softimage_2015_SP2\Addons\SItoA\Application\Plugins\bin\nt-x86-64\..\plugins ... +00:00:00 204MB | loaded 4 plugins from 2 lib(s) in 0:00.00 +00:00:00 204MB | loading plugins from C:\Users\lindg\GitHub\sitoa\dist\Softimage_2015_SP2\Addons\SItoA\Application\Plugins\bin\nt-x86-64 ... +00:00:00 205MB | loaded 103 plugins from 1 lib(s) in 0:00.03 + + + + +00:00:00 213MB | +00:00:00 213MB | releasing resources +00:00:00 212MB | Arnold shutdown +# INFO : [sitoa] SItoA 5.3.0 win loaded. +# INFO : [sitoa] Arnold 5.3.0.2 detected. +Application.InstallCustomPreferences("ArnoldRenderPreferences", "Arnold Render") +COMMAND: -processing -script "execute_test.js" -main main +# INFO : C:\Users\lindg\GitHub\sitoa\dist\Softimage_2015_SP2\Addons\SItoA\Application\Plugins\bin\nt-x86-64\ +>Loading: C:\Users\lindg\GitHub\sitoa\build\windows_x86_64\msvc_opt\si_13000\testsuite\test_0271\test.scn... +# INFO : 4034 - Loaded scene was created with build number: 13.2.163.0 - compatibility version: 1300 +Application.OpenScene("C:\\Users\\lindg\\GitHub\\sitoa\\build\\windows_x86_64\\msvc_opt\\si_13000\\testsuite\\test_0271\\test.scn", "", "") +Application.SetValue("Passes.RenderOptions.ImageLockAspectRatio", False, "") +Application.SetValue("Passes.RenderOptions.ImageWidth", 160, "") +Application.SetValue("Passes.RenderOptions.ImageHeight", 120, "") +Application.SetValue("Passes.Default_Pass.Main.Filename", "C:\\Users\\lindg\\GitHub\\sitoa\\build\\windows_x86_64\\msvc_opt\\si_13000\\testsuite\\test_0271\\testrender.####.tif", "") +Application.SetValue("Passes.Default_Pass.Main.Format", "tif", "") +Application.SetValue("Passes.Arnold_Render_Options.output_tiff_tiled", 0, "") +Application.SetValue("Passes.Arnold_Render_Options.enable_log_file", True, "") +Application.SetValue("Passes.Arnold_Render_Options.log_level", 1, "") +Application.SetValue("Passes.Arnold_Render_Options.output_file_tagdir_log", "C:\\Users\\lindg\\GitHub\\sitoa\\build\\windows_x86_64\\msvc_opt\\si_13000\\testsuite\\test_0271", "") +Application.SetValue("Passes.Arnold_Render_Options.textures_path", "C:\\Users\\lindg\\GitHub\\sitoa\\testsuite\\XSIProject\\Pictures", "") +Application.SetValue("Passes.Arnold_Render_Options.save_texture_paths", False, "") +# INFO : Rendering pass 'Default_Pass'... +# INFO : Rendering frame 1 (0.0% done) +# INFO : [sitoa] Frame 1 exported to Arnold in 0.095 sec. +# INFO : Render completed (100% done) +Application.RenderAllPasses("", "", "", "", "siRenderVerbosityDefault") +Warning: return value of the executed script is not an integer +# INFO : Characters has been unloaded. +# INFO : polymatricksPlugin has been unloaded. +# INFO : [sitoa] SItoA 5.3.0 win has been unloaded. +# INFO : TransformUVsPlugin has been unloaded. +# INFO : FBX-XSI import/export Plug-in has been unloaded. +# INFO : Unfold3D Plugin has been unloaded. + diff --git a/testsuite/XSIProject/Scenes/test_0271/ref/reference.tif b/testsuite/XSIProject/Scenes/test_0271/ref/reference.tif new file mode 100644 index 0000000..79e1e60 Binary files /dev/null and b/testsuite/XSIProject/Scenes/test_0271/ref/reference.tif differ diff --git a/testsuite/XSIProject/Scenes/test_0272/README b/testsuite/XSIProject/Scenes/test_0272/README new file mode 100644 index 0000000..17c914b --- /dev/null +++ b/testsuite/XSIProject/Scenes/test_0272/README @@ -0,0 +1,5 @@ +Export Nref + +Github #78 + +author: Jens Lindgren diff --git a/testsuite/XSIProject/Scenes/test_0272/data/test.scn b/testsuite/XSIProject/Scenes/test_0272/data/test.scn new file mode 100644 index 0000000..a4d6ea3 Binary files /dev/null and b/testsuite/XSIProject/Scenes/test_0272/data/test.scn differ diff --git a/testsuite/XSIProject/Scenes/test_0272/ref/reference.log b/testsuite/XSIProject/Scenes/test_0272/ref/reference.log new file mode 100644 index 0000000..73156e8 --- /dev/null +++ b/testsuite/XSIProject/Scenes/test_0272/ref/reference.log @@ -0,0 +1,57 @@ +======================================================= + Autodesk Softimage 13.2.163.0 +======================================================= + +License information: using [Processing] +00:00:00 208MB | log started Fri Aug 16 00:23:54 2019 +00:00:00 208MB | Arnold 5.4.0.0 [b7d9819c] windows icc-17.0.2 oiio-2.1.0 osl-1.11.0 vdb-4.0.0 clm-1.0.3.513 rlm-12.4.2 optix-6.0.0 2019/07/26 08:50:52 +00:00:00 208MB | running on Jenus, pid=33684 +00:00:00 208MB | 1 x Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz (4 cores, 8 logical) with 16333MB +00:00:00 208MB | NVIDIA driver version 430.86 (Optix 60102) +00:00:00 208MB | GPU 0: GeForce GTX 1070 @ 1771MHz (compute 6.1) with 8192MB (6789MB available) (NVLink:0) +00:00:00 208MB | Windows 8 Professional (version 6.2, build 9200) +00:00:00 208MB | soft limit for open files raised from 512 to 2048 +00:00:00 208MB | +00:00:00 208MB | loading plugins from C:\Users\lindg\GitHub\sitoa\dist\Softimage_2015_SP2\Addons\SItoA\Application\Plugins\bin\nt-x86-64\..\plugins ... +00:00:00 208MB | loaded 4 plugins from 2 lib(s) in 0:00.00 +00:00:00 208MB | loading plugins from C:\Users\lindg\GitHub\sitoa\dist\Softimage_2015_SP2\Addons\SItoA\Application\Plugins\bin\nt-x86-64 ... +00:00:00 209MB | loaded 103 plugins from 1 lib(s) in 0:00.03 + + + + +00:00:00 217MB | +00:00:00 217MB | releasing resources +00:00:00 215MB | Arnold shutdown +// INFO : [sitoa] SItoA 5.4.0 win loaded. +// INFO : [sitoa] Arnold 5.4.0.0 detected. +InstallCustomPreferences("ArnoldRenderPreferences", "Arnold Render"); +COMMAND: -processing -script "execute_test.js" -main main +// INFO : C:\Users\lindg\GitHub\sitoa\dist\Softimage_2015_SP2\Addons\SItoA\Application\Plugins\bin\nt-x86-64\ +>Loading: C:\Users\lindg\GitHub\sitoa\build\windows_x86_64\msvc_opt\si_13000\testsuite\test_0272\test.scn... +// INFO : 4034 - Loaded scene was created with build number: 13.2.163.0 - compatibility version: 1300 +OpenScene("C:\\Users\\lindg\\GitHub\\sitoa\\build\\windows_x86_64\\msvc_opt\\si_13000\\testsuite\\test_0272\\test.scn", null, null); +SetValue("Passes.RenderOptions.ImageLockAspectRatio", false, null); +SetValue("Passes.RenderOptions.ImageWidth", 160, null); +SetValue("Passes.RenderOptions.ImageHeight", 120, null); +SetValue("Passes.Default_Pass.Main.Filename", "C:\\Users\\lindg\\GitHub\\sitoa\\build\\windows_x86_64\\msvc_opt\\si_13000\\testsuite\\test_0272\\testrender.####.tif", null); +SetValue("Passes.Default_Pass.Main.Format", "tif", null); +SetValue("Passes.Arnold_Render_Options.output_tiff_tiled", 0, null); +SetValue("Passes.Arnold_Render_Options.enable_log_file", true, null); +SetValue("Passes.Arnold_Render_Options.log_level", 1, null); +SetValue("Passes.Arnold_Render_Options.output_file_tagdir_log", "C:\\Users\\lindg\\GitHub\\sitoa\\build\\windows_x86_64\\msvc_opt\\si_13000\\testsuite\\test_0272", null); +SetValue("Passes.Arnold_Render_Options.textures_path", "C:\\Users\\lindg\\GitHub\\sitoa\\testsuite\\XSIProject\\Pictures", null); +SetValue("Passes.Arnold_Render_Options.save_texture_paths", false, null); +// INFO : Rendering pass 'Default_Pass'... +// INFO : Rendering frame 1 (0.0% done) +// INFO : [sitoa] Frame 1 exported to Arnold in 0.137 sec. +// INFO : Render completed (100% done) +RenderAllPasses(null, null, null, null, siRenderVerbosityDefault); +Warning: return value of the executed script is not an integer +// INFO : Characters has been unloaded. +// INFO : polymatricksPlugin has been unloaded. +// INFO : [sitoa] SItoA 5.4.0 win has been unloaded. +// INFO : TransformUVsPlugin has been unloaded. +// INFO : FBX-XSI import/export Plug-in has been unloaded. +// INFO : Unfold3D Plugin has been unloaded. + diff --git a/testsuite/XSIProject/Scenes/test_0272/ref/reference.tif b/testsuite/XSIProject/Scenes/test_0272/ref/reference.tif new file mode 100644 index 0000000..af0860f Binary files /dev/null and b/testsuite/XSIProject/Scenes/test_0272/ref/reference.tif differ