Tutorial - First Steps

From Pragma
Jump to: navigation, search

Note: During the beta, changes are made frequently to the Source-to-Pragma asset conversion process, which is why it's important to clear your previous files every update. To do so, simply follow these steps:

  • Go to your Pragma installation directory ("/Steam/steamapps/common/Pragma")
  • Remove the "cache" directory
  • Open the "addons" directory
  • Remove both the "imported" and the "converted" directories

If this is your first time launching Pragma, you can ignore these steps.

Loading a map

To load a map, open the "New Game" menu. If it's a map you have loaded previously, it should appear in the drop-down list and you can just select it.
If you're trying to load a Source Engine map for the first time, you'll have to type in the name of the map by hand (e.g. "gm_construct"). You do not have to copy any files, Pragma should be able to locate the map and all of the associated assets automatically.
Next, simply click "Start Game". Pragma may appear to be frozen for a while, that's because it's automatically converting the map, as well as all of the models, materials and other assets that are being used by that map into Pragma's native formats. Depending on the map complexity and the number of models, this may take several minutes.
After the map has been loaded, your CPU will most likely peak to 100% for several minutes. This is because Pragma has to do some additional conversions of the assets for PBR (such as generation ambient occlusion maps for each model), which is an expensive process but only has to be done once per model. Once this process has been completed, the next time you load the map and/or models, it should be much faster.
The lighting conversion from Source to Pragma is still work-in-progress, so you may get some lighting issues on some maps. This will be improved in the future.

To complete the PBR conversion process, you may also want to run "map_build_reflection_probes" via the console once per map, which may take a few more minutes. If you only want to use the Cycles renderer, you can skip this step.

Raytraced Screenshots

You can walk around the map and take a raytraced screenshot using the following console command (to open the console, press "`"):

screenshot -mode raytracing -samples 100 -denoise -format png -sky "skies/dusk379.hdr" -sky_strength 40 -sky_angles "0 160 0"

It may take several minutes for the screenshot to complete rendering, after which it will be placed in the "screenshots" directory of Pragma.


You can find a video demonstration on how to use Cycles with the Filmmaker here: https://youtu.be/KxOMn2OX0UE Here are a few important notes:

  • Make sure to click on "Work Camera" to toggle to the scene camera (the text on the button may stay the same at the moment, but it should still toggle).
  • Make sure the playhead has been moved to a film clip.
  • Make sure to specify a sky texture in the Cycles renderer tab! Default map lighting is currently disabled by default, if you do not select a sky (which will contribute to the lighting), your scene may appear pitch black.

There are several sky textures to choose from that are shipped with the Filmmaker, but you can download more from here, here, or other websites. The only requirement is that the sky has to be an equirectangular HDR image!
The choice of sky can make a bit impact on the lighting of your scene, I recommend playing around with the yaw-value of the sky angles, as well as the sky intensity until you get good results! To quickly get a rough idea of what it looks like, use the "Render Preview" button or use a low sample count (e.g. 20 samples).

You can render an animation by increasing the "Number of frames to render" option. The timeline will automatically advance for every frame and all frames will be stored as individual images in the output directory.

If you want to support the project in a simple and easy way, I would appreciate if you tagged artwork rendered in Pragma with "PFM" or "Pragma Filmmaker". This is entirely optional of course, but it would go a long way in helping the project out!

Material Tweaks

Since Source Engine assets are not PBR, Pragma has to make a lot of assumptions during the conversion process. In many cases not enough information is available and the result may not look as good as it could, so manual adjustments may be required. To do so, find the material (".wmi") in "Pragma/addons/converted/materials" and open it in a text-editor. The format is similar to Source Engine vmt-materials, but the parameters are not the same. Here are a few example parameters you can use:

$texture albedo_map "models/player/medic/medic_blue"
Location of the albedo map for the material.

$texture normal_map "models/player/medic/medic_normal"
Location of the normal map for the material.

$texture roughness_map "pbr/rough"
Location of the roughness map for the material.

$texture metalness_map "pbr/metal"
Location of the metalness map for the material.

$texture ao_map "models/player/medic/medic_red_ao"
Location of the ambient occlusion map for the material.

$texture emission_map "models/buildables/sentry1/sentry1"
Location of the emission/glow map for the material.

$float metalness_factor "0.000000"
A factor which is multiplied with the metalness map to determine the final PBR metalness value.

$float roughness_factor "0.500000"
A factor which is multiplied with the roughness map to determine the final PBR roughness value.

Cycles only:
These parameters can be used to enable subsurface scattering for a model, but will only have an effect when rendering with Cycles.
$float subsurface_multiplier 0.0375
$color subsurface_color "242 210 157"
$int subsurface_method 5
$vector subsurface_radius "112 52.8 1.6"

Pragma automatically detects file changes, so you do not have to restart the Engine or reload the map whenever you've made any changes to the materials – the changes should apply immediately.