rutra Posted February 9, 2010 Share Posted February 9, 2010 Hi, I'm trying to build RSL VOP texture layering node using Multiparm Block list. RSL array looks something like this: string texture_array[] = { "texture_a.tif", "texture_b.tif", "texture_c.tif" }; How can I get Multiparm Block number and values propagated into my SL code? Thanks in advance a Quote Link to comment Share on other sites More sharing options...
rutra Posted February 10, 2010 Author Share Posted February 10, 2010 (edited) Alternatively I tried to use Texture node in 'For Loop' node but I couldn't figure out how to use loop count index to change the channel name inside 'For Loop' node in order to feed next texture path to the Texture node. Edited February 10, 2010 by rutra Quote Link to comment Share on other sites More sharing options...
rutra Posted February 10, 2010 Author Share Posted February 10, 2010 Ok, I've got seriously dodgy way of doing it. Basically Python script dynamically generates SL arrays. The only problem is that I often have to refresh the script. Muliparm texture parameter Python CallBack script print hou.pwd().hdaModule().refresh(kwargs) ..runs following script: def refresh( kwargs ): this_node = kwargs['node'] num_layers = this_node.parm('layers').eval() prefix = 'texturepath' parms = this_node.parms() texture_paths = [] for p in this_node.parms(): parm_name = p.name() if parm_name.startswith(prefix): texture_paths.append( '"'+p.eval()+'"' ) else: pass code_string = '' code_string += 'string Kd_texture_array[] = {' code_string += ','.join( texture_paths ) code_string += '};' this_node.parm('texarray').set( code_string ) return code_string SL code looks like this: // generate Kd_texture_array sting array from Multiparm Block list via Python callback script // looks like this: string Kd_texture_array[] = {"texture1.tdl, texture2.tdl"} $texarray // Get total number of textures in array uniform float $numLayers = arraylength( Kd_texture_array ); uniform float $i; string $Kd_texture = ""; for( $i = $numLayers ; $i >= 0; $i -= 1 ) { $Kd_texture = Kd_texture_array[$i]; $outColor += texture($Kd_texture); } Hopefully someone has better ideas:) Quote Link to comment Share on other sites More sharing options...
Alanw Posted February 10, 2010 Share Posted February 10, 2010 (edited) I was thinking co-shaders could be helpful for this task. You could construct a shader that would accept multiple co-shaders with each having their own texture and blending modes. In Houdini you might have the multi-parm block call-back copy a co-shader living inside your HDA & wire it up into a co-shader merge SHOP. Naturally this could fail easily. It's hard to know without getting my hands dirty. I'm not sure if you're using prman either. Cheers, Alan Edited February 10, 2010 by Alanw Quote Link to comment Share on other sites More sharing options...
rutra Posted February 10, 2010 Author Share Posted February 10, 2010 Interesting idea but I'm actually trying to build Texture layering node for VOP network (VEX Builder Type). Not sure if co-shaders would work. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.