Determining Casts and Receives shadows


#1

Hello everyone,

is there any chance to determining the “Casts shadows” and “Receives shadows” property like shown in the Properties?
It is not in the attributes nor on mesh of the objects. In the whole SDK is no hint for shadows. Even the Render API has nothing about shadows. Is there something else to get this information?

best
Holger


#2

Hi holger,

It is in the rendering attributes of the model. From Rhino object, take the Attributes and then the rendering attributes.

Cheers,
Dimitris


#3

Hi Dimitri,

maybe I overlook something. I have this:

        Dim ObjRef As Rhino.DocObjects.ObjRef
        ObjRef = New Rhino.DocObjects.ObjRef(myID)
        Dim myObjAtts As Rhino.DocObjects.ObjectAttributes = ObjRef.Object.Attributes

but in myObjAtts I can’t find rendering attributs. Or how can I get this render attributes.

thanks
Holger


#4

Oops, what I said is about C++.
According to C++ a rendering_attributes object should be located in myObjAtts.
Maybe someone that uses this language can help.

Cheers,
Dimitris


(Dale Fugier) #5

Looks like these parameters have not (yet) been exposed to RhinoCommon. Added to the pile…

http://mcneel.myjetbrains.com/youtrack/issue/RH-31844


#6

Thank you, Dale

are there any other hacks to get a (readonly) access to this properties?


(Dale Fugier) #7

Nope not tricks - sorry. You could always write in C++…


#8

I found an ugly trick, to get a selection of all Recieving and Casting Meshes:
(My level of suffering was high enough, to use this)

    Dim myDoc As RhinoDoc = RhinoDoc.ActiveDoc
    Dim myIdsCast As New Rhino.Collections.RhinoList(Of Guid)
    Dim myIdsRec As New Rhino.Collections.RhinoList(Of Guid)
    Dim settings As New Rhino.DocObjects.ObjectEnumeratorSettings()
    settings.ObjectTypeFilter = Rhino.DocObjects.ObjectType.Mesh

    For Each obj As Rhino.DocObjects.RhinoObject In myDoc.Objects.GetObjectList(settings)

        Rhino.RhinoApp.ClearCommandHistoryWindow()
        Rhino.RhinoApp.RunScript("SelID " & obj.Id.ToString, True)
        Rhino.RhinoApp.RunScript("-Properties o ReceivesShadows _Enter CastsShadows _Enter _Enter _Enter", True)
        Rhino.RhinoApp.RunScript("SelNone", True)

        Dim myHistory As String = Rhino.RhinoApp.CommandHistoryWindowText

        If myHistory.Contains("Receives shadows <Yes>") Then
            myIdsRec.Add(obj.Id)
        End If

        If myHistory.Contains("Casts shadows <Yes>") Then
            myIdsCast.Add(obj.Id)
        End If
    Next

#9

Guess this hasn’t been solved?

Next issue how to access the enable / disable diffused lighting material property via rhinocommon?


(Dale Fugier) #10

ObjectAttributes.CastsShadows and ObjectAttributes.ReceivesShadows should be available in next week’s WIP release…

– Dale


#11

Cool,

and how about diffuesed lighting is this dirggerable via vb.net?

here what I mean manually:


(Dale Fugier) #12

I believe this is controlled by Material.DisableLighting. Let me know if this is correct (or not).

– Dale


#13

For which Rhino Version, doesn’t work for

vb.NET / Rhino.DocObjects.Material / in Version 5.0


(Dale Fugier) #14

Sorry for not being clear, I was referring to the Rhino WIP.

– Dale