Rs.MaterialReflectivity() is missing

I wanted to change material reflectivity /and reflectivity color) through a script, but there are no commands for that, only for “Shine” and “ReflectiveColor” but that is actually the Gloss Finish and Gloss Finish color. Could you please add this?

Hi Jørgen,

Agree, the RS still is stuck in V4 or in-between when it comes to dealing with materials. Bunch of them are not very reliable, like changing material names etc, so I would stay away from them and use RDK methods.
With RDK you can access and change all material parameters. Again, not so well documented, but you can get a list of all parameters of the ‘content’ (“material”, in this case) by using: rdk.ContentParameter(strContentID). This will give you a list of names of the parameters that can be fed to the same method, so #16 is ‘reflectivity’.

Then you have to call: rdk.ContentParameter(strContentID,“reflectivity”) to get your current value or rdk.ContentParameter(strContentID,"reflectivity,value) to set value.
I can’t figure out how to know the value ranges for each property but you should be able to tell by trial-and-error. For example reflectivity goes from 0 to 1.

See the updated previous code that would take the first material in the list of IDs and change its reflectivity to 35%.

–jarek

Call Main()
Sub Main()

	'get RDK Object`
	Dim rdk : Set rdk = Rhino.GetPlugInObject("Renderer Development Kit")
	
	'get list of all RDK data ids in the document
	Dim rdkALL : rdkALL = rdk.FactoryList()
	
	'filtered materials ID list
	Dim arrMatIDList : arrMatIDList = rdk.ContentList("material") 
	
	'get materials names
	Dim i,arrMatNames : arrMatNames = array(): ReDim arrMatNames(Ubound(arrMatIDList))
	For i=0 To Ubound(arrMatIDList)
		arrMatNames(i) = rdk.ContentInstanceName(arrMatIDList(i)) 
	Next
	
	'get all available material parameter names:
	Dim arrParams : arrParams = rdk.ContentParameter(arrMatIDList(0))
	
	'get values of reflectivity (param name: "reflectivity" (#16))
	Dim arrReflectivityValue : arrReflectivityValue = rdk.ContentParameter(arrMatIDList(0), "reflectivity")
	
	'set reflectivity value to 35%
	Call rdk.ContentParameter(arrMatIDList(0), "reflectivity", 0.35)
	
		
End Sub