Jump to content
  • Advertisement
Sign in to follow this  
Piccolor

SH and specular

This topic is 4775 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I'm trying to implement SH (spherical harmonics) in my engine, I have a question : I read that SH is usable for diffuse lighting only.What I understood is thaht SH are similars to having an color cube map representing lights in a scene. Why cant we use SH for specular lighting so ? I can use a low res cube map for reflection, not accurate of course, but in most case (no mirror of course), it's looks ok . So is it a blasphem to use SH for specular lighting ? What I'm misunderstanding ? thanks ..

Share this post


Link to post
Share on other sites
Advertisement
I think part of the reason why SH don't use specular is because the extra data needed to be stored would make it explode. One option is to just use an area cubemap like you suggested. It's not that bad, as Half Life 2 uses the same thing to do specular lighting with its radiosity lightmaps.

Share this post


Link to post
Share on other sites
Quote:
Original post by Piccolor
Hi all,
I'm trying to implement SH (spherical harmonics) in my engine,
I have a question : I read that SH is usable for diffuse lighting only.What I understood is thaht SH are similars to having an color cube map representing lights in a scene. Why cant we use SH for specular lighting so ?
I can use a low res cube map for reflection, not accurate of course, but in most case (no mirror of course), it's looks ok .
So is it a blasphem to use SH for specular lighting ? What I'm misunderstanding ?

thanks ..


First, please call it PRT, SH is just a basis function. But, the answer is you CAN do specular its just not feasible. If you read Peter-Pike's original PRT paper it has a good portion on it. However, its not really feasable even with compression.

The major problem is that Specular is a 4d function instead of 2d, and it has high frequency highlights.

Share this post


Link to post
Share on other sites
Ok, I'll try to be more explicit,
I dot not use PRT yet, only IrradianceEnv map encoded with SH (much less work for me and the CPU)
Maybe I can encode in the SH coef light direction instead of colors and in the pixel shader do the specular calculation with the L vecotr I retrieve ??

Thanks for any suggestion...

Share this post


Link to post
Share on other sites
Trying to use SH to encode specular lighting as a function of the normal vector obviously wouldn't work. But if you treat the SH function as a replacement for a cubemap, then it should be possible to get semi-resonable results by feeding the reflection vector into the SH function.

It would be equivalent to using the reflection vector as the 3D UVW for a very low-rez cube map. As long as you are OK with having a very broad specular highlight it should work out.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!