# KiBot output for generating PCB 3D model PCB3D Blender format
# https://kibot.readthedocs.io/en/latest/configuration/outputs/PCB2Blender_ToolsOptions.html

# The lighting setup allows for even, diffuse background lighting as well as
# a focused light for shadows/depth. The eight area lights form a ring around
# the top of the board, while the spot light illuminates from behind and to the
# right of the camera. The accent lights illuminate from behind the board at a
# low angle to help light up solder pads. 
# 
# For top/bottom renders that look directly down at the board, set @SPOT_LIGHT@
# to 0.1 and @ADIFFUSE_LIGHT@ to 0.7. For angle renders, start with @SPOT_LIGHT@
# set to 2.0 and @DIFFUSE_LIGHT@ at 0.4. Some experimentation, including with
# the ring radius and height, may be required to get good results.

kibot:
  version: 1

outputs:
  - name: @NAME@
    output_id: @NAME@
    comment: '@COMMENT@'
    type: blender_export
    category: '@DIR@'
    dir: '@DIR@'
    options:
      auto_camera_z_axis_factor: 1.1
      pcb_import:
        enhance_materials: true
        texture_dpi: @TEXTURE_DPI@

      pcb3d:
        download: true
        download_lcsc: true
        dnf_filter:
          - @DNF_FILTER@

      render_options:
        auto_crop: true
        transparent_background: true
        samples: @SAMPLES@
        resolution_x: @RESOLUTION_X@
        resolution_y: @RESOLUTION_Y@

      point_of_view:
        rotate_x: @ROTATE_X@
        rotate_y: @ROTATE_Y@
        rotate_z: @ROTATE_Z@
        view: @VIEW@

      outputs:
        - type: render
          output: '%f-%I%v.%x'

      light:
        - name: spot
          energy: @SPOT_LIGHT@
          pos_x: -size*3.33
          pos_y: size*3.33
          pos_z: size*5
          type: POINT

        - name: accent_1
          energy: @ACCENT_LIGHT@
          pos_x: -size*2
          pos_y: size*6
          pos_z: size*3
          type: AREA

        - name: accent_2
          energy: @ACCENT_LIGHT@
          pos_x: size*2
          pos_y: size*6
          pos_z: size*3
          type: AREA

        - name: ring_1
          energy: @DIFFUSE_LIGHT@
          pos_x: size*@DIFFUSE_RADIUS@
          pos_y: 0
          pos_z: size*@DIFFUSE_HEIGHT@
          type: AREA

        - name: ring_2
          energy: @DIFFUSE_LIGHT@
          pos_x: -size*@DIFFUSE_RADIUS@
          pos_y: 0
          pos_z: size*@DIFFUSE_HEIGHT@
          type: AREA

        - name: ring_3
          energy: @DIFFUSE_LIGHT@
          pos_x: 0
          pos_y: size*@DIFFUSE_RADIUS@
          pos_z: size*@DIFFUSE_HEIGHT@
          type: AREA

        - name: ring_4
          energy: @DIFFUSE_LIGHT@
          pos_x: 0
          pos_y: -size*@DIFFUSE_RADIUS@
          pos_z: size*@DIFFUSE_HEIGHT@
          type: AREA

        - name: ring_5
          energy: @DIFFUSE_LIGHT@
          pos_x: size*0.71*@DIFFUSE_RADIUS@
          pos_y: size*0.71*@DIFFUSE_RADIUS@
          pos_z: size*@DIFFUSE_HEIGHT@
          type: AREA

        - name: ring_6
          energy: @DIFFUSE_LIGHT@
          pos_x: -size*0.71*@DIFFUSE_RADIUS@
          pos_y: size*0.71*@DIFFUSE_RADIUS@
          pos_z: size*@DIFFUSE_HEIGHT@
          type: AREA

        - name: ring_7
          energy: @DIFFUSE_LIGHT@
          pos_x: size*0.71*@DIFFUSE_RADIUS@
          pos_y: -size*0.71*@DIFFUSE_RADIUS@
          pos_z: size*@DIFFUSE_HEIGHT@
          type: AREA

        - name: ring_8
          energy: @DIFFUSE_LIGHT@
          pos_x: -size*0.71*@DIFFUSE_RADIUS@
          pos_y: -size*0.71*@DIFFUSE_RADIUS@
          pos_z: size*@DIFFUSE_HEIGHT@
          type: AREA

...
definitions:
  NAME: blender_3d_angled_top
  COMMENT: PCB 3D model in PCB3D Blender format
  DIR: renders
  DNF_FILTER: _kibom_dnf_Config
  RESOLUTION_X: 1280
  RESOLUTION_Y: 1280
  TEXTURE_DPI: 1031.0
  SAMPLES: 5
  ROTATE_X: 30
  ROTATE_Y: 10
  ROTATE_Z: 10
  VIEW: top
  DIFFUSE_RADIUS: 6.0
  DIFFUSE_HEIGHT: 10.0
  DIFFUSE_LIGHT: 0.4
  ACCENT_LIGHT: 0.1
  SPOT_LIGHT: 2.0
