Announcement

Collapse
No announcement yet.

Ruby code run 5 times slower after render

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

  • Ruby code run 5 times slower after render

    In a new Sketchup session, my ruby code tooks just 1 minute to complete.
    But also in a brand new Sketchup session, if I ever click Render then stop render, then run my code, it will tooks 5 minutes.

    I noticed that after clicking render, Ruby console printed “Initializing Renderer”.
    So I wonder if there is any command to close/unregister or Un-Initializing renderer (for the purpose running code as fast as before render)?

    The test scene can be downloaded here: https://wetransfer.com/downloads/890...6042322/5fdb8e
    (or you can use any scene above 100k faces to easily see the different)

    The test code can be viewed here (it just simply add layer to all Face):​ https://pastebin.pl/view/2dcd4718
    (another forum bug: cannot paste this code directly here because chaos forum report 403 error...)

  • #2
    First up I'd like to say thanks for drawing our attention to this. The slowdown is almost certainly due to sketchup observers. There have been plans for a general overhaul of them for some time and this raises its priority. There will always be a performance hit to having them in place but 5X slowdown is not something we're comfortable with.

    It is not the act of rendering that is slowing things down. Rather it is the "context activation" (which happens when you interact with anything v-ray related, including rendering). To deactivate the context you can enter the following in the ruby console

    Code:
    VRay::Context.active(false)&.delete
    ​

    Comment


    • #3
      Code speed is back to normal now after deactivating the context, thank you a lot!

      Comment


      • #4
        Just a small question: What is the command to get the original size of texture of VrayMtl? I can’t find any properties related to size of texuture in mtl[:brdf][:diffuse_tex][:bitmap]

        Comment


        • #5
          Hi benmack180​,

          In V-Ray the 'size' of the bitmaps is set in UV space.
          There is a separate node/plugin (we call nodes in the shader graph 'plugins') that take scare of that called UVWGenChannel.
          It is connected to the TexBitmap.uvwgen
          If I remember correctly its uvw_transform parameter holds the texture transformation (a transformation matrix and an offset vector).

          With that in mind, it might be easier for you to change the SketchUp material's size instead.
          V-Ray applies it on top of all texture transforms for each material.

          Hope that helps,
          Konstantin

          Comment


          • #6
            Hi Konstantin, thank you for your detailed respond!

            Actually I'm looking for the width height resolution of the related bitmap. Do you know if the resolution info is saved somewhere?

            Comment

            Working...
            X