• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

[request] Cline from Camera Eye to Sun

Scheduled Pinned Locked Moved Plugins
7 Posts 3 Posters 569 Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    derei
    last edited by 16 Mar 2011, 08:03

    Hy, I need to position a Light Emitting plane for my scene, to replace SUN for rendering, but I want to position it exactly in place of sun (to have same shadows). For that, I need an axis to point from Camera View to Sun direction. Any plugin for that? Or is possible with some code directly from ruby console?

    DESIGNER AND ARTIST [DEREI.UK](http://derei.uk/l)

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 17 Mar 2011, 20:36

      Untried.
      model=Sketchup.active_model sdir=model.shadow_info["SunDirection"] Vector3d(0.259928, -0.492601, 0.830531) cama=model.active_view.camera ceye=cama.eye ctar=cama.target vec2=ctar.vector_to(ceye) vect=Geom::Vector3d.linear_combination(0.5, sdir, 0.5, vec2)
      Perhaps vect is the vector from the eye to the sun ?
      OR perhaps just sdir is the vector ? Test it and see...

      TIG

      1 Reply Last reply Reply Quote 0
      • D Offline
        Didier Bur
        last edited by 17 Mar 2011, 21:06

        Just for fun, this one-line command creates a guide line from eye to sun.

        Sketchup.active_model.entities.add_cline(Sketchup.active_model.active_view.camera.eye,Geom;;Vector3d.linear_combination(0.5,Sketchup.active_model.shadow_info["SunDirection"],0.5,Sketchup.active_model.active_view.camera.target.vector_to(Sketchup.active_model.active_view.camera.eye)))
        
        

        DB

        1 Reply Last reply Reply Quote 0
        • T Offline
          TIG Moderator
          last edited by 17 Mar 2011, 21:15

          @didier bur said:

          Just for fun, this one-line command creates a guide line from eye to sun.

          Sketchup.active_model.entities.add_cline(Sketchup.active_model.active_view.camera.eye,Geom;;Vector3d.linear_combination(0.5,Sketchup.active_model.shadow_info["SunDirection"],0.5,Sketchup.active_model.active_view.camera.target.vector_to(Sketchup.active_model.active_view.camera.eye)))
          > 
          

          Thanks Didier, I knew it was some permutation of those things 😒

          TIG

          1 Reply Last reply Reply Quote 0
          • D Offline
            derei
            last edited by 17 Mar 2011, 23:22

            Thank you very much for this, but it seems to be some problem. See the images.
            If I look from downside, the line is mirrored. Instead of ascending from camera eye to back, where is the sun, it goes in opposite direction.


            1.png


            2.png

            DESIGNER AND ARTIST [DEREI.UK](http://derei.uk/l)

            1 Reply Last reply Reply Quote 0
            • T Offline
              TIG Moderator
              last edited by 18 Mar 2011, 09:07

              Since the sun is assumed to be infinitely far away you can make a cline 'ray' from the eye in the direction of its vector thus...
              model=Sketchup.active_model svec=model.shadow_info["SunDirection"] peye=model.active_view.camera.eye clin=model.active_entities.add_cline(peye, svec) clin.end=nil clin.start=peye

              makes a ray extending from the eye to infinity...

              Here it is in one line

              model=Sketchup.active_model;svec=model.shadow_info["SunDirection"];peye=model.active_view.camera.eye;clin=model.active_entities.add_cline(peye, svec);clin.end=nil;clin.start=peye
              

              TIG

              1 Reply Last reply Reply Quote 0
              • D Offline
                derei
                last edited by 18 Mar 2011, 12:15

                Thank you TIG, this is exactly what I wanted. ☀

                DESIGNER AND ARTIST [DEREI.UK](http://derei.uk/l)

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                1 / 1
                • First post
                  2/7
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement