Announcement

Collapse
No announcement yet.

2D Trees and peoples at planes aligned to the camera script

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

  • 2D Trees and peoples at planes aligned to the camera script

    Hi,

    in the rhino forum I have got a very nice script good for arch viz. Now we can use 2D textures of tree and peoples with opacity map (I think it will be ready in the next releases) at camera aligned planes.
    The script helps to align the planes with the texures to the camera again after the camera was moved.

    -Micha


    Here the script ready to copy to a rhino button:
    Code:
    _-runscript (orientBillboardsToCamera
    
    Sub orientBillboardsToCamera()
    	Dim objects
    	objects = Rhino.GetObjects("Select billboard surfaces", 8,, True)
    	If Not IsArray(objects) Then Exit Sub
    	Dim redrawing
    	redrawing = Rhino.EnableRedraw(False)
    	Dim cameraLine, flattenedCameraLocation
    	cameraLine = Rhino.ViewCameraTarget
    	flattenedCameraLocation = setZ(cameraLine(0), 0)
    	Dim objectID		
    	For Each objectID In objects
    		orientBillboard objectID, flattenedCameraLocation
    	Next
    	Rhino.EnableRedraw redrawing
    End Sub
    
    Sub orientBillboard(objectID, flattenedCameraLocation)
    	Dim centroidPoint, centroidUV, centroidNormal
    	centroidPoint = Rhino.SurfaceAreaCentroid(objectID)
    	centroidUV = Rhino.SurfaceClosestPoint(objectID, centroidPoint(0))
    	centroidNormal = Rhino.SurfaceNormal(objectID, centroidUV)
    	Dim referenceLine, targetLine
    	referenceLine = Array(setZ(centroidNormal(0), 0), setZ(centroidNormal(1), 0))
    	targetLine = Array(referenceLine(0), flattenedCameraLocation)
    	Rhino.OrientObject objectID, referenceLine, targetLine
    End Sub
    
    Function setZ(point, value)
    	setZ = Array(point(0), point(1), value)
    End Function)
    www.simulacrum.de - visualization for designer and architects

  • #2
    nice script

    sweet! Very useful, thanks Micha

    Comment


    • #3
      2D Trees and peoples at planes aligned to the camera script

      i couldnt get this work
      the script only rotated the plane a bit
      should i preload the picture to the plane as decal or something

      i copy pasted the text to a button
      not worked
      i saved the text as rvb
      not worked

      i use rhino 3 sr5
      can anyone help me on the subject
      do dot.net 2 required or so

      Comment


      • #4
        2D Trees and peoples at planes aligned to the camera script

        Try this one.


        PS:You must edit the toolbar button to get real location of Billboards.rvb

        Comment


        • #5
          2D Trees and peoples at planes aligned to the camera script

          ALTO, do you have a new script?
          www.simulacrum.de - visualization for designer and architects

          Comment


          • #6
            2D Trees and peoples at planes aligned to the camera script

            Yes is different from yours try it!

            Comment


            • #7
              2D Trees and peoples at planes aligned to the camera script

              Ah, a nice icon and an option dialog. But I get an error, so that I can not test it.
              I translate from german:

              Code:
              Source: runtime error ...
              Error: object is no list
              line: 74
              char: 0
              code: 0
              www.simulacrum.de - visualization for designer and architects

              Comment


              • #8
                2D Trees and peoples at planes aligned to the camera script

                Script is not mine, i've only edited a little, created icon and toolbar.
                I think you've got this error because first you should select billboard objects (click with RMB) and then click LMB to autorotate.

                PS You can always invert LMB with RMB command

                PPS This script works with surfaces only!

                Comment


                • #9
                  2D Trees and peoples at planes aligned to the camera script

                  Ah, I understand: all billboards can be turned later without selection again.
                  www.simulacrum.de - visualization for designer and architects

                  Comment


                  • #10
                    Re: 2D Trees and peoples at planes aligned to the camera script

                    Hello ALTO,

                    any chance to get this button&script working for Rhino 4 please.

                    -Micha
                    www.simulacrum.de - visualization for designer and architects

                    Comment


                    • #11
                      Re: 2D Trees and peoples at planes aligned to the camera script

                      I see ALTO's post above, but I don't see a link to download the script. I need it for Rhino 3.0? Can someone post it? (Old forum links don't work.)

                      Thanks,
                      Craig

                      Comment


                      • #12
                        Re: 2D Trees and peoples at planes aligned to the camera script

                        Originally posted by Craig Gorton
                        I see ALTO's post above, but I don't see a link to download the script. I need it for Rhino 3.0? Can someone post it? (Old forum links don't work.)
                        http://fileho.com/download/b20485602...cript.rar.html - are you talking about this one from the following post? I'm seeing that it has been deleted from where it was originally posted due to "abuse". Who knows...

                        Originally posted by ALTO
                        Try this one.


                        PS:You must edit the toolbar button to get real location of Billboards.rvb
                        Best regards,
                        Joe Bacigalupa
                        Developer

                        Chaos Group

                        Comment


                        • #13
                          Re: 2D Trees and peoples at planes aligned to the camera script

                          That's the one. Admit it, Joe, you were rendering naked teens again!

                          But seriously,
                          Anyone got it?

                          Comment


                          • #14
                            Re: 2D Trees and peoples at planes aligned to the camera script

                            Searching through my computer I found some Billboard Scrips (orient to camera is one) I packaged them all together.

                            http://s6.fileho.com/download3/b2048...hinoScript.rar

                            I just hope fileHO doesn't find these 'improper' again. :

                            Comment


                            • #15
                              Re: 2D Trees and peoples at planes aligned to the camera script

                              Originally posted by Craig Gorton
                              That's the one. Admit it, Joe, you were rendering naked teens again!
                              I thought you said you were going to keep that between us? I can't trust anyone these days...
                              Best regards,
                              Joe Bacigalupa
                              Developer

                              Chaos Group

                              Comment

                              Working...
                              X