I had a workflow in Rhino 7 that would create a series of variably colored Emission Materials, that no longer works. Typically, when you modify a material’s base color (say to green) as you select other material types (like custom, physically based, plaster, plastic, etc.) the base color stays green and lets you modify other properties. This used to be the case with the Emission Material as well, but now it resets the color to black every time. My goal is to start with a series of varying colored objects, change them to an Emission material, and have the color stay with them. This was working very well prior to my last update.
So, I now would have to manually change each material color. Does anyone know a workaround to this, or is there some way to revert this change back? I may have to start looking into other software to accomplish my goals.
Hello - as far as I can see this works in the latest here - start with a custom material, green base color, change its type to Emission - the color stays green - can you please run SystemInfo in Rhino and copy/paste the results here?
Windows 10.0.19041 SR0.0 or greater (Physical RAM: 64Gb)
Computer platform: DESKTOP
Standard graphics configuration.
Primary display and OpenGL: NVIDIA GeForce RTX 2070 (NVidia) Memory: 8GB, Driver date: 9-30-2020 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 456.71
> Accelerated graphics device with 4 adapter port(s)
- Windows Main Display attached to adapter port #0
- Secondary monitor attached to adapter port #1
OpenGL Settings
Safe mode: Off
Use accelerated hardware modes: On
Redraw scene when viewports are exposed: On
Anti-alias mode: 8x
Mip Map Filtering: Linear
Anisotropic Filtering Mode: High
Vendor Name: NVIDIA Corporation
Render version: 4.6
Shading Language: 4.60 NVIDIA
Driver Date: 9-30-2020
Driver Version: 27.21.14.5671
Maximum Texture size: 32768 x 32768
Z-Buffer depth: 24 bits
Maximum Viewport size: 32768 x 32768
Total Video Memory: 8 GB
Rhino plugins that do not ship with Rhino
C:\Program Files\Rhino 6\Plug-ins\RhinoCAM 2020 for R6\RhinoCAM 2020 For Rhino6.0.rhp “RhinoCAM 2020 - The cutting edge CAM plug-in for Rhino 6.0 from MecSoft Corporation”
C:\Program Files\Rhino 6\Plug-ins\RhinoCAM 2020 for R6\RhinoArt1FileExporter For Rhino6.0.rhp “RhinoArt1FileExporter”
The last version that we just updated was 7.1 from 12/8. It worked with the 7.1, but as soon as we updated to the current version we are getting the same result. Just FYI
This is inconsistent - works again here. Still digging.
It seems to be that if I create a material via the material panel, modify it to be emissive, and then apply it to objects, the color sticks; if I create the material via the object’s Properties > Material page, and modify it to be emissive, it goes black.
I would say that if a material, like Custom, has an emissive channel, then that is the color that ought to be used when changing the type to Emission, and if the starting material does not have an emissive channel, use the base color.
Well, in the case of what I am trying to use it for, and what I was successfully accomplishing, that may not work.
I am colorizing dozens to hundreds of components in grasshopper, and then turning them into emissive objects. There is no way for me to create that many unique materials manually. I’m running a script to colorize the object’s materiality based on its object color, and then was selecting emissive after that.
Yeah, I can get it when I’m back in the studio, but the issue occurs outside of running the script. I can’t even change it with a single material. That functionality was changed somehow when updating, and I’m not sure I can even modify the script to accomplish this task. I haven’t seen any syntax for creating an emissive material in rhinoscript.
I see - yes, this might not be possible with RhinoScript, maybe via RhinoCommon and Python however. Right now, bug that I see (apart from how it affects your workflow) is that the emissive color is not being used when the material is changed to Emission - if it uses the base color, I would consider that incorrect, I think, though I understand that it was helpful in your case.
If you send me the script, maybe I can figure out a way to make it work ‘right’
(I was able to locate it, please see below. This is what I typically use after exporting from GH to colorize materials from object colors. Currently, I am needing to turn them emissive, as we have been discussing.)
Option Explicit
Sub SetMaterialColorsFromObjectColors
' Constants
Const rhColorByLayer = 0
Const rhColorByObject = 1
' Variables
Dim aObjects, sObject
Dim nColor, nSource
Dim sLayer, nMaterial
' Get all objects in the document
aObjects = Rhino.AllObjects
If Not IsArray(aObjects) Then Exit Sub
' Process each object
For Each sObject In aObjects
' Get the object's color and color source
nColor = Rhino.ObjectColor(sObject)
nSource = Rhino.ObjectColorSource(sObject)
nMaterial = -1
' If the object's color source is "by layer"
' then get the layer's material index. If the
' layer does not have a material, add one.
If (nSource = rhColorByLayer) Then
sLayer = Rhino.ObjectLayer(sObject)
nMaterial = Rhino.LayerMaterialIndex(sLayer)
If( nMaterial < 0 ) Then
nMaterial = Rhino.AddMaterialToLayer(sLayer)
End If
' If the object's color source is "by object"
' then get the object's material index. If the
' object does not have a material, add one.
ElseIf (nSource = rhColorByObject) Then
nMaterial = Rhino.ObjectMaterialIndex(sObject)
If( nMaterial < 0 ) Then
nMaterial = Rhino.AddMaterialToObject(sObject)
End If
End If
' Set the material color
If (nMaterial >= 0) Then
If (nColor <> Rhino.MaterialColor(nMaterial)) Then
Rhino.MaterialColor nMaterial, nColor
End If
End If
Next
' Redraw the document
Rhino.Redraw
OK - I see that there is nothing that helps in RhinoScript - I’ll see if I can get something to work with RhinoCommon. Materials can be a bit messy to deal with, I’ve found.