Parentheses in HLSL cause light attenuation function to not work correctly?

Started by
13 comments, last by Bacterius 11 years, 7 months ago
Hi again!

First of all, thank you very, very much for the model! biggrin.png

Sorry, if we have lost you on the way with all the units (not all of them were explained). Photometrically correct lighting is sometimes a little overwhelming, when you’re not working with it every day.

I glanced a little longer at your code and noticed that you should probably normalize the normal in your pixel shader. Even if the normals are normalized in the vertex shader, the interpolated normal may not be normalized, when it arrives in the pixel shader. Despite from that it looks all fine. What happens if you move the light closer? Any chance to get it brighter?
Perhaps a squared fall-off isn’t a good idea if you only have one bounce of light. Would it work better in your scene, if you’d use a linear fall-off?

To answer your other question, the ambient light A can be a color (float3). It is used to model the indirect light that bounced between surfaces. If you’re in a room with many red walls, the ambient light would mostly be red.

The reflection model of your book looks almost like standard phong, except for the ambient part. But it is okay, to model it that way. The fixed function pipelines did it a little different, but that’s a matter of taste. Often games change the tone of the lighting or add additional terms, to achieve a certain look and feel, though it might not be “correct” in any way. A nice example is in John Edwards' talk on the sand rendering in Journey (second last section of that page).
Probably it’s best not to worry too much about the lighting, as long as it looks good. smile.png

Best regards!
Advertisement
There she is. smile.png
Nice model, thanks again!
I couldn't resist and passed this great model through my path tracer (took forever though). Thanks again for the .obj, I will keep it as a reference model.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

Nice! I should put in area lights. It looks so much better. smile.png
Btw, I’ve used stochastic progressive photon mapping for the image above, implemented on the GPU using stochastic spatial hashing. So, a consistent rendering, too. smile.png

Nice! I should put in area lights. It looks so much better.
Btw, I’ve used stochastic progressive photon mapping for the image above, implemented on the GPU using stochastic spatial hashing. So, a consistent rendering, too.

Haha, very nice, mine is just basic path tracing with an area light, a "wet plastic" material for the clothes and everything else is perfectly matte. I need to get working on ray tracing again but I have so much stuff to do... sigh perhaps one day I'll find time to implement my pipe dream, a fast physically correct raytracer (preferably on the GPU) tongue.png

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

This topic is closed to new replies.

Advertisement