Announcement

Collapse
No announcement yet.

Vray multibake textures

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

  • Vray multibake textures

    Hi all,

    Me and my friend are trying to find a way to bake multiple texture with vray in blender,
    after some help we use this script:

    Code:
    import bpy
    
    sce = bpy.context.scene
    
    # Enable autosave
    sce.vray.exporter.auto_save_render = True
    sce.vray.SettingsOutput.img_dir = "//bake/"
    
    # Enable Bake
    sce.vray.VRayBake.use = True
    
    # Manual object list:
    ob = ['cube','plane']
    # for ob in objects:
    
    # Selection
    for ob in bpy.context.selected_objects:
        sce.vray.VRayBake.bake_node = ob.name
        sce.vray.SettingsOutput.img_file = "bake_%s"%(ob.name)
    
        bpy.ops.vray.render()
    the problem is vray opens 2 windows to bake, but renders 2 times only the 1st object (cube).

    it's possible to fix?
    thank you in advance!

  • #2
    Re: Vray multibake textures

    Set
    Code:
    sce.vray.exporter.wait = True
    and it will wait until render end.

    So it'll be like:
    Code:
    import bpy
    
    sce = bpy.context.scene
    
    # Enable autosave
    sce.vray.exporter.auto_save_render = True
    sce.vray.SettingsOutput.img_dir = "//bake/"
    
    # Enable Bake
    sce.vray.VRayBake.use = True
    
    # Wait until render end
    sce.vray.exporter.wait = True
    
    # Selection
    for ob in bpy.context.selected_objects:
        sce.vray.VRayBake.bake_node = ob.name
        sce.vray.SettingsOutput.img_file = "bake_%s"%(ob.name)
    
        bpy.ops.vray.render()
    
    # Restore settings
    sce.vray.VRayBake.use  = False
    sce.vray.exporter.wait = False
    V-Ray For Houdini | V-Ray Hydra Delegate | VRayScene
    andrei.izrantcev@chaos.com
    Support Request

    Comment


    • #3
      Re: Vray multibake textures

      thank you alot!

      that's works but still not perfect because it start to render but when finished to start the new bake needs i close manually the vray frame buffer.
      how can tell vray to close the process and start with other automatically?

      thanks in advance!

      Comment


      • #4
        Re: Vray multibake textures

        Code:
        sce.vray.exporter.autoclose = True
        V-Ray For Houdini | V-Ray Hydra Delegate | VRayScene
        andrei.izrantcev@chaos.com
        Support Request

        Comment


        • #5
          Re: Vray multibake textures

          Thank you very much bdancer, you solved our problem

          i really appreciated your help, your exporter is just awesome!

          if i can i would ask you another hint about the baking textures with vray,

          atm the only way to bake textures with vray is on individual objects, my question is:
          would be possible bake by materials and not by objects?

          for example a room with many materials multi bake by materials?

          thanks

          Comment


          • #6
            Re: Vray multibake textures

            I guess may be you could just collect objects by materials, not sure if its possible to bake just material.
            Here is an example with UI and operator stuff http://www.pasteall.org/40352/python you will just need to add some of the baking code.
            V-Ray For Houdini | V-Ray Hydra Delegate | VRayScene
            andrei.izrantcev@chaos.com
            Support Request

            Comment


            • #7
              Re: Vray multibake textures

              Originally posted by bdancer
              I guess may be you could just collect objects by materials, not sure if its possible to bake just material.
              Here is an example with UI and operator stuff http://www.pasteall.org/40352/python you will just need to add some of the baking code.
              Hi bdancer thank you alot for your help!

              The first solution about bake objects works perfectl!

              Unfortunatly we are not scripters so the one for materials we tried to complete the script u provided in pasteall.org but neither start the rendering, so please could you write the script with also the bake part?

              Thank you again for your work

              Comment


              • #8
                Re: Vray multibake textures

                http://www.pasteall.org/40363/python
                After run there will be a panel in Scene buttons called "Bake Tools" you'll find all stuff there.
                Have fun! =)
                V-Ray For Houdini | V-Ray Hydra Delegate | VRayScene
                andrei.izrantcev@chaos.com
                Support Request

                Comment


                • #9
                  Re: Vray multibake textures

                  I really liked the "bake by selection" script. I filled in the gaps and use the version below.

                  However, this locks Blender until the renderings are finished. I could use two instances of Blender to keep working, but is there a way to get around this?

                  Code:
                  import bpy
                  
                  sce = bpy.context.scene
                  
                  # Enable autosave
                  sce.vray.exporter.auto_save_render = True
                  sce.vray.SettingsOutput.img_dir = "//bake/"
                  
                  # Enable Bake
                  sce.vray.VRayBake.use = True
                  
                  # Wait until render end
                  sce.vray.exporter.wait = True
                  
                  # Autoclose
                  sce.vray.exporter.autoclose = True
                  
                  # Selection
                  for ob in bpy.context.selected_objects:
                      sce.vray.VRayBake.bake_node = ob.name
                      sce.vray.SettingsOutput.img_file = "bake_%s"%(ob.name)
                  
                      bpy.ops.vray.render()
                  
                  # Restore settings
                  sce.vray.VRayBake.use  = False
                  sce.vray.exporter.wait = False
                  sce.vray.exporter.autoclose = False

                  Comment

                  Working...
                  X