Reflecting a cubemap vs reflecting a 2d image vs specular hightlights,

Would I be correct in stating reflecting a 2d texture map is cheaper than reflecting a cubemap or regular specuar? Specular is less predictable, because it’s relies on the lights in the scene, whereas a 2d image reflection is just a consistent faked reflection.

From what I remember, the Source engine does or used to do something like this. I realize at times you’d want both reflections and specular highlights, but if you were just going the cheaper route, I’d imagine a 2d reflection to be the cheapest, no?

I’ve just been working with some shaders, still learning and practicing, and trying to categorize different effects.

Thanks for your valuable input. :nod:

[QUOTE=TheIncredibleMrEgg;3977]Would I be correct in stating reflecting a 2d texture map is cheaper than reflecting a cubemap or regular specuar? Specular is less predictable, because it’s relies on the lights in the scene, whereas a 2d image reflection is just a consistent faked reflection.

From what I remember, the Source engine does or used to do something like this. I realize at times you’d want both reflections and specular highlights, but if you were just going the cheaper route, I’d imagine a 2d reflection to be the cheapest, no?

I’ve just been working with some shaders, still learning and practicing, and trying to categorize different effects.

Thanks for your valuable input. :nod:[/QUOTE]

Specular is highly predictable, Maybe not very useful when you dont have very many lights though. Specular is just the reflection of the light source.

You can get more mileage from reflection maps because you are encoding more light and light sources into a single function.

Performance can be better although with a 2d reflection you may need to add more code to your shader to control the reflections - 2d doesnt represent 3d enviroments that well (only one hemisphere), if you want different specular powers you would have to bias mips of the reflection to make it more blurry.

Cubemaps can be better for some situations and you could generate them at points in your level - I think source engine does this? Then the result reflections could be representive of the enviroment around you. If you want to go more realistic, then cubemaps are good.

Specular is not cheap itself , so if you do reflections - its good to turn it off (although artists will always insist on everything on!)

Another thing you might want to look at is adding HDR to reflections - this allows your light sources to look much brighter in the relfection than the rest of the world , works very well!

edit (was in a rush before):

I was going to say we normally use cubemaps but sometimes spherical reflections, the latter we use when we want to simulate a large amount of lights in and we dont care about it being physically correct, its amazing what you can get away with!

All modern 3D hardware supports cubemapping, except for the Wii which does dual paraboloid mapping. I suspect you’re not developing for the Wii, so that isn’t an issue.

Just stick with cube maps. If you use spheremaps, you’ll have to roll your own UV lookups and deal with the artifacts that appear when using spheremaps.

My recollection is the that Source engine used low-res cubemaps to do ambient lighting for Half-Life 2.

You can use reflection maps for some lighting effects, but there are limitations. The object’s perceived position within the cubic environment never changes. It’s always rendered as if it’s in the center of the cube. It’s view dependent, but not position dependent.

Regarding Source, I am almost positive they use a technique called Radiosity Normal Mapping for their environment lighting, as they have written several papers on the subject. I believe the technique uses three UV’d maps, and not a cubemap. It leads to a somewhat flat looking environments, but provides beautiful soft transitions that play well with normal maps. To compliment this, I am fairly sure that they use a reflective cube map to do their specular. For characters, I know they use some amount of realtime lighting, but I am unsure of their accumulstion techniques for games like Counterstrike. TF2, however, has a great video describing their character shaders, where they do in fact describe using ambient cube maps.

A bit of caution about techniques like these though, is that they are a bit memory intensive for the trade of being incredibly scaleable. In these techniques, you can down res textures, or disable code paths quite easy to get back critical resources. You may, however, find that the bake time hurts iteration, or that your memory is short, and you have too many surfaces to cover to down res your maps. If you’re not gunning for a 60hz game, both the 360 and the PS3 will burn through a simple specular for a reasonable number of lights. If you are going for 60, however, you will have to pull all sorts of fun tricks.

Sorry, that was an extreme tangent, but it was really fun for me to type.

I found this page instructive

The Art of Texturing Using The OpenGL Shading Language
4 - Environment Mapping
http://www.ozone3d.net/tutorials/glsl_texturing_p04.php