SteamVR

SteamVR

SteamVR Workshop
Customize your SteamVR experience by finding new backgrounds, 3D environments, controllers and base station models.
Learn More
Lightmap support
The SteamVR 1.10.9 beta release notes mention the following:

SteamVR Home:
Added option for map creators to bake lighting into textures.


I'm guessing this refers to lightmaps, since there also seems to be a new 'Lightmap Resolution Bias' option when selecting a mesh face. However, baking the lighting in a map still seems to use the vertex-based system that was already available. Does anyone know how to bake lightmaps in Hammer?
< >
Showing 1-12 of 12 comments
Rectus 13 5 Feb, 2020 @ 1:30pm 
Yeah, it's lightmaps. They're supposed to be baked when compiling the map, but it's currently broken. The tools will crash whne you open the build dialog, and even if it worked the baking utility itself is missing from the files.
Rectus 13 10 Feb, 2020 @ 12:03pm 
This got fixed in fridays update. It is possible to bake lightmaps now.

It's a bit tricky to use though, the tools don't show the actual lightmap scale anywhere, and I think some of the entities used to contol them are still missing. Also it won't bake them onto dev textures.
Blueberry_pie 1 11 Feb, 2020 @ 12:08pm 
Ah, thank you. I was so used to using the lighting preview that it never occurred to me to actually do a proper compile. Good tip about the dev textures, because I ran into that issue too.

From the looks of it, lightmap scales work a bit differently from Source 1. The compile options control the overall lightmap resolution for the entire map, and the per-face lightmap resolution bias acts as a multiplier for that resolution.

Some other observations:
- It doesn't seem to be possible to view the lightmaps in Hammer, but maybe I'm overlooking something.
- VRAD seems to run on the CPU only, no GPU acceleration. Better rev up those Threadrippers.
- VRAD expects a lightmap_resolution_volume that doesn't exist in the FGD yet. I wonder if it has a similar effect as the lightmap resolution bias, and/or if it's meant to restrict pieces of geometry to a single lightmap.
Last edited by Blueberry_pie; 11 Feb, 2020 @ 12:09pm
Rectus 13 11 Feb, 2020 @ 2:11pm 
Yeah, I think a lot of the debug visualization features are missing from the tools. Static props also have the resolution bias as a property.

Some of my notes:
VRAD compiles directional lightmaps, everything gets saved into two texture atlases. One with a normal color value and one with a normal vector in RGB and what looks like an AO map in the alpha channel. It looks a lot like how Unitys directional lightmaps are setup. I'm not sure if that alpha channel is for an actual AO or a directionality factor (it could be the normal vector length).

The directional lightmaps seem to be broken and don't take normal maps in account, and the input normal texture VRAD uses seems to be broken with artifacting.

There are new shader settings for controlling directional lightmaps, but they have very little effect without the normal maps working.

Apart from lightmap_resolution_volume, there is an auto vis group called Lightmap Space. It's populated in the HL:A Hammer screenshot. I'm guessing it's something that lets you set volumes for separate lightmap atlases.

Baking cubemaps from the ligthmapped environment is broken. The only way to get them working currently is to bake the vertex lighting and then compile the map wihout lightmaps. Then compile the map with lightmaps.
Last edited by Rectus; 11 Feb, 2020 @ 2:14pm
Joe Prime  [developer] 11 Feb, 2020 @ 3:15pm 
We're looking into these issues, but for the lightmap_resolution_volume warning, you just need to create a mesh enclosing the area that the player can get to, and set its material to materials/tools/toolslightmapres.vmat
That causes the area inside the mesh to have a high resolution, and causes the resolution to slowly decrease as you get further from the enclosed area.
Rectus 13 11 Feb, 2020 @ 3:48pm 
Originally posted by Joe Prime:
We're looking into these issues, but for the lightmap_resolution_volume warning, you just need to create a mesh enclosing the area that the player can get to, and set its material to materials/tools/toolslightmapres.vmat
That causes the area inside the mesh to have a high resolution, and causes the resolution to slowly decrease as you get further from the enclosed area.

Thanks. That actaully sounds like a neat way of quickly setting resolutions.

One more issue that I remember. Some of the shader features don't seem to work together with the lightmapping. Having the Morph Enabled material option set will make it not bake lightmaps on that material, and having a blend material on a prop (works properly with meshes) will make it only show the first texture layer in-game when lightmaps are baked.

The morph thing is maybe not an issue in itself, but it makes troubleshooting harder. The blend issue would break the pine trees on my island map though.
Blueberry_pie 1 12 Feb, 2020 @ 3:18am 
Thanks Joe. I'm eager to start mapping for HL:A so it's nice to be able to play with some of its tech this way.
Stevokenevo 8 Jan, 2021 @ 1:37pm 
I've made a map in HL:A which is quite large. I can compile it fine without generating lightmaps but when I include that the compiler always fails. Does anyone know what I'm doing wrong? I'm sure it something super simple and I'm just an idiot.
Rectus 13 8 Jan, 2021 @ 2:15pm 
Originally posted by c:\Stevokenevo:
I've made a map in HL:A which is quite large. I can compile it fine without generating lightmaps but when I include that the compiler always fails. Does anyone know what I'm doing wrong? I'm sure it something super simple and I'm just an idiot.

The lightmapper takes a ton of resources, so make sure you have at least 32 GB of RAM. Does it print any error messages in the compile log?
Stevokenevo 8 Jan, 2021 @ 2:24pm 
Could be the RAM, only on a pc with 16gb.

The compile error is this part:

Bake Lighting
Build: pc64 Jun 12 2020 17:43:59
Light Importance Tree... [0....1....2....3....4....5....6....7....8....9....] Done (7.71 seconds)
WARNING! No lightmap resolution volumes set for this geometry!
Whilst we still can process lightmaps for this map, texel resolution of the lightmap will be sub-optimal.
Please add a mesh enclosing the player navigable space with toolslightmapres.vmat applied to it.
Preprocessing 151 meshes and computing charts [0....1....2....3....4....5....6....7....8....9....] Done (1.66 seconds)
Packing 38815 UV charts onto atlas...
Pass 1 of 9 ->[0....1....2....3....4....5....6....7....8....9....] Done (0.38 seconds) - (0.081733)
Pass 2 of 9 ->[0....1....2....3....4....5....6....7....8....9....] Done (0.95 seconds) + (0.040866)
Pass 3 of 9 ->[0....1....2....3....4....5....6....7....8....9....] Done (0.45 seconds) - (0.061300)
Pass 4 of 9 ->[0....1....2....3....4....5....6....7....8....9....] Done (0.55 seconds) - (0.051083)
Pass 5 of 9 ->[0....1....2....3....4....5....6....7....8....9....] Done (1.05 seconds) + (0.045975)
Pass 6 of 9 ->[0....1....2....3....4....5....6....7....8....9....] Done (0.53 seconds) - (0.048529)
Pass 7 of 9 ->[0....1....2....3....4....5....6....7....8....9....] Done (0.94 seconds) - (0.047252)
Pass 8 of 9 ->[0....1....2....3....4....5....6....7....8....9....] Done (1.00 seconds) + (0.046613)
Pass 9 of 9 ->[0....1....2....3....4....5....6....7....8....9....] Done (1.03 seconds) + (0.046932)
Mesh with material materials/dev/reflectivity_30.vmat is extremely large in lightmap (0.1%), 980x1
World Bounds 836.107727,-4841.328125,576.282043 -> 4506.947754,238.769379,1563.085205
Mesh with material materials/dev/reflectivity_40.vmat is extremely large in lightmap (0.1%), 980x1
World Bounds -1440.500000,-426.031250,870.625000 -> -1165.000000,-293.406250,1062.125000
10119 / 212933 (04%) of triangles are outside lightmap importance volumes
LIGHTMAP QUERY SIMPLIFY: indices 606999->303444
LIGHTMAP QUERY MEM: verts 242071->211507, indices 638799->303444 (6mb -> 4mb)
Added lightmap query data to VPK: maps\beach_skybox\lightmaps\lightmap_query_data.kv3
Vertex Data Uncompressed: 3384112 bytes
Index Data Uncompressed: 1213776 bytes
==== Baking 1024 x 1024 lightmap ====
SetupTexels [0....1....2....3....4....5....6....7....8....9....] Done (0.05 seconds)
VRAD3 (local) [VRAD3 - Distributed Lighting Tool

Copyright (c) Valve Corporation, All rights reserved.

Build: pc64 May 27 2020 13:14:38

WD: E:\SteamLibrary\steamapps\common\Half-Life Alyx\game\hlvr_addons\hazard\_vrad3

Command: vrad3 -map maps/beach_skybox.vmap -script script.vrad3 -entrypoint lm_compute -blockfile=lm_block_00000000.dat -blocknum=0 -threads 4 -outdir results/outputs

Num Threads: 4

Loading scene_info.dat... Done (0.01 seconds)

Unserializing scene_info.dat... Done (0.05 seconds)

Loading lightmap_packing_geometry.dat... Done (0.01 seconds)

Lightmap: 1024x1024 in 16 256x256 blocks

Loading lightmap_info.dat block 0 (256x256)... Done (0.00 seconds)

Generate Samples (3x3 spl) - Rasterize Small Charts... Done (0.00 seconds)

Generate Samples (3x3 spl) - Rasterize Large Charts... Done (0.02 seconds)

Generate Samples (3x3 spl) - Re-project... Done (0.00 seconds)

Generate Samples (3x3 spl) - Reject Invalid... Done (0.71 seconds)

Generate Samples (3x3 spl) - Calculate Normals... Done (0.07 seconds)

Generate Samples (3x3 spl) - Map Samples to Texels... Done (0.06 seconds)

Generate Samples (3x3 spl) - Sort Sample to Texel Mapping... Done (0.15 seconds)

Generate Samples (3x3 spl) - Build Sample to Texel Lookup... Done (0.03 seconds)

Generate Samples (3x3 spl) - Calculate Confidence Values... Done (0.01 seconds)

Path Trace (128spp - 256spp - 5.00% errtol)... [0....1....



---------------------------------------------------------

Encountered accessviolation.

Wrote minidump to vrad3_2021_0108_222340_0_accessviolation.mdmp

---------------------------------------------------------




Unable to run Vrad3.
Light mapper didn't return valid triangles: failing.
+- hlvr_addons\hazard\maps\beach_skybox\world.vrman
--> Map build FAILED.
[FAIL]
0/ 1 (elapsed 27.845): e:\steamlibrary\steamapps\common\half-life alyx\content\hlvr_addons\hazard\maps\beach_skybox.vmap
Compile of 1 file(s) matching nonrecursive specification "e:/steamlibrary/steamapps/common/half-life alyx/content/hlvr_addons/hazard/maps/beach_skybox.vmap" took 27.845 seconds
-----------------------------------------------------------------
ERROR: 2 compiled, 1 failed, 0 skipped, 0m:28s
-----------------------------------------------------------------
Using breakpad crash handler Setting breakpad minidump AppID = 546560 Forcing breakpad minidump interfaces to load Looking up breakpad interfaces from steamclient Calling BreakpadMiniDumpSystemInit Looking up breakpad interfaces from steamclient Calling BreakpadMiniDumpSystemInit Steam_SetMinidumpSteamID: Caching Steam ID: 76561197975130070 [API loaded yes] Steam_SetMinidumpSteamID: Setting Steam ID: 76561197975130070 End build: 2021-01-08T22:23:42, elapsed time 0h:00m:30s.084ms
Rectus 13 8 Jan, 2021 @ 2:47pm 
It's crashing, so it's most likely a bug in the tool. It could also possibly be something like invalid geometry in the map causing it, although it's hard to know. You could try compiling only parts of the map to narrow down if there is something in there causing the issue.
Stevokenevo 8 Jan, 2021 @ 4:06pm 
Thanks for your help. I used the cordon tool and found out that a placeholder model I had imported was causing it. I was using 3 different tree models and for some reason, one of them makes the compiler fail.
< >
Showing 1-12 of 12 comments
Per page: 1530 50