Custom envmaps - nothing is cooperating

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
In Portal 2, some of the tile textures use a pre-built envmap texture with soft transitions between generic colors. This, combined with various tint and saturation settings in the material files, allows surfaces to look glossy without actually being reflective. I actually mistook it for phong shading at first.

Which, now that I've decided to resume work on my Fort Frolic map, is the look I am aiming to recreate for my tiled floor. As I understood it, the only reason I can't just straight-up swipe the file is that Portal 2 uses VTF 7.5 and the Orange Box engine can only recognize up to 7.4, so I need to convert it. So I exported all the faces from VTFEdit and re-imported them into a new 7.4 texture set to "Environment Map", with all of the same specs and checkboxes set as far as I could tell. Then I copypasted every line from the original material file that applied to environment maps, figuring I might as well start with a perfect duplicate and tweak variables from there if necessary.

But neither Hammer nor the game is able to load the envmap texture I created. The game specifically told me so in the console. Instead, I just get the standard fuchsia-and-black checkerboard. Furthermore, it's not applying the tint and saturation settings I copied into the material file to said checkerboard. I'm not sure if that's related or not. It was able to find the envmap mask and apply it correctly, which frankly just raises further questions.

And I know it's not a format issue, because when I tried just dumping the original file into my folder and reloading materials, it gave me additional errors about invalid version numbers.
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
"LightmappedGeneric"
{
"$baseTexture" "bioshock/fort_frolic_floor_tile"
"$basetexturetransform" "center 1 1 scale 1 1 rotate 45 translate 0 0"
$bumpmap "bioshock/rec_floor_normal"
$reflectivity "[ 0.6 0.6 0.6 ]"
$envmap "bioshock/black_wall_envmap_002a"
$envmaplightscale 0.6
$envmaptint 0.3 0.3 0.3
$normalmapalphaenvmapmask 1
$envmapcontrast 1.0
$envmapsaturation 0.2
"%keywords" "tf"
}
 

duppy

L1: Registered
Feb 16, 2012
35
8
I once converted the generic environment map Portal 2 uses. I really don't remember what exactly I had to do to convert it to TF2, but here's a download link for it:

http://www.mediafire.com/download/i0vt0liuwbunirl/envmap-portal.vtf

Here's a pic of it used in a simple TF2 test map:

i20Emoe.jpg

...and I think this is the VMT file that's used in that picture:

Code:
LightMappedGeneric
{
	$basetexture "duppy/black_floor_metal_001a"
	$bumpmap "duppy/black_floor_metal_001a_normal"
	$ssbump "1"

	"$envmap" "duppy/envmap-portal"

	$envmapcontrast 0.5
	$envmapsaturation 0.2
	$envmaptint "[0.2 0.2 0.2]"

	$normalmapalphaenvmapmask 1


	$detail "duppy/detail_blackfloor"
	$detailscale 4
	$detailblendfactor .6
	$detailblendmode 0

	$surfaceprop "brick"

	"%keywords" "portal2 noportal chamber"
}

BONUS: Here's seven more generic environment maps I made as well. I think a few of them aren't aligned correctly though, and they're only 128px in resolution. http://www.mediafire.com/download/4qk3oqdoou14tok/duppy-vtf-environment-maps.rar
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
Well, geez. I was all ready to thank you, but for whatever reason the bloody thing is still not working. I wonder if it's actually something to do with the engine; do you happen to have the map that screenshot is of and the other texture files involved? I'd like to take it and change things one by one until something breaks, assuming it works to begin with.
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
In lieu of converting them, I have done things like this by making a room that looks like what I want reflected, putting a cubemap in it, running the map in fullbright, and building the cubemaps. Then I extract the generated cubemap out of the BSP (use GCFscape) and rename it however I need and use it in my VMT.
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
At this point I'm thinking it might not by the VTF that's the problem. Plus, I don't really know what I want the reflections to look like, other than "the ones in Portal 2 look pretty good."
 

duppy

L1: Registered
Feb 16, 2012
35
8
do you happen to have the map that screenshot is of and the other texture files involved? I'd like to take it and change things one by one until something breaks, assuming it works to begin with.

Here's the map and materials...

http://www.mediafire.com/download/ebfyqm6193sbhbs/duppy-test-room.rar

Hopefully I have everything included to compile it and get it working (includes some extras that aren't needed but are part of that map). Based on your veteran status on this forum, I'll assume you know how to install custom materials ;) Let me know if I missed something.

BTW, it *is* a test map, so just ignore any strange stuff you see :blushing:
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
Well, I was able to get it working. Here's the final VMF I'm using:

Code:
LightMappedGeneric
{
	$basetexture "bioshock/fort_frolic_floor_tile"
	$basetexturetransform "center 1 1 scale 1 1 rotate 45 translate 0 0"
	$bumpmap "bioshock/rec_floor_normal"

	$envmap "bioshock/envmap-portal"

	$envmapcontrast 1.0
	$envmapsaturation 0.2
	$envmaptint "[0.25 0.225 0.15]"

	$normalmapalphaenvmapmask 1

	$surfaceprop "concrete"
	"%keywords" "tf"
}

As you can see, nothing of significance has really changed except for $reflectivity (which was irrelevant) and $envmaplightscale (which is completely undocumented but didn't break anything when I briefly tried adding it back in; I suspect it's some sort of Source 2010 thing). Maybe I mistyped something before? *shrug*

Now on to the next crisis.