   Deferred rending + specular lighting
  Hello, I'm not quite sure how to compute specular lighting, this is the only way I can think of:- render a fullscreen quad at the end (once all lighting was already computed)- for every light:  compute specular for every pixel on the fullscreen quadThis for_every_light - for_every_pixel is what scares me. Is this done like this or are there any other ways? The only optimization I can think of is a simple compute_specular_or_not bool...   
  You can store specular power in the G-buffer. And if you don't need a separate specular color (i.e. not white) you can store the specular contribution in the alpha channel of the light buffer. If you need specular color, then you can have 2 light buffers and using MRT render to both of them during the lighting pass.   ;  http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdfread through that and rethink.   ;  Maybe you two misunderstood my question or I stated it wrong, the problem is not how/where to store the specular power, but how to effeciently compute specular reflections.For example, when I'm using a spot light, I render a cone with stenciling to mask out the pixels that don't get lit so that the lighting gets computed only on the visible pixels, that is why I can't /don't know how to compute specular at that pass, since the specular reflections would get computed only on those pixels that are visible to the light cone.   ;  Which is correct, no? Only the pixels inside the light volume receive incident light, and otherwise there wouldn't be anything to reflect AFAIK.   ;  nvm this post (can be deleted)[Edited by - n3Xus on April 28, 2009 4:48:17 AM];  Then where does the incoming light come from? From the light, right? Doesn't it have to be in the volume then? Maybe we have a different idea of the light volume. For me it's the area that potentially receives any energy from the light.   ;  harveypekar:My idea of light volume: a point (omni) light is surrounded by a sphere, which has the radius that equals the lights max range), the spot light has a cone for thisEDIT:see how the specular reflection is cut off because of the light volume? that is why I can't compute the specular when computing normal lighting;  n3Xus, you're right with the idea that specular would be usually visible outside the range of the attenuation radius of a lightsource, as specular is just a simulation of a perfect reflection, just like seeing the lightsources on earth from  an aircraft, you can see reflections in those distances, although they dont shade the aircraft in that distance.but to accomplish that, you'd really have to use the specular range to generate your light volume (not only for stenciling on screen, but also for culling them) which would end up with ALL lightsources ALWAYS might affecting ALL pixel. So, for games, it's usually ok to use the attenuation radius for culling/stenciling and accept that inaccuracy.To avoid visual issues, you can1. blend out specular, similar to the diffuse attenuation2. increase the lightvolume size linear with the brightness of the specular color that you set for your lightsource (not all lightsources really need specular)3. increase the specular power on your materials, smaller specular spots wont be noticed that much when they're blended in/out.4. and finally, yeah, you can pick one or two 'main' lightsources that cast specular and then it might be ok to have some fullscreen passes just for that case.;  Thanks Krypt0n, that's what I needed.   