What does Cubemap do?

It basically takes 6 pictures from the cubemaps position and then melds those 6 pictures in a sphere, it's used for reflections of geometry.
 
Ive wondered too. So these cubemaps arent vital then? They just improve something... or other?
 
Well some textures require cubemaps to work, such as the water texture, but others can do well without it.
 
MetalPiranha said:
Ive wondered too. So these cubemaps arent vital then? They just improve something... or other?
if you have anything reflective you'll need them for it to show up correctly.
 
so are they used in hl2 whenever the floor or walls are slightly reflective? if so, are there only certain wall/floor textures i could use with cubemaps?
 
kaf11 said:
so are they used in hl2 whenever the floor or walls are slightly reflective? if so, are there only certain wall/floor textures i could use with cubemaps?
anything thats reflected in the game is an environment map, a cube map, as Ben said, its a cube of six images that are taken with a certain aspect ratio from a single point at set 90 degree angles so when placed inside an imaginary cube, it creates what appears to be a sphere of the surrounding area. The reflection maps are reflecting this not the actual worldspace itself, so its not real reflections but nobody is really gonna notice and it still looks good and its much easier than using full reflections which the water shader uses, atleast in DX9, it uses cubemaps for reflection in DX8 AFAIK.

So if you use something that has a reflective property, and there's no cubemaps, it'll automatically use the skybox, which in itself is a cubemap. But your reflections wont look very good, they'll be very bright in area's that should be dark, as the reflections will be ignoring your map and just seeing the sky. You use cubemaps in area's of contrast so the reflective surfaces look for the nearest cubemap entity and takes its reflection information from that. Same also applies to realtime objects that might be reflective eg: the scope on the crossbow, the realtime object takes the environment map from the nearest cubemap for its reflection, including the player. So good placement of cubemaps will give pretty much real looking reflections, for the most part.

So yeah, your best off using them really. You can change the resolution used on a per cubemap basis though, so for area's that aren't very reflective, or you want to give the impression of blurred reflections, use a lower res cubemap.. for area's that you want to look really shiny or are very reflective, use higher res cubemaps.
 
dark elf, thank you for going into such a detailed answer. so what exactly would be good placement? one in the center of every room? what if i have a long street, do i need several? i read the manual several times but im still not too sure where to place them. should it only be in areas of high contrast?
 
In theory you would place them in areas of high contrast but in practice you can put many cubemaps and it will be more accurate without sucking much power. What does reduce the fps is if you have alot of reflective surfaces, the cubemaps by themselves take memory but not much ressources so if you have a long street you'd better place many cubemaps along the street (it's best to place them at eyes level too). So basicaly you would place an env_cubemap in every room and every hallway etc... If you look at them in hammer it would look like npc path nodes (when you stand on a cubemap you should see the next cubemap, and probably more than one).
 
Basicly, try to place theme more orr less equidistant from walls and eachother in hallways and open spaces, but some key points are

Center of smallish rooms
on top of water pools
along a shoreline


Basicly the best thing to do is playtest, if you have an object that has realy bright reflections in a dark room ore vice versa you need another cubemap there.
 
ok, cool. thanks for the help. how do i know which textures are reflective?
 
Umm... i'm not 100% sure on this but, you see those little tabs underneath the textures? i think reflective textures have on with an S.

Either way, lotsa enimies and weapons are reflective, so dont skimp just casue you have all dull textures in a place.
 
If you really want to know wich textures are reflectives you'd have to use GCFScape to extract the vmt of the materials folder and look in them to find the line "$envmap" "env_cubemap". If you don't want to go into all this you can type in +showbudget in the console and you'll see what is killing your framerate (-showbudget to remove).
 
Back
Top