Script problem - it worked two days ago before updating Rhino

I’ve been using the script @laurent_delrieu shared in this topic but now all of a sudden Grasshopper complains:

  1. Data conversion failed from Goo to Shader

The custom preview component accepted the material two days ago

image

material_problem.gh (12.4 KB)

System Info

Rhino 8 SR6 2024-3-26 (Rhino 8, 8.6.24086.11001, Git hash:master @ 8e3b686f596bb6443e56e6dbecf0f54f4888713a)
License type: Kommerziell, build 2024-03-26
License details: Cloud Zoo

Windows 11 (10.0.22631 SR0.0) or greater (Physical RAM: 128GB)
.NET 7.0.17

Computer platform: DESKTOP

Standard graphics configuration.
Primary display and OpenGL: NVIDIA RTX A5000 (NVidia) Memory: 22GB, Driver date: 2-7-2024 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 551.52
> Accelerated graphics device with 4 adapter port(s)
- Secondary monitor attached to adapter port 0
- Windows Main Display attached to adapter port 1

Secondary graphics devices.
NVIDIA Quadro K2200 (NVidia) Memory: 4GB, Driver date: 2-7-2024 (M-D-Y).
> Accelerated graphics device with 4 adapter port(s)
- There are no monitors attached to this device!

OpenGL Settings
Safe mode: Off
Use accelerated hardware modes: On
Redraw scene when viewports are exposed: On
Graphics level being used: OpenGL 4.6 (primary GPU’s maximum)

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: 2-7-2024
Driver Version: 31.0.15.5152
Maximum Texture size: 32768 x 32768
Z-Buffer depth: 24 bits
Maximum Viewport size: 32768 x 32768
Total Video Memory: 23028 MB

Rhino plugins that do not ship with Rhino
C:\Users\martinsiegrist\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\NVIDIADenoiser\0.4.3\NVIDIADenoiser.Windows.rhp “NVIDIADenoiser.Windows” 0.4.3.0

Rhino plugins that ship with Rhino
C:\Program Files\Rhino 8\Plug-ins\Commands.rhp “Commands” 8.6.24086.11001
C:\Program Files\Rhino 8\Plug-ins\rdk.rhp “Renderer Development Kit”
C:\Program Files\Rhino 8\Plug-ins\RhinoRenderCycles.rhp “Rhino Render” 8.6.24086.11001
C:\Program Files\Rhino 8\Plug-ins\RhinoRender.rhp “Legacy Rhino Render”
C:\Program Files\Rhino 8\Plug-ins\rdk_etoui.rhp “RDK_EtoUI” 8.6.24086.11001
C:\Program Files\Rhino 8\Plug-ins\NamedSnapshots.rhp “Snapshots”
C:\Program Files\Rhino 8\Plug-ins\MeshCommands.rhp “MeshCommands” 8.6.24086.11001
C:\Program Files\Rhino 8\Plug-ins\IronPython\RhinoDLR_Python.rhp “IronPython” 8.6.24086.11001
C:\Program Files\Rhino 8\Plug-ins\RhinoCycles.rhp “RhinoCycles” 8.6.24086.11001
C:\Program Files\Rhino 8\Plug-ins\SectionTools.rhp “SectionTools”
C:\Program Files\Rhino 8\Plug-ins\Grasshopper\GrasshopperPlugin.rhp “Grasshopper” 8.6.24086.11001
C:\Program Files\Rhino 8\Plug-ins\Toolbars\Toolbars.rhp “Toolbars” 8.6.24086.11001
C:\Program Files\Rhino 8\Plug-ins\3dxrhino.rhp “3Dconnexion 3D Mouse”
C:\Program Files\Rhino 8\Plug-ins\Displacement.rhp “Displacement”

Strange ?
With my component compiled from Nautilus it works !!

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Component = this;
            GrasshopperDocument = this.OnPingDocument();
            

            Color DiffuseColor = Color.Red;
            if (Component.Params.Input[0].SourceCount == 0)
            {
                InputTools.Swatch(ref Component, ref GrasshopperDocument, 0, 11, DiffuseColor);
            }
            DA.GetData(0, ref DiffuseColor);

            double Reflection = 0.5;
            if (Component.Params.Input[1].SourceCount == 0)
            {
                InputTools.Slider(ref Component, ref GrasshopperDocument, 1, 11, 0, 1, 1, Reflection);                
            }
            DA.GetData(1, ref Reflection);
            Reflection = Math.Min(Math.Max(Reflection, 0), 1);

            double Smoothness = 0.3;
            if (Component.Params.Input[2].SourceCount == 0)
            {
                InputTools.Slider(ref Component, ref GrasshopperDocument, 2, 11, 0, 1, 1, Smoothness);
            }
            DA.GetData(2, ref Smoothness);
            Smoothness = Math.Min(Math.Max(Smoothness, 0), 1);

            Color ReflectionColor = Color.White;
            Color AmbientColor = Color.White;
            Color EmissionColor = Color.Black;
            Color SpecularColor = Color.Black;
            Color TransparentColor = Color.Black;
            double Transparency = 0.0;

            Rhino.DocObjects.Material material = new Rhino.DocObjects.Material();
            
            material.DiffuseColor = DiffuseColor;

            material.ReflectionColor = ReflectionColor;
            material.Reflectivity = Reflection;

            material.SpecularColor = SpecularColor; 
            material.AmbientColor = AmbientColor;
            material.EmissionColor = EmissionColor;            
            material.ReflectionGlossiness = Smoothness;
                       
            material.TransparentColor = TransparentColor; 
            material.Transparency = Transparency;

            material.FresnelReflections = true;

            var renderMaterial = Rhino.Render.RenderMaterial.CreateBasicMaterial(material, Rhino.RhinoDoc.ActiveDoc);
            

            DA.SetData(0, new GH_Material(renderMaterial));
        }

Yes I also find it strange, especially because it worked two day ago.

I have an older version of Rhino 8 from mid January and there it works fine.

I updated Rhino yesterday sot it surely means this Version 8 SR6 (8.6.24086.11001, 2024-03-26) brings some change on the generic conversion. @eirannejad is it a change in the C# editor or in Grasshopper SDK ?

From what I tested it is not outputted as GH_Material but it stays as a Rhino.Display.DisplayMaterial

1 Like

Hm okay I might have messed up something. There has been improvements to the converters on the script component on the last 8.6 build. I did not have a specific test case for this but I made sure all our unit tests are passing. Seems like this is a new bug. I’ll get on this and will fix for next 8.6 build

RH-81269 Script param converter regression in 8.6

Ok got this fixed. @martinsiegrist @laurent_delrieu I can dm you new 8.6 builds later today for testing

1 Like

Thank you so much for the quick fix and the dujour build.

1 Like

RH-81269 is also fixed in Rhino 8 Service Release 6 Release Candidate.

1 Like

…aaaaand RH-81269 is also fixed in Rhino 8 Service Release 6 that we just released.

1 Like