Date: Thu, 28 Mar 2024 17:27:38 +0000 (UTC) Message-ID: <1162077697.7908.1711646858849@ip-10-0-0-233.us-west-2.compute.internal> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_7907_1935453517.1711646858848" ------=_Part_7907_1935453517.1711646858848 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Simple PxrVary Example
One of the most common requirements of shadi= ng in animation or visual effects is varying the shader attributes efficien= tly for many objects. This can be anything from crowd simulations to leaves= in a forest. This variation can make scenes more realistic and visually ap= pealing. However, having to hand-alter dozens to hundreds of shaders can be= prohibitive. This is where PxrVary = comes in!
Attached is a Katana example file showing ho= w to use OpScripts to generate the source variables when using the pattern.= Read about the logic of the scene setup below.
This is an example OpScript used to create an ID on a sphere.
Interfa= ce.SetAttr('prmanStatements.attributes.identifier.id', IntAttribute(1)) Interface.SetAttr('prmanStatements.attributes.user.rmanFloatAttr', FloatAtt= ribute(3)) gb =3D GroupBuilder() gb:set("value", FloatAttribute(1)) gb:set("scope", StringAttribute("primitive")) gb:set("inputType", StringAttribute("float")) Interface.SetAttr("geometry.arbitrary.FloatPrimvar", gb:build())
The OpScript is assigned just below the primitive create. Each one is sl= ightly different to ensure variation.
From here you will notice there are four different outputs, illustrating= the different results from using different PxrVary sources (Name, ID, Prim= Var, Attribute). Rendering each of these will produce different colored sph= eres. Download the scene to experiment!