Skip to content

Commit

Permalink
Shader Ball and shaderView update
Browse files Browse the repository at this point in the history
  • Loading branch information
ezequielmastrasso committed Apr 15, 2020
1 parent a466105 commit c72cc41
Show file tree
Hide file tree
Showing 30 changed files with 169,780 additions and 79 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ A shader ball scene, Shader, displacement plugs and subdiv options plug.

### ShaderView
Replaces the default ShaderBall scene node in the ShaderView, with the pixar Teapot or your own geometry.

<img width="100%" src="docs/images/gafferShaderView.png" alt="EZSurfacing Tools" style="margin-right: 10px;" />
This ShaderView scene, is also available as the ArnoldLDTShaderBall Node.
<img width="100%" src="docs/images/gafferShaderView2.png" alt="EZSurfacing Tools" style="margin-right: 10px;" />
This ShaderView scene, is also available as the ArnoldLDTShaderBall Node.


### ShadingModes
Expand Down
618 changes: 618 additions & 0 deletions plugins/gaffer/boxes/LDTShaderBall.grf

Large diffs are not rendered by default.

File renamed without changes.
48 changes: 19 additions & 29 deletions plugins/gaffer/python/GafferArnoldLDT/ArnoldLDTShaderBall.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,65 +10,55 @@ class ArnoldLDTShaderBall(GafferSceneLDT.LDTShaderBall):
def __init__(self, name="ArnoldLDTShaderBall"):

GafferSceneLDT.LDTShaderBall.__init__(self, name)
print "ArnoldLDTShaderBall Loaded"
self["environment"] = Gaffer.StringPlug(
defaultValue="${GAFFER_ROOT}/resources/hdri/studio.exr"
)
self["exposure"] = Gaffer.FloatPlug(defaultValue=0)


self["__envMap"] = GafferArnold.ArnoldShader()
self["__envMap"].loadShader("image")
self["__envMap"]["parameters"]["filename"].setInput(
self["environment"]
)
)

self["__skyDome"] = GafferArnold.ArnoldLight()
self["__skyDome"].loadShader("skydome_light")
self["__skyDome"]["parameters"]["color"].setInput(
self["__envMap"]["out"]
)
)
self["__skyDome"]["parameters"]["format"].setValue(
"latlong"
)
self["__skyDome"]["parameters"][
"exposure"
].setInput(self["exposure"])
self["__skyDome"]["parameters"]["camera"].setValue(
0
)
)
self.addChild(self["__skyDome"]["parameters"]["exposure"].createCounterpart(
"exposure", Gaffer.Plug.Direction.In
)
)
self["__skyDome"]["parameters"]["exposure"].setInput(
self["exposure"]
)

self["__parentLights"] = GafferScene.Parent()
self["__parentLights"]["in"].setInput(
self._outPlug().getInput()
)
)
self["__parentLights"]["child"].setInput(
self["__skyDome"]["out"]
)
)
self["__parentLights"]["parent"].setValue("/")

self[
"__arnoldOptions"
] = GafferArnold.ArnoldOptions()
self["__arnoldOptions"]["in"].setInput(
self["__parentLights"]["out"]
)
self["__arnoldOptions"]["options"]["aaSamples"][
"enabled"
].setValue(True)
self["__arnoldOptions"]["options"]["aaSamples"][
"value"
].setValue(3)
self["__arnoldOptions"]["options"]["aaSamples"]["enabled"].setValue(True)
self["__arnoldOptions"]["options"]["aaSamples"]["value"].setValue(3)

self.addChild(
self["__arnoldOptions"]["options"][
"threads"
].createCounterpart(
"threads", Gaffer.Plug.Direction.In
self.addChild(self["__arnoldOptions"]["options"]["threads"].createCounterpart(
"threads", Gaffer.Plug.Direction.In
)
)
)
self["__arnoldOptions"]["options"][
"threads"
].setInput(self["threads"])
self["__arnoldOptions"]["options"]["threads"].setInput(self["threads"])

self._outPlug().setInput(
self["__arnoldOptions"]["out"]
Expand Down
91 changes: 44 additions & 47 deletions plugins/gaffer/python/GafferSceneLDT/LDTShaderBall.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,73 +19,67 @@ def __init__(self, name="LDTShaderBall"):
self["resolution"] = Gaffer.IntPlug(
defaultValue=512, minValue=0
)

self["scene"] = Gaffer.IntPlug("scene")
Gaffer.Metadata.registerValue( self["scene"], 'nodule:type', '' )
Gaffer.Metadata.registerValue( self["scene"], 'plugValueWidget:type', 'GafferUI.PresetsPlugValueWidget' )
Gaffer.Metadata.registerValue( self["scene"], 'preset:shaderBall', 0 )
Gaffer.Metadata.registerValue( self["scene"], 'preset:customGeo', 1 )

self["custom_geo"] = Gaffer.StringPlug(
defaultValue="${LOOKDEVTOOLS}/resources/abc/teapot.abc"
)
self["custom_geo_scale"] = Gaffer.FloatPlug(
defaultValue=1.0
defaultValue="${LOOKDEVTOOLS}/resources/assets/teapot/teapot.abc"
)

# Private internal network

# ShaderBall
s = Gaffer.ScriptNode()
__shaderBallReference = s["__shaderBallReference"] = Gaffer.Reference()
__shaderBallReference.load("/run/media/ezequielm/misc/wrk/dev/EZLookdevTools/plugins/gaffer/boxes/LDTShaderBall.grf")

self.addChild(__shaderBallReference)

# Custom geo
self["__teapot"] = GafferScene.SceneReader()
self["__teapot"]["fileName"].setInput(
self["custom_geo"]
)
self["__teapot"]["transform"]["scale"].setValue(
imath.V3f(
0.0500000007, 0.0500000007, 0.0500000007
1, 1, 1
)
)

self["MeshType1"] = GafferScene.MeshType(
"MeshType1"
)
self["PathFilter7"] = GafferScene.PathFilter(
"PathFilter7"
)
self["MeshType1"]["filter"].setInput(
self["PathFilter7"]["out"]
)
self["MeshType1"]["meshType"].setValue(
"catmullClark"
)
self["PathFilter7"]["paths"].setValue(
IECore.StringVectorData(["/..."])
)
self["__teapotMeshType"] = GafferScene.MeshType("__teapotMeshType")
self["__teapotPathFilter"] = GafferScene.PathFilter("__teapotPathFilter")
self["__teapotMeshType"]["filter"].setInput(self["__teapotPathFilter"]["out"])
self["__teapotMeshType"]["meshType"].setValue("catmullClark")
self["__teapotPathFilter"]["paths"].setValue(IECore.StringVectorData(["/..."]))

self["MeshType1"]["in"].setInput(
self["__teapot"]["out"]
)
self["__teapotMeshType"]["in"].setInput(self["__teapot"]["out"])

self["__teapotSet"] = GafferScene.Set( "SHADERBALL_material" )
self["__teapotSet"]["name"].setValue( 'SHADERBALL:material' )
self["__teapotSet"]["filter"].setInput(self["__teapotPathFilter"]["out"])
self["__teapotSet"]["in"].setInput(self["__teapotMeshType"]["out"])

# Root
self["__root"] = GafferScene.Group()
self["__root"]["transform"]["scale"]["x"].setInput(
self["custom_geo_scale"]
)
self["__root"]["transform"]["scale"]["y"].setInput(
self["custom_geo_scale"]
)
self["__root"]["transform"]["scale"]["z"].setInput(
self["custom_geo_scale"]
)
self["__root"]["in"][0].setInput(
self["MeshType1"]["out"]
)
self["__sceneSwitch"] = Gaffer.Switch()
self["__sceneSwitch"].setup(GafferScene.ScenePlug( "in"))
self["__sceneSwitch"]["index"].setInput(self["scene"])
self["__sceneSwitch"]["in"].addChild( GafferScene.ScenePlug( "in0", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) )
self["__sceneSwitch"]["in"].addChild( GafferScene.ScenePlug( "in1", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) )

self["__sceneSwitch"]["in"]["in0"].setInput(self["__shaderBallReference"]["out"])
self["__sceneSwitch"]["in"]["in1"].setInput(self["__teapotSet"]["out"])

self["__camera"] = GafferScene.Camera()
self["__camera"]["transform"]["translate"].setValue(
imath.V3f(0, 2.29999995, 9.5)
)
self["__camera"]["transform"]["rotate"].setValue(
imath.V3f(-9, 0, 0)
)
self["__camera"]["transform"]["translate"].setValue(imath.V3f(0, 70, 175))
self["__camera"]["transform"]["rotate"].setValue(imath.V3f(-16, 0, 0))
self["__camera"]["fieldOfView"].setValue(20.0)

self["__group"] = GafferScene.Group()
self["__group"]["in"][0].setInput(
self["__root"]["out"]
self["__sceneSwitch"]["out"]
)
self["__group"]["in"][1].setInput(
self["__camera"]["out"]
Expand All @@ -98,15 +92,18 @@ def __init__(self, name="LDTShaderBall"):
)
self["__subTree"]["root"].setValue("/group")

self[
"__shaderAssignment"
] = GafferScene.ShaderAssignment()
self["__shaderAssignment"] = GafferScene.ShaderAssignment()
self["__shaderAssignment"]["in"].setInput(
self["__subTree"]["out"]
)
self["__shaderAssignment"]["shader"].setInput(
self["shader"]
)
self["__shaderAssignmentFilter"] = GafferScene.SetFilter( "SetFilter" )
self["__shaderAssignmentFilter"]["setExpression"].setValue( 'SHADERBALL:material' )

self["__shaderAssignment"]["filter"].setInput(self["__shaderAssignmentFilter"]["out"])


self["__options"] = GafferScene.StandardOptions()
self["__options"]["in"].setInput(
Expand Down
Binary file added resources/assets/cyclo/cyclo.abc
Binary file not shown.
Binary file added resources/assets/shaderBall/shaderBall.abc
Binary file not shown.
Binary file added resources/assets/shaderBall/sources/shaderBall.mb
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/assets/shaderBall/textures/GW_Metal.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added resources/assets/shaderBall2/floorScales.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/assets/shaderBall2/floorScales.tex
Binary file not shown.
Binary file added resources/assets/shaderBall2/floorScales.tx
Binary file not shown.
Binary file added resources/assets/shaderBall2/shaderBall.abc
Binary file not shown.
Binary file added resources/assets/shaderBall2/shaderBall_HDR.hdr
Binary file not shown.
Binary file added resources/assets/shaderBall2/shaderBall_HDR.tex
Binary file not shown.
Binary file added resources/assets/shaderBall2/shaderBall_ball.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/assets/shaderBall2/shaderBall_ball.tex
Binary file not shown.
Binary file added resources/assets/shaderBall2/shaderBall_ball.tx
Binary file not shown.
Binary file added resources/assets/shaderBall2/shaderBall_stand.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added resources/assets/shaderBall2/shaderBall_stand.tx
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit c72cc41

Please sign in to comment.