A more "noob friendly" explenation about env_cubemap?

Discussion in 'Mapping Questions & Discussion' started by N0VA, Nov 3, 2016.

  1. N0VA

    N0VA L1: Registered

    Messages:
    23
    Positive Ratings:
    3
    When looking around in decompiled Valve maps, i noticed entitys called env_cubemaps.
    I have seen this quite some time but i dont really know what it does and what it mostly is for, i tried looking it up on the Valve dev wiki but it was not really clear,

    Could someone tell me in a "noob friendly" way what it is for etc?
    Much obliged
    ~Leon
     
  2. Crowbar

    aa Crowbar perfektoberfest

    Messages:
    1,440
    Positive Ratings:
    1,192
    Instead of real time reflections, source uses these entities that pre-render their whereabouts and any reflective surface gets its reflection image from the nearest env_cubemaps.
     
  3. N0VA

    N0VA L1: Registered

    Messages:
    23
    Positive Ratings:
    3
    So it works like this?

    Walls work like "Mirrors" and the env_cubemap kind off "Executes" those reflections? its still not 100% clear though
     
  4. Crowbar

    aa Crowbar perfektoberfest

    Messages:
    1,440
    Positive Ratings:
    1,192
    A cubemap renders its surroundings and saves the image. When a nearby reflective surface needs a reflection, it uses the texture a cubemap rendered before. The rendering kind of happens at compile. Actually, it's done after compile, but before release, so the images for every cubemap are saved in the BSP.
     
  5. killohurtz

    aa killohurtz Distinction in Applied Carving

    Messages:
    1,006
    Positive Ratings:
    1,160
    This image from the Wikipedia article for cube mapping illustrates the concept perfectly:

    [​IMG]

    The black dot (env_cubemap) basically takes 6 pictures of its surroundings and stitches them together into a fully 3D map. You might recognize this as the same concept skybox textures use to appear spherical; they are, in essence, one giant cubemap. Like Crowbar said, reflective surfaces will use the nearest cubemap entity to decide what its reflection looks like.
     
  6. Pocket

    aa Pocket func_croc

    Messages:
    4,489
    Positive Ratings:
    2,219
    That's a good way to think of it, yeah. Notice how that cube in the picture looks like it's a reflective surface, even though it actually just has mirror images of those first six pictures printed on it. Cubemaps also shift around when you move the camera to sell the illusion better, but it's the same basic principle.
     
  7. Loth

    Loth L2: Junior Member

    Messages:
    78
    Positive Ratings:
    183
    So in practise you should put multiple cubemaps in the map, in most rooms? or a couple is enough?
     
  8. Crowbar

    aa Crowbar perfektoberfest

    Messages:
    1,440
    Positive Ratings:
    1,192
    Wherever you need a unique cubemap in a place. aka pretty many of them, usually.
     
    • Thanks Thanks x 1
  9. Tumbolisu

    aa Tumbolisu  I ⌄ I 

    Messages:
    951
    Positive Ratings:
    937
    Cubemaps are as static as it can get. Just make a giant wall using the chrome texture, buildcubemaps, stand in front of it and move left/right. You won't be able to tell that you are actually moving because nothing in your view is.

    One cubemap per area is good. Keep in mind that the only things that require cubemaps are 1. reflective surfaces 2. view- and playermodels. People don't pay too much attention to their sniperrifles' scope, so don't be too agressive with these. Reflective surfaces should get about one cubemap per surface. Try to keep it simple for the sake of file size.
     
    • Thanks Thanks x 1
  10. Vel0city

    aa Vel0city func_fish

    Messages:
    1,931
    Positive Ratings:
    1,540
    Also, cubemaps store their pictures taken inside the BSP (your map's file that the game can read). If you go overboard on them your map can become quite the size.
     
  11. henke37

    aa henke37

    Messages:
    1,926
    Positive Ratings:
    454
    Of course, you can override the texture size for individual cubemaps. Probably don't need much resolution in areas isn't spending time. No one is going to notice if the sniper rifle reflection is a tad blurred while they are falling to their doom.
     
  12. Loth

    Loth L2: Junior Member

    Messages:
    78
    Positive Ratings:
    183
    I guess valve does it pretty well, i'll cheak out how many cubemaps stock maps have
     
  13. Pocket

    aa Pocket func_croc

    Messages:
    4,489
    Positive Ratings:
    2,219
    That was my point. They move with the camera instead of just being locked to the surface like they were painted on, something that picture didn't make clear.
     
  14. Tumbolisu

    aa Tumbolisu  I ⌄ I 

    Messages:
    951
    Positive Ratings:
    937
    Well that picture doesn't even show a cubemap in effect, it just shows a cube with a texture on it.
     
  15. N0VA

    N0VA L1: Registered

    Messages:
    23
    Positive Ratings:
    3
    I think i kinda know what they are now, i have noticed this while playing 2fort and observing my sniper rifle scope (when unzoomed)
    Since i have restarted ill do this at a later point, im now busy doing the general layouts and height scaling, i also wanna mess around with sound first.

    Thanks for all the help!