I’ve created a DisplayMaterial to customize the visualization of objects in a GH_Component by overriding DrawViewportMeshes(IGH_PreviewArgs args). Now I want to override the baking behavior of the component, and turn the DisplayMaterial into a Material (or RenderMaterial, not sure what the difference is?), add it to the document’s MaterialTable and finally assign the material index to the objects attributes. The end result should be that the baked object has the material that was previewed in GH_Component assigned to it.
What I find so far. DocObjects.Material is the base.Both RenderMaterial and DisplayMaterial can cast from it. but I don’t know how to cover RenderMaterial back to DocObjects.Material.
This post mentioned need to transfer material properity by each.
Once get DocOBjectMaterial done, use “var dm = new Rhino.Display.DisplayMaterial(DocObject.Material);”
I have been searched the answer around. I think the conclsion can be made so far. The conclusion is that IGH_PreviewArgs interface doesn’t have rendering method, it only draw shaded.
So the only way that you can render your geometry without bake it, is to use “custom preview” component.