Keep the reflection of a prop, but kill the prop?

Werewolf

Probably not a real Werewolf
aa
Apr 12, 2011
873
309
So I want to try a little effect in a map, but my efforts so far have not worked.

What I want to do is put the ghost prop next to a large reflective surface (in this case a window), and use a dedicated cubemap set to 256x256, to capture the image of the ghost prop. In game the prop would later be killed via an input so that when people enter the area they don't see the prop itself, only its reflection in the glass.

The problem I'm having is that I never see the reflection of the ghost prop. I use a prop_dynamic which I simply kill the first time the door to the area is opened. This ensures that the prop is there when I build cubemaps.

I have checked that the prop is not being accidentally killed before building cubemaps by noclipping into the room (to avoid triggering the kill command) then building them.

Nothing I try seems to work, anyone got any suggestions as to how I might achieve this effect?
 
Mar 23, 2013
1,013
347
That something quite unusual what you are trying to create.

When building cubemaps all dynamic objects are disabled.
If you want that prop on a cubemap, compile the map with a static prop. build cubemaps and save the cubemap texture somewhere. Then compile the map with the dynamic prop again and when yoiu build the cubemaps you have to replace the new cubemap texture (which dosn't show the prop) with the one you saved before.
I'm not sure how you can replace cubemap textures but I heard there is a way with GCFScrape
 
Last edited:

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,696
2,580
That something quite unusual what you are trying to create.

When building cubemaps all dynamic objects are disabled.
If you want that prop on a cubemap, compile the map with a static prop. build cubemaps and save the cubemap texture somewhere. Then compile the map with the dynamic prop again and when yoiu build the cubemaps you have to replace the new cubemap texture (which dosn't show the prop) with the one you saved before.
I'm not sure how you can replace cubemap textures but I heard there is a way with GCFScrape
I was going to suggest more or less the same thing, except instead of trying to hack the cubemap back in, just store it in /tf/materials/cubemaps/, and then make the glass a custom material with $envmap pointing to your custom cubemap. And when you recompile, just remove the prop entirely.

Either way the drawback is that you will have to go through this entire process every time you make any significant change to the room the prop is in.
 

Crash

func_nerd
aa
Mar 1, 2010
3,320
5,500
You might also be able to get away with making a fake area that looks the same, somewhere hidden in an inaccessible part of the map, including the prop you want to show up in the cubemap. Then place your cubemap there and tie it to what you want to reflect it in the main part of the map.
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,258
999
Yes you can replace a cubemap texture later on using VIDE or Pakrat. That's the cleanest method. You could probably get away with compiling the map with the prop_static using a Default or Fast compile, unless you were compiling the final map in HDR, in which case you could add the -both flag to VRAD for your fake compile. You could use visgroups to switch the fake and real prop entities in and out so you don't have to manually hide them each time you compile.

Alternatively make a copy of the room and put it somewhere in the map. Swap the prop_dynamic for a prop_static. Configure the fake room's cubemap to point to the reflective brush faces in the real room. Keep the fake room a fair distance away from the map so that no other reflective textures in the map pick up the fake room's cubemap due to proximity. Put an ordinary cubemap in the real room for player weapon reflections. This method will save you having to compile the map twice and having to copy in cubemaps manually, but will increase the map's filesize a little bit, probably insignificantly.

EDIT: Ninja'd by Crash.