WIP7. Material texture not showing on viewport. BUG?

Hi, I’m trying to assign a renderMaterial to a programatically added object using Python. Strange thing happening here:

Once object added to the document, I check in object properties the correct material was assigned.

If material color is defined by a bitmap, the texture is not displaying in Rendered mode.
If material color is defined with a color, the color is displayed correctly in Rendered mode.

In Raytraced mode material texture is correctly displayed IF when I baked the object display mode was NOT Raytraced. Otherwise, if rendermode was Raytraced, material texture wont appear correctly (burned out, incorrecty scaled)

if I manually change the textured material to diffuse material, and then reassign the textured material, then it will correctly show up in rendered mode.

I recorded a video to show this behaviour:


Seems a bug, but maybe I’m not correctly making things with my code…
import Rhino
import Rhino.Geometry as rg
from Rhino.RhinoDoc import ActiveDoc as doc

#create two boxes
interval = rg.Interval(0,100)
box = rg.Box(rg.Plane.WorldXY,interval,interval,interval)
box01 = box.ToBrep()
box02 = box01.Duplicate()
box02.Translate(150,0,0)

#retrieve renderMaterials by name
box01MatName = 'mat_textured'
box02MatName = 'mat_noTexture'
for mat in doc.RenderMaterials:
    if mat.Name == box01MatName:
        renderMat01 = mat
    elif mat.Name == box02MatName:
        renderMat02 = mat

#bake objects and get the RhinoObject
attr = doc.CreateDefaultAttributes()
id01 = doc.Objects.Add(box01,attr)
rhinoObject01 = doc.Objects.FindId(id01)
id02 = doc.Objects.Add(box02,attr)
rhinoObject02 = doc.Objects.FindId(id02)

#assign renderMaterials to RhinoObject
rhinoObject01.RenderMaterial = renderMat01
rhinoObject02.RenderMaterial = renderMat02

#commit changes
rhinoObject01.CommitChanges()
rhinoObject02.CommitChanges()

First of all don’t use the Rhino PBR-style material anymore. That comes from a plugin that functioned as a stop-gap solution. Use the superior Physically Based Material that Rhino WIP provides. Load protect the plugin with the old material. It isn’t very good.

What you are seeing is likely https://mcneel.myjetbrains.com/youtrack/issue/RH-58065

@nathanletwory, is properly working with the other PBR material. Thanks

First of all don’t use the Rhino PBR-style material anymore.

I’m using the PBR-style because I liked its more compact interface. If this is not properly working, maybe its a good idea to remove it from the package manager…

@nathanletwory, we all like the compact-look. Is that possible to add to the standard material editor for PBR?

Thx,

G

@aitorleceta, I will yank it when Rhino 7 is out.

@gustojunk anything is possible. I will log the request, then we keep fingers crossed (:

Nathan, you made that pak. You gave it to us, and we liked it. You can’t just take it away from us now. The cat is out of the bag now. That’s against the rules.

I mean, is not that Autodesk acquired the pak and now you can’t keep shipping it to us. Just sayin’

G

We have receipts!!! :crazy_face:

Well, I suppose I could keep it up for sentiment sake. I don’t have a real strong opinion on that. But from code pov the native one in Rhino WIP/7 is superior.

Personally I like the UI as I implemented it better, but that is probably because I don’t fall in the Rendering Noob category.

Request logged as https://mcneel.myjetbrains.com/youtrack/issue/RH-58932

1 Like