I have the following situation illustrated at end of post.
I am successfully looping through the material pins on a mesh node, identifying there type and getting some information. I was surprised I did not need to do anything specific to tell octane to look for external materials nodes connected to a pin. However I cannot seem to get to the texture file information from any node. Can someone please point me in the right direction. Current routine is included below.
--if node type is glossy
if internalMatNode.type == octane.NT_MAT_GLOSSY then
                print (" ")
                print("Glossy Material") 
                print ("----------------------------------")
                -- get the diffuse pin values
                tblDiffuseValues = internalMatNode:getPinValue(octane.P_DIFFUSE)
                print ("Diffuse Pin Values For: " ..internalMatNode.name)
                for k, v in pairs(tblDiffuseValues) do
                   print(k, v)
                end
                -- if pin has an image, get image file name
                -- first determine if another node is attatched
                local inputNodeA =internalMatNode:getConnectedNode(octane.P_DIFFUSE)
print ("Glossy input a",inputnodeA)
                local inputNodeB =internalMatNode:getConnectedNodeIx(pinIx)
print ("Glossy input b",inputnodeB)
                local inputNodeC =internalMatNode:getInputNode(octane.P_SPECULAR)
print ("Glossy input c",inputnodeC)
                local inputNodeD =internalMatNode:getInputNodeIx(pinIx)
print ("Glossy input d",inputnodeD)
                local inputNodeE =internalMatNode:getOwnedItemIx(pinIx)
print ("Glossy input e",inputnodeE)
                local inputNodes =internalMatNode:getInputNodes()
                for k, v in pairs(inputNodes) do
                   print(k, v)
                end
                -- get the specular pin values
                tblSpecularValues = internalMatNode:getPinValue(octane.P_SPECULAR)
                print ("Specular Pin Values For: " ..internalMatNode.name)
                for k, v in pairs( tblSpecularValues) do
                   print(k, v)
                end
                    -- if pin has an image, get image file name, check if pin has an inputnode
                -- get the opacity pin values
                tblOpacityValues = internalMatNode:getPinValue(octane.P_OPACITY)
                print ("Opacity Pin Values For: " ..internalMatNode.name)
                for k, v in pairs(tblOpacityValues) do
                   print(k, v)
                end
                    -- if pin has an image, get image file name
                -- get the Normal pin values
                tblNormalValues = internalMatNode:getPinValue(octane.P_NORMAL)
                print ("Normal Pin Values For: " ..internalMatNode.name)
                for k, v in pairs(tblNormalValues) do
                   print(k, v)
                end
                    -- if pin has an image, get image file name
                -- get the Bump pin values
                tblBumpValues = internalMatNode:getPinValue(octane.P_BUMP)
                print ("Bump Pin Values For: " ..internalMatNode.name)
                for k, v in pairs(tblBumpValues) do
                   print(k, v)
                end
                    -- if pin has an image, get image file name
end
thx
mark
            
							Getting Textures from a material
After several hours I seem to have this working, so no help required at the moment.
            
			
									
						
							Windows 11, 2x Intel I9,   64GB Ram,   2x  GTX 1080 TI, 1 x RTX 380 TI, Oculus Quest 2
			
						For reference this is how you can find out the filename of the image texture used by the material:
Assume we have a material node
By default the diffuse input will have an RGB colour. In that case 
-- 
Roeland
            
			
									
						
										
						Assume we have a material node
matNode:
Code: Select all
-- get the node connected to the diffuse pin (skipping linker nodes)
local texNode = matNode:getInputNode("diffuse")
-- assuming T is an image texture node:
local filename = texNode:getAttribute("filename")
getPinValue can get the colour directly:
Code: Select all
-- now, assuming we have an RGB colour node:
local rgbColour = matNode:getPinValue("diffuse")
Roeland
Roeland,
I wondered when you have a moment if you could explain in more detail the difference between getConnectedNode and getInputNode.
thx
mark
            
			
									
						
							I wondered when you have a moment if you could explain in more detail the difference between getConnectedNode and getInputNode.
thx
mark
Windows 11, 2x Intel I9,   64GB Ram,   2x  GTX 1080 TI, 1 x RTX 380 TI, Oculus Quest 2
			
						getConnectedNodegives you the node directly connected to an input pin. This may be an input or output node of a graph.getInputNodeautomatically skips linker nodes
getConnectedNode it will return the output linker node of that nodegraph. getInputNode returns the actual material node inside the node graph.--
Roeland
                                                                
                            
