Community
Arnold General Rendering Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Adding shaders to the IPR for Arnold in Blender

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Anonymous
550 Views, 5 Replies

Adding shaders to the IPR for Arnold in Blender

Trying to get an IPR working in blender, I'm able to get the polymesh to show up, how would I go about adding the shaders? Here's what I have so far:

nodes.append(('polymesh', {  
	'name': ('STRING', "O::" + ob.name)  
	'matrix': ('MATRIX', numpy.reshape(ob.matrix_world.transposed(), -1)),  
	'vlist': ('ARRAY', (arnold.AI_TYPE_VECTOR, vlist)),  
	'nsides': ('ARRAY', (arnold.AI_TYPE_UINT, nsides)),  
	'vidxs': ('ARRAY', (arnold.AI_TYPE_UINT, vidxs)),  
}))
Labels (4)
5 REPLIES 5
Message 2 of 6
Stephen.Blair
in reply to: Anonymous

You need to create a shader node, and then set (link?) polymesh.shader



// Stephen Blair
// Arnold Renderer Support
Message 3 of 6
Anonymous
in reply to: Anonymous

@Stephen Blair Like this?

'shader':('POINTER', (arnold.AI_TYPE_POINTER, shader))
Message 4 of 6
Anonymous
in reply to: Anonymous

shader.append(('lambert', {  
  'name': ('STRING', mat.name),  
  'Kd': ('FLOAT', (mat.diffuse_intensity)),  
  'Kd_color': ('RGB', (arnold.AI_TYPE_RGB, *mat.diffuse_color))  
}))
Message 5 of 6
Anonymous
in reply to: Anonymous

And you’d append that shader data to the shader array with the above code? ^

Message 6 of 6
Anonymous
in reply to: Anonymous

Figured it out, not perfect though:

    index = index_containing_substring(nodes, ob.name)
    nodes.append(('polymesh', {
        'name': ('STRING', "O::" + ob.name),
        'matrix': ('MATRIX', numpy.reshape(ob.matrix_world.transposed(), -1)),
         'vlist': ('ARRAY', (arnold.AI_TYPE_VECTOR, vlist)),
         'nsides': ('ARRAY', (arnold.AI_TYPE_UINT, nsides)),
         'vidxs': ('ARRAY', (arnold.AI_TYPE_UINT, vidxs)),
         'shader':('NODE', (nodes[index])),
         #'smoothing': ('BOOL', True),
    }))

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report