Custom maps #150
sultim-t
announced in
Announcements
Custom maps
#150
Replies: 3 comments 4 replies
-
I converted the Hazard-Course and it was surprisingly easy to do following this guide. |
Beta Was this translation helpful? Give feedback.
1 reply
-
its been almost 2 years WHERE ARE YOU? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Note: this is intended to tweak maps; if modifying becomes too complex for a mod, it might be worth to wait for Half-Life RTX (another project that adds path tracing to HL1: a full mod support is claimed), or NVIDIA RTX Remix
Note: Texture replacements is expected to be read first
In HL1, each map contains static (walls, floors etc) and dynamic objects (characters. particles etc).
In HL1RT, static objects and static light sources can be exported to gITF2 format via RTGL1 devmode (more about devmode here).
With gITF, we can modify existing light sources, geometry; and even add new ones.
The overall workflow for a new map:
data/scenes,json
Details
For example, we would like to make this map RT-compatible
Install it, by unzipping it to
Half-Life/valve
folder, sodm_dust2_hl1.bsp
is insideHalf-Life/valve/maps
. Launch the game, load into it.Export
Ensure that
No server cull
is enabled (otherwise not all lights/objects will be exported).In devmode window, click
Export frame geometry
Open
Open the exported glTF in Blender
Tip: Enable viewport shading mode (to see the lighting/textures), and set sampling to 1 (so it's less laggy)
Now we should see the map
Modify
All the objects must be inside
rtgl1_main_root
(as HL1 uses non-metric system)Let's make sun green
Export
HL1RT hot-reloads glTF files, so a game can just run in background, and as soon we export glTF, we should see the changes in the game instantly (if there are no errors, and if devmode is enabled).
Click File->Export->glTF 2.0 (it's useful to keybind it, e.g. Ctrl-E)
Find the existing file, select it
glTF export settings must be:
Tip: it's useful to save such export settings:
The name line will be red, as we replace existing file. Click Export
We would see a message in HL1 console
and the sun is green now
Cleaning
HLT1RT exporter juts works.
glTF doesn't support polygon lights, so they are approximated by spotlights, and usually the HL1RT exporter produces too many unnecessary lights around polygons. They should be removed (less lights = less noise)
Example: remove three unnecessary spotlights and leave only one point light
Just works
Per-scene properties
There's a limited set of optional properties that can be set for a scene:
Half-Life/rt/data/scenes.json
contains the properties. If a property is not found inscenes.json
, then values from cvars are used.For custom maps, add an entry with a specified
sceneName
.Note: HL1 map names have format
maps/c0a0.bsp
, butsceneName
is onlyc0a0
Warning: there are bugs related to spaces in the JSON-parser, specifically, spaces around
:
in arrays are interpreted as errors. Remove spaces and look into the console logs for parser errors!Per-object properties
glTF allows extra fields on objects. We can utilize that to provide more info to the renderer. For example, make a light volumetric, or mark a mesh as mirror.
Lights:
lightstyle
-- use dynamic intensity mu;tiplier from original HL1 map lightstylesisVolumetric
-- only one light can be marked as volumetric per map; if none of the glTF lights have this property, sun is usedMeshes:
isGlass
isMirror
isWater
Adding custom objects
To add a new mesh, just create it in Blender and put it inside
rtgl1_main_root
.Custom textures (TGA/PNG) should exist in the same folder as its
.gltf
file.Never use textures from
mat_junction
folder for new objects.Light leaks
When using volumtrics, light might leak throw thin walls or if nothing obstructs the light source (e.g. a building doesn't have a roof). To prevent such leaks, walls should be thicker (or rt_volume_far smaller, so the grid voxels are smaller) / add geometry to obstruct the light source.
Publish
Only distribute
scenes.json
,.gltf
,.bin
and your own textures.Never include
mat_junction
folder as it contains original HL1 textures, and used only to display textures in Blender.Screenshots
Editing
Different light setups
Beta Was this translation helpful? Give feedback.
All reactions