It's a bit long and it doesn't really fit well into forum format, so you'll have to travel off site.
http://mr-chompers.blogspot.com/2009/06/light.html
* Unfocused light falls off inverse squarely. Double the distance, 1/4 the brightness. Half the distance, 4x the brightness.
* Surface roughness determines how clearly the light source is reflected. Smooth surfaces give you the exact shape, rough surfaces give you a scattered shape.
* Apparent size is what's important, not absolute size. A medium source 1 meter away is apparently larger than a giant source 50 meters away.
* Apparent size of the light affects the softness of the shadow edge and penumbra. Larger apparent sizes make softer shadows and smoother penumbras, smaller sizes make sharper shadows and harsher penumbras.
* Specular reflections do not fall off. They stay the same intensity regardless of distance. Lessening the reflectance of the surface, or making the apparent size of the light larger, is necessary to lessen the specular hotspot's intensity.
Replies
you're a witch!
but thanks for posting
Didnt somebody else post this exact thread with their own article like a few weeks ago though?
I can't imagine trying to make a good portrait with just bare light bulbs, and I don't know why non-point lights aren't being pushed more on the graphics side.
Shader writers, give me a softbox shader!
Let me root around the internet for a bit. There was something I read a few years ago that talked about this.
Thank you a thousand times over!
A followup article specifically relating this more photography geared post to how it relates to videogames is an awesome idea, and I shall endeavor to create one in the near future. Good idea.
And you can most certainly have specular dots, and often do, anytime the lightsource is a small point light. (bare light bulb hanging from the ceiling, the SUN, etc. All that's necessary is a relatively small apparent lightsource that is roundish, and all your specular highlights on smooth, round surfaces will be dots.
I made this not so long ago, and it's just a crude hack. Still it work better than simple point lights and exhibit the 'apparent size' parameter you're talking about (glad to see you here btw poop )
Simple: computation power
area lights in offline rendering are often heuristic, trial and error processes. "cast X number of rays along the normal, how many hit the area light?" or the other way around, or whatever technique you use
and poop don't be that agressive, the 'everything is a cube map' idea makes a lot of sense. We actually talked about it for the rendering of wis avatars' pics remember? Cube map can easily be seen as the rasterization of every procedural lights around for a given point in space. (mip chains in cubemaps are a very efficient hack to simulate roughness too)
specular highlights are just reflections of the lightsource, duh!
cool article, will have to look through it for some mind candy
the rougher the surface, the more rim light.
well i guess it had something to do with the light not bouncing directly off a surface, but instead was carried by it for a little bit before bouncing.
Yeah even this shader from Brice is an excellent mini-step forward. Brice
A cube map is only accurate from a single position in space. A literally infinitesimal point. It doesn't take into account moving closer and further from lights, or their apparent size changing based on that distance. It also doesn't affect the shadows in the ways that make me desire "real" softbox light sources.
That's why I said they're a nice hack. I know we have to walk before we can run, and cube maps are nice, but they don't even come close to the look of what I'm after. I'm guessing the next baby step will be multiple cube maps per room with blending in order to emulate falloff. Still doesn't get me the shadows that I want though.
Real life is nothing like a cube map. It's the other way around. A cube map attempts (and fails) at emulating real life.
i agree with this
You've never seen an engine that does straight up realtime reflection? It's possible although hideously expensive. You can do it in ut3 in a limited way.
The problem with regular specular approximation is that it only uses light from the lightsource. It doesn't use light from any other source (such as reflections from nearby surfaces). So a grey ball sitting on a red surface won't get any red light illuminating it like it would in real life.
There was a film FX studio where their motto was "never say phong"...
That would be a good topic to cover when I do a game specific adaptation of this.
You'll notice though, that the article doesn't talk about specularity of an object as a separate function as reflection, because there isn't a separation in real life. I'm aware that games break them apart to more easily render the real life principle.
I don't know if you're getting his point either, which is why I asked him to clarify. I was imagining he mentioned cubemaps where the objects are lit using a cube map (not reflecting based on a cubemap).
I guess this time I wasn't clear. I was speaking about games that use cubemaps to *light* an object, not provide something for them to reflect.
Unless you're in a dark hole (which is probably what you mean?) and a small pinprick of sun light is all the light you have, you're going to reflect a lot more than just the sun. The moon might give you a greater chance to catch just it as a specular highlight?
Realtime raytracing will save us all!
Every demo I've seen is impressively slow, deliberate and not much is going on. Which makes me think the only game we'll get in the near future is chrome sphere chess... Or you can have any color of spec map as long as it's black.
True story, Henry Ford said that when they where painting the firsts real world cube maps on the first Model A. Until then no one had reflections in the real world. When you look in the mirror, that's right, you have Henry Ford to thank!
Everyone keeps working on accurate reflections and spiffy water shaders but studio after studio don't ever bother upgrading their animation systems in meaningful ways. Maybe if they get realtime reflections working they'll finally see how stiff and wooden their preformces are.../end rant
My understanding was that Malcolm was implying that no objects ever have small white specular highlights, or dots as he called it. The diffused lighting an object is receiving does not have to be black for the specular highlight to be showing on top, so you don't need something in a dark room, it can be out in broad daylight. You'll get lots of things reflecting on the object, you'll have diffused lighting illuminating the side facing the sun, and if it's a shiny, smooth surface, you'll also have a small white specular hotspot that is essentially a very nice reflection of the sun. It's just several magnitudes brighter than all the other objects reflecting off the object, so it's very readily apparent. (as a small white dot)
However this could all be fluff around an argument he isn't even making.
Ahh ego's, they pass like two ships in the night (without radar) =P
"difference between specular and reflectivity"
"specular dots don't exist in real life everything is a cube map"
Still speculation on my part. Can you clarify, Malcolm?
Hah, I definitely agree with you there. I think the main reason for that is that you can't really show off sexy slick animation in promotional screenshots, and even though game marketing is more about video these days a bit of that still image fetish keeps lingering around from the days before live streaming video.
The worst part of it is that animation weaknesses have a direct impact on gameplay. So many studios don't seem to understand that. Epic isn't really one of the most problematic offenders, but the first example that I could think of for this is how sniping in Gears of War can be rather frustrating because of the way the Locust will often pop around unnaturally while moving around the pieces of cover.
Don't get me started on render times for glossy reflections that don't flicker
On the other hand, specular + lots of lights gave us surprisingly results recently, at least from the way everyone was wondering about the "cloth shaders"
He has a section called "The Truth About Specular Highlights" partway down the page here -
http://www.neilblevins.com/cg_education/metal_and_refs/metal_and_refs.htm
that covers a fair bit of what the blog went over in general and Max specific terms. Granted it's focused on offline rendering and a bit dated, but it's the theory that's important, no?
If only I knew a Belgian shader artist.....
Here's an example, sorry for the old render. The gun doesn't have any specular coming from a light source I turned them all off since they were fakes and instead used the specularity from the hdr environment map the metal on the gun is reflecting. The hdr map is a shot of beach with sun and sky giving the iconic specular dot look which I thought looked pretty cool.
http://www.malcolm341.com/spas12big.htm
I've only ever seen the mip chain trick used to work on a per-material basis. Would it be possible to control it on a per-pixel level using a gloss map?
I want soft light sources that do falloff and do cast dynamic shadows.
Hi, sorry I'm late but everything as been petty much said/trolled in this thread
except for this.
at the time i would only have proudly point to my own maya shader, but nowadays a lot of realtime shaders does it, it became a pretty common tech ( Xoliul's for max )
Also, I recall this from the Valve lighting paper a few years ago. No self-shadowing, and the model isn't the greatest, but it is fully dynamic and it's neat to see the breakdowns. Some videos of it in action here.
Great thread.
Don't we all I think someone mentioned it earlier but there's really just not a fast way to approximate this. The nice thing about the methods we've used so far is it's a super slim equation to approximate diffuse lighting from a point lightsource = the dot product of the Normal and the Light vector, once you start trying to approximate light sources that are not a point it gets really hairy from a diffuse lighting standpoint, you have to think about what is required. The surface point needs to know how much of the light source can it see from where it's sitting, The easiest but poorest performance is going to be casting a ray, basically for every point you shoot a bunch of rays and find out if you can see a light source, the more rays that hit a light source the brighter you are, and this will end up creating lighting from different shaped lights.
Maybe we could project some 3d texture that represents the shape and falloff of a light and then do some blurred shadow to fake non-point diffuse lighting....although you really would only benefit from this on big flat surfaces, I think it's still close enough to represent a character or some other object with varying normals using N.L.
The specular solution is easy, just store some sort of cubemap or image that you project on the mesh aligned with a "specular highlight" and you get a non-circle highlight.
Something like this? http://developer.download.nvidia.com/shaderlibrary/webpages/hlsl_shaders.html#shadow_PCSS
My guess here: Programmers are lazy bastards, they don't get anything about aesthetic so they rely on their field of expertise: everything new/that they don't know about or that requires work is always too expensive
That being said, I don't know what's the inherent cost of a regular cubemap fetch, but it has to be uber cheap considering how old the trick is. I'm going to consider here the difference between regular texCUBE() and texCUBElod() since they both have to somehow convert 3d vector to 'cubemap space'. The second is actually 'twice as expensive' because it makes two samples of mips to smoothly lerp between them without stepping (that's why it's probably more efficient to have a preblurred cubemap when you do ambient cube as in your valve paper).
In practice when I was working at CCP I used 'glossy cubemaps' all over the place for WiS interiors (yes, every single pixel on the screen) without it being a bottleneck. I've been doing experiments of raymarching trough cubemaps (50, 100 texture fetch?) and it still runs on my good old 6800 Go laptop gpu.
So without being completely 100% sure, I'd say it's bullshit
go go blurry cubemaps, we'll get rid of varnished realtime rendering...
Something exactly like that, but I want to see it on a face. Not only do I want to see a nose shadow behaving like that metal strip, where it's sharper at the base and fuzzier at the tip, but I also want to see that shadowing effect the pores and texture in the normal map as the surface wraps away from the light.
Heh, right. And how many gamers are going to look at a surface in Rage and go "woah, streaming megatextures!"?
Of course the scenario makes sense to me and my cynical nature if I swap "people" with "investors". You can give Impressive Technical Numbers for megatextures, but a square highlight is just a square highlight. What's likely to impress the money guys more?