Most of what we've seen so far has been comparing USD to sops and geo caches, in the previous section we added some /obj things for lights and cameras. A core part of USD is the idea of taking all these concepts that most apps treat as different entities (well, Houdini definitely does), and unify them.
Next is materials. Default Houdini puts them into a seperate matnet or shopnet context, which you then refer to via material parameters or material sops, how does lops handle this?
- Append a material library to your setup so far, display it
- No change. Good.
- Double click it to dive inside
- Ah, look in the top right of the network view, you see the faint 'vex builder' text, which is a terrible way to tell you you're now in a matnet. Interesting.
- Create a principled shader, make the base colour a bright green
- Jump back up to lops, look in the Scene Graph Tree. There's a new folder, 'materials'. Expand it, there's the principled material. In USD, materials live in the Scene Graph Tree like everything else. It's like in maya if you turn on 'show DG objects' you get all of nodes in the maya scene visible.
- So the material is there, but unassigned. Lets fix that.
- In the parameter pane turn on 'assign to geometry'.
- In the scene graph tree, select reference3, and drag it into the 'geometry path' parameter.
- Material assigned!
If you're on mac like me, you might get some viewport glitches like the pig turning black. Try switching to wireframe and back, or switch to flat lightig and back, but you should see the material.
How is this mapping stored internally? As a property on the object. Select reference3 in the scene graph tree, and look at the scene graph details pane. You'll have to rearrange things a bit, but you'll see a 'material:binding' property, expand it, there's the link to the material.
So far I've made a point of saying all the things we build here work in all other apps and render engines. Materials differs a bit. Rather than define a complete material node set that works for all things and all renders, USD has two approaches:
- Let each render engine define their own nodes, which can be saved in USD, but only that render engine can understand said nodes. This is pretty much the same as Houdini's current approach in that you can have redshift nodes, arnold nodes, renderman nodes, all stored in the 1 hip, but only Arnold can understand Arnold shading nodes.
- Pixar also provided a super simple material network, with just 4 nodes, as a reference for render devs. The total set contains a simple principled shader, texture node, uv transform, and primvar read (like a bind vop for mantra). Ideally any render engines that support USD will also support these simple nodes, so far most have.
As such lets set that up, so we have something to play with in other packages.
- Jump back into the material library
- Create a USD Preview Surface. You can see its like a cutdown version of the principled shader.
- Create a USD UV Texture set the path to a png on disk somewhere, say $HFS/houdini/pic/houdinisplash.png
- Connect rgb to diffuseColor on the preview surface
- Create a USD Prim Var Reader. We'll use this to read uv's from the model, to be used by the texture node
- Set var name to st, signature to float 2
- Connect result to st on uv texture.
- Turn off the orange flag for all nodes except the USD Preview Surface. The orange flag tells USD 'I'm a material that can be applied', which of course they're not, only the USD Preview Surface is.
Why st instead of uv? It's a Pixar thing. Renderman names texture coordinates st, renderman is a Pixar thing, USD is a Pixar thing, deal with it. 'But wait' you say, 'the pig came from Houdini, so surely its using @uv right?'. Yep, but when you save USD from Houdini, or do live import from Sops into Lops, Lops will change uv to st for you.
Jump up to go back to the lops network, you should see that texture applied on the pig. Again if you're on mac you might need to kick the tyres a bit, toggle flat shaded etc to see it pop up.
Have a peek at the Scene Graph Tree. Expand the materials folder, you can see there's just usdpreviewsurface1 in there, but expand that, and you can see the nodes tucked away underneath it.
Now if you save this, you can load this up in other dcc's, and yes, UE4, and see the material working.
There's more details to come, but this will do for now.
Next page next page!