Skip to content

Commit

Permalink
Merge pull request #5822 from murraystevenson/delightUsdShaderConversion
Browse files Browse the repository at this point in the history
3Delight ShaderNetworkAlgo : Translate UsdPreviewSurface to 3Delight
  • Loading branch information
johnhaddon authored Apr 30, 2024
2 parents 33839a4 + fce4876 commit cb1ca56
Show file tree
Hide file tree
Showing 14 changed files with 1,113 additions and 69 deletions.
2 changes: 2 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ Improvements
- AttributeTweaks, CameraTweaks, ShaderTweaks, OptionTweaks, PrimitiveVariableTweaks :
- Added support for a `{source}` token which is substituted with the original value when tweaking a string in `Replace` mode.
- Added tooltips documenting the tweak modes.
- 3Delight : Added automatic render-time translation of UsdPreviewSurface shaders to 3Delight.

Fixes
-----

- Viewer : Fixed Cycles shader balls.
- TweakPlug : Fixed incorrect results and potential crashes in list modes.
- USD : Fixed `Unsupported value type "StringData" for parameter "input"` warning when converting `UsdTransform2d` shaders with no `in` connections to Arnold.

API
---
Expand Down
1 change: 1 addition & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,7 @@ libraries = {
],
},
"pythonEnvAppends" : {
"CPPPATH" : [ "$DELIGHT_ROOT/include" ],
"LIBS" : [ "IECoreScene$CORTEX_LIB_SUFFIX", "IECoreDelight" ],
},
"requiredOptions" : [ "DELIGHT_ROOT" ],
Expand Down
7 changes: 7 additions & 0 deletions include/IECoreDelight/ShaderNetworkAlgo.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

#include "IECoreScene/ShaderNetwork.h"

#include <nsi.h>

namespace IECoreDelight
{

Expand All @@ -54,6 +56,11 @@ const char *lightGeometryType( const IECoreScene::ShaderNetwork *shaderNetwork )
/// `state` is used to store the current state and avoid unnecessary edits.
void updateLightGeometry( const IECoreScene::ShaderNetwork *shaderNetwork, NSIContext_t context, const char *handle, IECore::MurmurHash &state );

/// Converts any UsdPreviewSurface shaders and UsdLuxLights into native 3Delight shaders. This conversion
/// is performed automatically by `preprocessedNetwork()` and is mainly just exposed for the unit
/// tests.
IECOREDELIGHT_API void convertUSDShaders( IECoreScene::ShaderNetwork *shaderNetwork );

} // namespace ShaderNetworkAlgo

} // namespace IECoreDelight
15 changes: 0 additions & 15 deletions python/IECoreDelight/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,3 @@
del os, pathlib # Don't pollute the namespace

from ._IECoreDelight import *

# The IECoreDelight module does not need any symbols from IECoreDelight, so MSVC tries
# to be helpful and not load IECoreDelight.dll. Skipping that means that
# 3Delight is never registered as a renderer, so we import / register it manually.

import os

if os.name == "nt" :

import ctypes

try :
ctypes.CDLL( "IECoreDelight.dll" )
except :
raise ImportError
Loading

0 comments on commit cb1ca56

Please sign in to comment.