Category: Scripting

xgen3DelightProcedural – How to Use XGen with 3Delight

################ Xgen now works out of the box ####################### ################################################# Posted over from the 3delight Forum – Some nice work done by JediMaster The following is a copy and paste from JediMasters post ################################################################## Spent 1 day to figure out and ported the official usable xgenRenderManProcedural to xgen3DelightProcedural. First of all, please take a look…

Primitive Variables on Curve

As a follow up to the previous post I mentioned the curve shader from pixar. Heres a quick piece of code (i’ve used pymel in this example) to add on the primitive variable to the shape node of each curve so each one can have its own start frame and animLength

and with colours…

Supply Normal Values to Curves

curve31-1024x576

#################### example mel loop # this sets the up to be in the y (0,1,0)

################################################################################################## Need to attach 3delight attribute and switch on nurbs curve output and put in widths. I used curve shader downloadable from pixar website. before after delightUniformNormalN got me what I needed there is also delightVertexNormalN and delightVaryingNormalN

The Nature of Code

Take some inspiration from nature for your animation and you might be able to create something that is a little more appealing and or interesting (hopefully)

To do this cool stuff you will benefit from learning some key concepts in maths. Learning maths is like eating your greens. Its probably good for you but Gaaah! its maths.

Take heart with some useful videos from Daniel Shiffman. With an engaging style he explains how coding, math and computer science concepts including vectors, trigonometry, noise etc can be used to simulate nature using forces, mass, friction, acceleration etc. The concepts are illustrated with practical examples in processing software. I found the content useful in gaining a greater understanding of how the concepts can be used across 3D including: shading, lighting, rigging and animation. It gets even more interesting with videos on autonomous agents, neural networks etc. Also check out his site where you can view the entire book or order a physical copy / ebook.

http://natureofcode.com/book/

String Primitive Variables

This is another neat technique modified to work with 3delight.
Each sphere has a random texture applied from a group of 8 (see the mel script for more details)

Quoted from the pixar tutorial
“Primitive Variables are a powerful feature letting you pass information to your shaders on a per object basis. If you have
already completed the Primitive Variables tutorial from the introductory section, you will be aware of how useful they are.
However, you may have noticed there are no string PrimVar nodes in Slim or Hypershade. Using our understanding of
RIB and PrimVars we can easly create a workflow for passing arbitrary strings to our shaders. This could easily be
scripted to randomize a number of texture maps over leaves or stones; or to pass other arbitrary string data to our
shaders.”

Run the mel script on the selected geometry (you will need to modify a couple of details in the script)
// select geometry pieces and run
// modify ‘rand’ for number of pieces to pick from
// modify address to where source images come from

Here is an example rsl node surface shader. Cheers Ogre

RSL NODE
parameters
:
shader_input string Tex
output color out

code:
out = texture(Tex);