Announcement

Collapse
No announcement yet.

rendering depth-map

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • rendering depth-map

    Hi all!
    Does anybody knows how can I render different objects in the same scene with this result?

    http://www.google.es/search?q=depth-...w=1280&bih=857

    I want toshow the colors depending on the distance between the objects and the camera. thanks!

  • #2
    Use the _ShowZBuffer command. (It's pure Rhino!)

    Bye.

    Comment


    • #3
      You could also use the Z-Depth channel inside the V-Ray. The Z-Depth is located on the V-Ray channel tab on the V-Ray option. The only thing that you have to define is the distance form the camera to the closer plane of the depth and the distance from the camera to the further away plane.
      You can watch this video to have an idea of the Z-Depth channel.

      http://www.youtube.com/user/ChaosGro...48/s9KCgGQtUfk

      Best

      Comment


      • #4
        Damien wrote a script that set the max/min distance of selected objects. Here the version ready for a Rhino button:

        -_RunScript (
        Option Explicit
        'Script written by Damien Alomar
        'Script copyrighted by ASGvis, LLC
        'Script version Wednesday, December 3, 2008

        Call SetZDepth()
        Sub SetZDepth()

        Dim Vray
        Set Vray = Rhino.GetPlugInObject ("V-Ray For Rhino")

        Dim depthObjs, currPlane, viewPlane, viewBB
        Dim midBackPlaneCP, midBackPlaneWorld, backPlaneDist
        Dim midFrontPlaneCP, midFrontPlaneWorld, frontPlaneDist
        Dim blkOwhite, prevMin

        depthObjs = Rhino.GetObjects ("Select Objects to be considered for Depth Map", 8+16+32, False, True)
        If IsNull(depthObjs) Then Exit Sub

        If Not IsNull(Vray) Then
        prevMin = Rhino.GetDocumentData ("Vray zDepth", "MinBool")
        If IsNull(prevMin) Then
        prevMin = True
        Else
        prevMin = CBool(prevMin)
        End If

        blkOwhite = Rhino.GetBoolean ("Set Minimum Value as White or Black?", Array("MinAs", "Black", "White"), Array(prevMin))
        If IsNull(blkOwhite) Then Exit Sub

        Call Rhino.SetDocumentData ("Vray zDepth", "MinBool", blkOwhite(0))
        End If

        Rhino.EnableRedraw False

        currPlane = Rhino.ViewCPlane
        viewPlane = Rhino.ViewCameraPlane
        Rhino.ViewCPlane ,viewPlane

        viewBB = Rhino.BoundingBox (depthObjs, Rhino.CurrentView ,False)

        midBackPlaneCP = AveragePoints (Array(viewBB(0),viewBB(1),viewBB(2), viewBB(3)))
        midBackPlaneWorld = Rhino.XformCPlaneToWorld (midBackPlaneCP, viewPlane)
        backPlaneDist = Rhino.Distance (midBackPlaneWorld, Rhino.ViewCamera)

        midFrontPlaneCP = AveragePoints (Array(viewBB(4),viewBB(5),viewBB(6), viewBB(7)))
        midFrontPlaneWorld = Rhino.XformCPlaneToWorld (midFrontPlaneCP, viewPlane)
        frontPlaneDist = Rhino.Distance (midFrontPlaneWorld, Rhino.ViewCamera)

        If IsNull(Vray) Then
        Rhino.Print "V-Ray Scripting is not available...Minimum Z-Depth = " & Round(frontPlaneDist, 6) & " Maximum Z-Depth = " & Round(backPlaneDist,6)
        Else
        Call Vray.AddVFBChannelByName ("Z-Depth")

        If blkOwhite(0) Then
        Call Vray.SetzDepthWhiteVal (Round(frontPlaneDist, 6))
        Call Vray.SetzDepthBlackVal (Round(backPlaneDist, 6))
        Else
        Call Vray.SetzDepthWhiteVal (Round(backPlaneDist, 6))
        Call Vray.SetzDepthBlackVal (Round(frontPlaneDist, 6))
        Call Vray.SetzDepthClamp (False)
        End If
        End If

        Rhino.ViewCPlane ,currPlane

        Rhino.EnableRedraw True
        End Sub

        Function AveragePoints (arrPoints)
        AveragePoints = Null

        If Not IsArray(arrPoints) Then Exit Function

        Dim avgPt(2), i, j

        For i=0 To Ubound(arrPoints)
        For j=0 To 2
        avgPt(j) = avgPt(j) + arrPoints(i)(j)
        Next
        Next

        For j=0 To 2
        avgPt(j) = avgPt(j)/(Ubound(arrPoints)+1)
        Next

        AveragePoints = avgPt
        End Function
        )
        www.simulacrum.de - visualization for designer and architects

        Comment

        Working...
        X