Disable diffuse lighting

I’m trying to disable diffuse lighting for a material of an object in a loop and cannot seem to find the method for this. It is the tick box setting in the materials pane under advanced settings. Can anyone point me in the right direction?

@Jouni_Valli, i’ve had the same problem and posted the same question here.

c.

Jouni

In RhinoCommon, it is DocObjects.Material.DisableLighting

  • Andy

Brilliant many thanks Andy!

As I’ve not used Rhinocommon before, is there anyway to embed it in Rhinoscript? If not, what would be the simplest way of setting the material lighting off for all of the imported meshes (originally *.obj files) in the document? Essentially the script is a simple batch import which imports all objects but uses their filenames to put them on matching layers. All it’s missing is disabling diffuse lighting for all of the objects/meshes. Thanks for the help!

Hi JSV,

In RhinoScript you will need to dig into RDK scripting. The documentation is very cryptic and not easy to work with, but worth giving it a shot - here is online documentation.

For your use, I modified an example I posted a while ago - try attached and use debugger to look at the parameter lists etc. for materials. The script will also run through all materials in the scene and disable diffuse lighting as well as set the reflectivity @ 0.35.

hth,

–jarek

RDK_RhinoScript_Sample.rvb (1.4 KB)

Wow thanks Jarek! Unfortunately although the factorylist does obtain a fair number of elements for the array, rdk.ContentList(“material”) returns null. There are, however, materials in the document as verified by the material editor. Any ideas?

Any chance you can upload a small sample file ?

The attached zip has a sample OBJ file along with the attached texture - it should display correctly if placed on your desktop in a folder labeled “Sample”. The zip also includes the simple batch .obj import script.

Sample.zip (11.0 MB)

JSV,

for some reason the imported OBJ material has to be updated by “_RenderConvertOldStyleMaterials” command. (it does not autocomplete - don’s ask me why…), then the RDK method works.
I modified your script to convert the materials by running the command on import and then added the snippet to disable diffuse light. Works OK here with your sample file.

Import_objects_v1.1.rvb (1.9 KB)

hth,

–jarek

Awesome many thanks Jarek - works perfectly!:thumbsup: