Home General Discussion

Question from the p3d.in team

Hi again people! We're again in need of a little help deciding on something!

This time is about reflection maps:

What is you experience with them, How do you use them?
What type of reflection map do you use the most? (there are dozens of types)
How do yo usually mix the reflection map with other shader components (ie: diffuse)?


Basically any info you want to share would be helpful!

Thanks in advance

Daniel S

p3d.in (View in 3D)
9GLHs

Replies

  • Brendan
    Offline / Send Message
    Brendan polycounter lvl 8
    Generally you're either going to go with a cubemap or a spheremap. Usually a cubemap for realtime stuff. Tricks for importing cubemap images can help quality, such as making sure you 'clamp' the image (so it doesn't repeat) and either disabling mip-maps entirely or at least setting the mip maps to bordered mip maps (so they don't bleed out and show seams).


    As for mixing it, cubemaps can generally be set as an emissive texture. For metalic/conductive objects the usual tricks apply; you tint the reflection by the diffuse like you would the specular (so if the diffuse is red, then the reflection should be tinted red). For non-conductive objects, the opposite is true, and you tint it by the opposite colour of the diffuse.
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Almost no-one I know of uses Spheremaps anymore (since they look very wrong for what they give back, might as well go with a Specular term instead) and the very few cases that do use them are pretty rare since it's will be more of an specific artistic choice, and cubemap isn't always used for real-time stuff, you can use it once to capture the scene and use said baked maps instead, many games do this for when a character spawns at a certain location, but still require cheap baking instead of rt.

    Also, disabling Mips is a bad idea, since many people will rely on using the lods of the cube to fake the 'blurry' reflections you come to accept out of certain materials, if your cubemap has seams, it's due to lack of padding or engine issues which you need to manually fix, such as those of UDK for example.

    You don't set your cubemap as emissive since it will override all diffuse and specular information, the very few times you do set your cube as emissive are when you're displaying an outside scene, especially if you're using your traditional cubemap method which extends to infinity, and the material in question doesn't require any type of diffuse or specular information and you're trying to fake radiosity, but that will require an SSAO solution ontop of it.

    Most of the time, the reflection will be additive ontop of the diffuse alongside the specular (especially in anisotropic cases where highlights are different to the reflection in question), especially in cases such as box-reflection, where it doesn't extend to infinity.

    As for the tinting of color, you need to take care, since Gamma correction should be taken into consideration as that will affect the final outcome and what kind of material you're making (especially if the material is multi-layered, stuff like skin is white or pure reflection color since you both have conductive and non-conductive layers on your skin which negate themselves hence why adding solves alot of these issues for physically correct shadowing from the lambert term).

    In most cases however, reflections shouldn't be even tinted if the material is setup properly, alot of cars for example have fresnel doing all the magic, and what seems like lack of reflection being overpowered by the diffuse color is simply a simple reflection which is losing it's definition infront of you, but having a high glancing or directional glare back at you from an angle, or if you have the extra space and are using an RGB specular map, marry that with your reflection instead.
  • ZanQdo
    Yeah sounds like adding would be the correct default instead of mult. Also I was almost sure someone was gonna mention Fresnel.. I guess that's a must for a nice looking reflection. Good points! About gamma correction, we already take care of it so hopefully won't be much of a problem.

    How much variety do you think there is between different cubic map formats? At least being actively used by artists?

    Cheers!
  • Bigjohn
    Offline / Send Message
    Bigjohn polycounter lvl 11
    What does a Fresnel have to do with Cubemap reflections? I always see the two presented together, but I don't really get the connection.
  • ZanQdo
    Bigjohn wrote: »
    What does a Fresnel have to do with Cubemap reflections? I always see the two presented together, but I don't really get the connection.

    Fresnel is a function that describes how reflective is a surface based on it's incidence angle. It will be used in this case to multiply the reflection map before it is added to the shader
  • Bigjohn
    Offline / Send Message
    Bigjohn polycounter lvl 11
    But then wouldn't the result of that be that the fresnel is essentially a mask, and you'd see the reflection only on the outer edges of the object? (or the inside if you'd flip that mask)? Wouldn't you want the reflections all over the object?
  • respawnrt
    Offline / Send Message
    respawnrt polycounter lvl 8
    Yeah for something like aluminium, gold etc you'd want it all over and blured heh, but for something like a glossy plastic you'd want to use a fresnel ( just look at real life).You still get the phong or blinn specular where you would have them masked as it's like the brightest source if that makes sense ? :)
  • Bigjohn
    Offline / Send Message
    Bigjohn polycounter lvl 11
    I must be missing something here. When I look at anything reflective, it seems to me that the entire surface reflects the environment, which I believe is what the Cubemap would be simulating. So say something like this:
    iphone-3g-review-hardware-06-med.jpg

    Or if I look at cars and metals in general, it also does that. I can't find an example where you'd want the reflection to be masked by a fresnel.
  • ZanQdo
    :) when you go to the beach and look at the ocean from far away you see the sky reflection. When you're right above it you can see the sand across a now-transparent mass of water. Your iPhone example is not great because it doesn't show too much variation in the incidence angle.

    I would like to ask to keep this thread on-topic please. We really need feedback about this from people who actively use reflection maps in real time engines. In my line of work i use reflection maps a lot but offline renders are quite different (and more flexible). In my case I use equirectangular, spherical and mirrorball maps the most. I've never used a cube map in my life!

    Thanks all for the help, please keep it coming. As usual I'm looking into the most useful situation to solve first, while looking to expand into more possibilities in the future.

    Daniel
    p3d.in
  • ZacD
    Offline / Send Message
    ZacD ngon master
    Bigjohn wrote: »
    Or if I look at cars and metals in general, it also does that. I can't find an example where you'd want the reflection to be masked by a fresnel.

    There's a lot of things if you look at it at extreme angles its reflective, even things you wouldn't expect like roads and bricks, sadly this is the best example I can find right now

    NSeka.jpg
    http://www.carlespiles.com/artwork/431-2/
    Even if not strongly apparent in some cases, the Fresnel property aids to increase realism by the difference on reflection amount depending on the faces angles as it happens in the real life.

    Using the Fresnel gradient ramp (black=no reflection ; white=full reflection) we obtain a global medium gray like the used in the version at left (about 50% reflection amount) but casting more local contrast (right):

    Both images looks similar, but we can see that in the version at right the reflected gradients are more contrasted (it the same principle we´re looking for when using HDRI images) showing even subtle overexposed areas, but the most evident effect is on the bolt spiral which looks very well defined now.

    So, Fresnel add sometimes very subtle but important improvements.
Sign In or Register to comment.