sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download

    [request] Cline from Camera Eye to Sun

    Scheduled Pinned Locked Moved Plugins
    7 Posts 3 Posters 626 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.
    • dereiD Offline
      derei
      last edited by

      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
      • TIGT Offline
        TIG Moderator
        last edited by

        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
        • Didier BurD Offline
          Didier Bur
          last edited by

          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
          • TIGT Offline
            TIG Moderator
            last edited by

            @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
            • dereiD Offline
              derei
              last edited by

              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
              • TIGT Offline
                TIG Moderator
                last edited by

                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
                • dereiD Offline
                  derei
                  last edited by

                  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
                  • First post
                    Last post
                  Buy SketchPlus
                  Buy SUbD
                  Buy WrapR
                  Buy eBook
                  Buy Modelur
                  Buy Vertex Tools
                  Buy SketchCuisine
                  Buy FormFonts

                  Advertisement