Turn on Color Backfaces visualization via RhinoCommon

Hi

I’ve searched the entire forum and can’t find an answer to this.

Thanks!!!

Nobody???

This might help:

-Kevin

Hi @cristiano.pasini,

do you want to enable it for a specific display mode or for a custom display (eg. conduit) ?

_
c.

clement

For a specific display mode (Rendered)

Hi @cristiano.pasini,

i’ve tried something which seems to toggle backface appearance in Rendered display on and off but cannot find how to set the color (or material) for the backface:

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs

def DoSomething():
    
    sid = Rhino.Display.DisplayModeDescription.RenderedId
    dmd = Rhino.Display.DisplayModeDescription.GetDisplayMode(sid)
    if not dmd: return
    
    state = dmd.DisplayAttributes.UseCustomObjectMaterialBackfaces
    # toggle state
    dmd.DisplayAttributes.UseCustomObjectMaterialBackfaces = not state
    Rhino.Display.DisplayModeDescription.UpdateDisplayMode(dmd)
    
    # hack to make display mode really update
    rs.DeleteObject(rs.AddPoint(0,0,0))
    
    scriptcontext.doc.Views.Redraw()
    
DoSomething()

In my test, i had an open box which has green object color and a red material assigned:

BackFaceMaterialToggle

btw. there is also UseCustomObjectColorBackfaces but this only worked in Shaded display mode so i tried UseCustomObjectMaterialBackfaces which seems to change something in Rendered.

@stevebaer, since you’ve added this some time ago, is there a way to change the actual backface color/material itself ?

@dale, this is another example where the display does not update until an object is added to the doc. Same as this one.
_
c.

2 Likes

I’m speechless…thank you so much!!!

1 Like