[Sidefx-houdini-list] opdef: question

Mark Elendt mark at sidefx.com
Tue Nov 13 08:38:33 EST 2007


On Tuesday Nov 13 at 11:59, Phil Spicer wrote:
> How can the opdef: command be called in a Material SOP? In a Shader SOP,
> turning off Use Indirect References would create the vm_surface as an
> opdef: string command rather than as a shader path. The command could
> then be modified for custom purposes.
> 
> What is the H9 way of doing this sort of thing?

Hi,

Materials can encompass more than just shaders now.  For example, you
can have a properties SHOP that defines the light mask, or
displacement bound, or any other property.

It would be a big mess to try to check for geometry attributes for
each and every possible property.  So there are no "direct" shader
strings any longer.

The previous incarnation would create the entire shader string and
attach it as an attribute.  For complicated shaders (with a lot of
parameters), those strings could get quite large.

In the material SOP, there are now "override" parameters.  These
parameters can override any parameter defined on the material
(including properties).  They are stored in a separate string
attribute (material_override).  If you inspect this attribute, you can
see that it looks very much like a Python dictionary.

This approach has most of the features of the previous approach, but
isn't quite as raw.  The previous approach allowed you to create
whatever string you wanted, even changing shaders entirely.  While
being extremely general, this approach didn't lend itself to the
idea of changing light masks or reflection masks on a per-primitive
basis...

Oh, if you're looking at shader substitution, you might look at the
python filtering command line option to mantra.  Something like...

    import mantra
    def filterInstance():
	shader = mantra.property('object:surface')
	if shader.find('foo') >= 0:
	    print 'Shader substitution for', mantra.property('object:name')
	    mantra.setproperty('object:surface', 'bar')

P.S.  I *think* that mantra still respects the vm_surface attribute if
	you really need to use it.




More information about the Sidefx-houdini-list mailing list