Home Technical Talk

what exactly is an environmental map?

fritz
polycounter lvl 18
Offline / Send Message
fritz polycounter lvl 18
is that basically a reflection map? if so, does anyone know a quick tutorial or description?

thanks!!!

Replies

  • frostymoose
    Options
    Offline / Send Message
    frostymoose polycounter lvl 17
    If I understand what you're saying, yes it tells an engine what reflective parts of a model are reflecting.
  • Squid
    Options
    Offline / Send Message
    Squid polycounter lvl 18
    Typically, an envioronment map is a set of 6 textures derived from the axis of your scene (+x, -x, +y, -y etc). engines or shaders use it as a lookup for reflection/refraction.

    smile.gif
  • EmAr
    Options
    Offline / Send Message
    EmAr polycounter lvl 18
    This may be what you want also:
    http://www.planetquake.com/polycount/resources/glossary2/index.shtml#E
    **We have a pretty cool glossary in fact smile.gif
  • Toomas
    Options
    Offline / Send Message
    Toomas polycounter lvl 18
    Enviormental map is just a texture that gets projected on a model to fake reflections.

    The set of 6 textures Squid mentioned is usually called cube map.
  • fritz
    Options
    Offline / Send Message
    fritz polycounter lvl 18
    cool. thanks guys!!!!!
  • Eric Chadwick
    Options
    Offline / Send Message
    I wouldn't say dead wrong, just incomplete.

    "imagine the envmap containing a sphere"? That would confuse me.

    I'd say instead that one should imagine the envmap being mapped onto the inside of a sphere. When you have a model that has an envmap reflection, each pixel of the surface has that imaginary envmap sphere centered on itself. The pixel's normal points outwards towards this sphere, and whatever color(s) it hits on that sphere is what the pixel gets mapped with.

    Hmm, maybe that's more confusing.
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    I think everyone's being too technical except Toomas. It's a fake reflection. smile.gif
  • Squid
    Options
    Offline / Send Message
    Squid polycounter lvl 18
    [ QUOTE ]
    with like 12 replies that were dead wrong

    [/ QUOTE ]

    I have to admit being wrong on occasion i didn't think this was one of the many times.

    cube mapping is still envioronment mapping regardless smile.gif
  • Sage
    Options
    Offline / Send Message
    Sage polycounter lvl 19
    Squid cube mapping can be used as a reflection map but not all environment maps have to be done that way. Like others said in the thread an enviornment map is just an image that is used to create reflections. Per128 and Eric explained how the software wraps this image around the scene to create the illusion of real reflections. As far as making them it depends on the software to some degree.

    You make a grayscale image and map that to the reflection slot of your shader/material whatever the software you are using calls it. Black is usually reflective and white is not, and the shades in between are less or more reflective depending on their value. Some software developers like to be original and make this backwards, so you will find times when you'll have unexpected results because they can't stick to a standard. The image that will be used to reflect onto the object you may find yourself having to take some steps so it looks nice. So what Per and Eric said is important to know so when you start seeing seams and weird pinching you can deal with it. Make your enviornment either spherical map or cube map.

    To make a spherical map by hand you need to make your image seamless. I forget how much wider this map is recommended to be than it's height so you should google that. To remove the pinching caused by mapping your image to a sphere use Photoshop's filter called polar coordinates. First apply the rectangular to polar option so you can see the pinching that is cause when you map an image to a sphere. Then you paint out those seams or do any fixing needed. To restore the map you use the filter again but select polar to rectangular. To see if this map looks good in your 3d app just make a sphere add a spherical projection to it and apply the texture.

    I'm sure there are better ways to do this now, but that's how I used to do in 1998. wink.gif

    I have never made a cube reflection map but like Squid said it just a set of images that blend seamlessly together on a cube. To test it map your images to a cube and then look for seams.

    I hope that's enough information to give you an idea. Oh the term enviornment map is also used losely and different software can make it annoying so you should check the manual before assuming you made your map wrong. Max for example under Render lets you set a map for the enviornment, but if you try set your enviornment map that way all you do is set a background image for rendering. Hope that helps.

    Alex
  • Squid
    Options
    Offline / Send Message
    Squid polycounter lvl 18
    I never really meant to imply that cube mapping was the absoloute way to envioronment map (linear interpolating spherical harmonic 'maps' being my current favourite method).

    It's all good info though smile.gif
  • Eric Chadwick
    Options
    Offline / Send Message
    Sage, fyi an environment map is also the term for the image(s) that go in the backdrop, sometimes called a skybox, so that's why Max uses the name there.

    Here's a cool tool I've been using lately for blurring down my envmaps, to get the effect of burnished metal reflections, and also for cubemap diffusive lighting. Works great, well worth a spin...
    http://ati.com/developer/cubemapgen/index.html
  • Sage
    Options
    Offline / Send Message
    Sage polycounter lvl 19
    Eric I was not making a stink about Max, in fact I found it pretty straight foward when I first used Max to render out enviornment maps and backdrops. wink.gif The reason I made that statement is because different software handles reflection and enviornments map differently. I just used Max as an example. In fact Max clearly states under Render where there is the black color swatch for background and next to that there is the slot for Enviornment. The software I had the pleasure of learning 3d in called Infini-D was a piece of crap. Instead of handling alphas and reflection the same way it would reverse the way it read white and black. So it was pretty annoying, at least they had an invert button so it wasn't such a big deal. I forget what else it did but my friends and I just got used to hit the invert button since if it didnt' work one way it did it the other way. smile.gif What was great too is Metacreations they bought Infini-D, had Raydream which would do things in the opposite way Infini-D did. Ah the fun times...

    Squid I wasn't trying to bash you in anyway. In fact I should have read your post more carefully... You did say typically enviornment are made... so that just states one method of a good way in fact of making them. I did not try to imply you were wrong or that you said that was the only way of making them. wink.gif In fact the only rant I was making was the fact that there isn't a standard way that developers use to read reflection map values by the software. Because of that it can be confusing if you are not aware of the fact when you switch from one app to another.

    Alex
  • Eric Chadwick
    Options
    Offline / Send Message
    OK. I wasn't defending Max, just passing along some info.

    Yeah switching apps is fun. smile.gif

    I'd like to hear more about lerped spherical harmonic maps, if you wouldn't mind sharing. What are they? What advantages do you get over using a cube or a sphere or a planar map? Why lerp?
  • Squid
    Options
    Offline / Send Message
    Squid polycounter lvl 18
    As you most likely know, spherical harmonics is a way of describing the diffuse lighting of an envioronment (as seen from a point in space, as always) by wrapping it around a sphere and deriving a cooefficiant matrix (per colour component) from the variation in lighting (as a frequency, not colour) around that sphere.
    since we are dealing with the ambient+diffuse components, we don't need to sample the full spectrum, the lower frequencies will be more than enough (diffuse = smooth gradation of colour).

    once we have our matrix(s) it's a simple matter of transforming the normal (of our model) into lighting space and multipying by the SH matrix and you have a rather nice and reasonably accurate lighting for your scene/model. the big downside being that it's a static lighting method so you need to derive a new set of cooefficients if your character/model moves. fortuantely, with SH, linear interpolation works and works well so you only need to 'sample' a few areas and pass them into the shader as you would any other type of stream mapping.

    In experimenting with SH i found a few cool side effects. my typical experimentation goes something like this :
    With everything else that's being thrown at the gpu in a typical game, computing the cooefficient matrix realtime isn't a realistic option so the idea of using 'maps' (in a 2d texture sense) is an obvious one. texture lookups are one thing gfx cards do well (for all intents and purposes, it's a free operation) so that was the first port of call. If i have a 512*512 texture then i effectively have 262144 slots to store my values in and, access to all the neato texture stuff that exists (bilinear filtering on fucntions stored as textures rocks).


    Ok, i missed the boat a tad as i'd still need to compute the bloody things before i could store them but, hopefully, you see the point.

    of course, now i have my matrices i can do other things with them. treat them as a per component convoloution filter applied to a render target or a screen aligned quad,coerce them into being self shadowing/reflection models etc. as with most realtime shader shannanigans, the field is wide open to ideas and experiments...ironically, you do tend to end up with a lot of black-white gradients that would take 2 seconds to produce in photoshoop wink.gif

    Advantages v disadvantages - i don't honestly know. obviously, SH looks nicer as a lighting model without being too expensive. obviously, we are talking about using spherical harmonics for other purposes though so...err, i don't really know smile.gif

    Work and getting my site up and running take precendent atm but, over xmas, i hope to make some concrete examples of these types of shaders/scripts available (they are all in xsi atm but it should be simple enough to code up some max versions)

    apologies if any of this sounded condescending.

    smile.gif

    /edit - Sage - i didn't think you were bashing me but thnx for the clarification though
  • Sage
    Options
    Offline / Send Message
    Sage polycounter lvl 19
    Squid that technique you described sounds really cool, I'm looking foward to seeing more of it.

    Alex
  • Squid
    Options
    Offline / Send Message
    Squid polycounter lvl 18
    As soon as i get the current modelling dvd out of the way i'll release the realtime shader series of tutorial vids i have for free. they don't really get as far as spherical harmonics (the last tutorial deals with steep angle parallax so the series covers quite a lot) but there's nothing stopping me making a few extra advanced topic tuts in the not too distant future.
Sign In or Register to comment.