Skip to main content

Asset Import / Export

Export

Pragma comes with the following export capabilities:

  • You can use Pragma to export Source Engine and Source 2 Engine assets for use in modelling programs
  • Assets in Pragma can be exported in the Source Engine model/material/texture format
    • Fake PBR can be applied automatically for use in SFM
  • Automatic generation of ambient occlusion maps (if they don't exist)
  • Automatic re-scaling of the models to meters
  • Conversion to match Blender's coordinate system
  • Includes the rig, all of the animations and morph targets of the model
  • Conversion to standard normal maps (e.g. if self-shadowed bumpmaps are used)
  • Conversion of Source 1 assets with PBR settings
  • Automatic conversion of the textures to png, bmp, tga, jpg, hdr, dds, ktx or vtf
  • Automatic conversion of the textures to a RMA format
  • Works with maps / level geometry

Exporting Assets

To use the exporter, you have to start a game in Pragma first. You can either load a map (which map doesn't matter), or run "map empty" in the console. Once the map has been loaded, you can use the following console command:

 

  • -export_images 1/0:0: If enabled, all textures of the asset will be converted to the specified image output format and saved alongside the asset. Default: 1
  • -normalize_texture_names 1/0:0: If enabled, the exported textures will be renamed according to their type (e.g. "textureName_normal") and will not keep their original name. Default: 0
  • -image_format png/bmp/tga/jpg/hdr/dds/ktx:ktx: The format to use for exported textures. Default: dds
  • -binary 1/0:0: If enabled, the model will be exported in the "glb" format, otherwise "glTF". Default: 0
  • -verbose 1/0:0: If enabled, additional information will be printed to the console during the export. Default: 1
  • -recursive 1/0:0: TODOIf enabled and a directory is specified as the asset, all assets from all sub-directories will be exported as well. Default: 0
  • -gamemodel 1/0:<modelName>: TODOExports the specified model. If a directory is specified, all models within that directory will be exported.
  • -formattexture TODO<textureName>: Exports the specified texture(s). If a directory is specified, all textures within that directory will be exported.
  • -previewmaterial TODO<materialName>: Exports the specified material(s). If a directory is specified, all materials within that directory will be exported.
  • -list_animations TODO
  • -animation TODO
  • -texture TODO
  • -material TODO
  • -map TODO
  • <mapName>:
  • -modelExports TODOthe specified map(s). If a directory is specified, all maps within that directory will be exported.

Models only:

  • -export_animations 1/0:0: If enabled, all animations of the model will be exported as well. This may drastically increase the file size and loading times when importing the model into a modelling program. Default: 1
  • -export_morph_targets 1/0:0: If enabled, will export all morph targets (flexes) of the model as well. Default: 1
  • -export_skinned_mesh_data 1/0:0: If disabled, no skeleton, vertex weights or animations will be exported. Default: 1
  • -embed_animations 1/0:0: If enabled, all of the animations of the model will be embedded in the exported glTF file. When disabled, each animation will be exported as a separate file instead. Default: 1
  • -full_export 1/0:0: If enabled, body groups of the model will be exported as well. Default: 0
  • -scale <scale>: The value by which to scale the exported meshes. Use 1 to keep the original scale. Use 0.025 to convert the meshes to meters. Default: 0.025
  • -generate_ao 1/0:0: If enabled, will automatically generate ambient occlusion maps for the model if it doesn't have any. Default: 0
  • -ao_resolution <resolution>: The resolution to use for the ambient occlusion maps if "generate_ao" is enabled. Default: 512
  • -ao_samples <samples>: The number of samples to use for generating the ambient occlusion maps if "generate_ao" is enabled. Default: 40
  • -ao_device cpu/gpu:gpu: Whether to use the CPU or GPU to generate the ambient occlusion maps if "generate_ao" is enabled. Default: cpu
  • -merge_meshes_by_material 1/0:0: If enabled, all meshes that use the same material will be merged. Default: 1
  • -enable_extended_dds 1/0:0: If enabled and the image format is set to dds, will enable support for BC6 and BC7 compression using the DXT10 version of the format. Default: 0
  •  -list_animations 1/0: If enabled, the model will not be exported and all available animations of the model will be listed in the console instead. Default: 0

 

  • -animation
      <animName>: If specified, only this animation will be exported.
    •  -format glTF/mdl: The output format for the model. If "mdl" is specified TODO
    • -game 1/0: Only has an effect if "format" is set to "mdl". TODO
    • -preview 1/0: If enabled, the model will be shown in the viewport. Default: 0

     

    Examples:

    Exporting a material (including textures):

    util_export_asset ((-modelmaterial <modelName>"brick/brick_1a" [-animationverbose <animName>]-image_format [png

    Exporting a texture:

    util_export_asset -list_animations])texture |"concrete/concrete_5_floor_3_psd_918fcd2d" -verbose -image_format png

    Exporting a map:

    util_export_asset -map <mapName>"gm_construct" | -material <matName> | -texture <texName>) [-verbose 1/0]-export_images [1 -binaryimage_format 1/0]png [-generate_ao 0 -export_animations 1/0]0
    [

    Exporting a model:

    util_export_asset -export_skinned_mesh_datamodel 1/0]"props_2fort/tank001" [-export_imagesverbose 1/0] [-image_format png/bmp/tga/jpg/hdr/dds/ktx]png [-enable_extended_dds 1/0] [-generate_ao 1/0]0
    [

    (Make sure to remove the ".mdl" extension!)

    Exporting a Source 2 model:

    util_export_asset -ao_samplesmodel 32/64/128/256/512]"characters/gman/gman" [-ao_resolutionverbose 512/1024/2084/4096]-image_format [png -scalegenerate_ao <scale>]0
    [

    Batch-exporting all models in a directory and all sub-directories:

    util_export_asset -embed_animationsmodel 1/0]"props_2fort" -verbose -image_format png -generate_ao 0 -recursive 1

     

     

     

     

     

    Source 2

     

    Source Engine Model Export

    Fake PBR

     

    Import