Work Blog - JeffR

147 posts Page 13 of 15
JeffR
Steering Committee
Steering Committee
Posts: 694
Joined: Tue Feb 03, 2015 9:49 pm
 
by JeffR » Tue May 09, 2017 4:05 pm
@
User avatar
Chelaru
Haha ;)

For the curious, https://en.wikipedia.org/wiki/Spherical_harmonics. Some serious voodoo math involved, but once you get the concepting down, it's a startlingly efficient way of encoding directional lighting information for an entire sphere of directions into a handful of Colors. For example, second order SH uses only 9 ColorFs to encode pretty much every possible direction of lighting in a full sphere, with minimal gaps or missed data.

Got the bulk of the stuff in last night, but ran into an issue where it was *mostly* encoding ok, but one band was getting corruption and blowing out to full white. So i'll be taking a further look at that. Worst case, I have a few other implementations of SH I can test and see if they give better/more consistent results. When I get something locked in, I'll definitely be posting some screens/video :)

@
User avatar
damik
Thanks!
Chelaru
Posts: 183
Joined: Wed Jul 01, 2015 10:33 am
by Chelaru » Wed May 10, 2017 8:23 am
I remember doing some partial differential equations work back in the day. :D

I do have a question. What is with the muddy color? Are they a product of not so occurred material use or there is some work to be done in that direction with this implementation?
I ask this as i prefer bright, vivid colors.
JeffR
Steering Committee
Steering Committee
Posts: 694
Joined: Tue Feb 03, 2015 9:49 pm
 
by JeffR » Thu May 11, 2017 7:34 am
@
User avatar
Chelaru

Yeah, the implementation is definitely, definitely not done yet. I'm still dialing in the math(the problem is that while the theoretical math itself is consistent, it's a TON of math, and thus not something you wanna throw at a game. There's lots of game-friendly optimized approaches, but their math isn't consistent and varies method-to-method, so I'm working on getting a good implementation sorted).

When I finalize it, it should come out pretty crisp and vivid. I agree completely that those are the best colors :)

I made some more progress today with it, as you can see here:
Image

The bright areas are a good deal closer, but it's not diffusing the light in the darker regions right yet, so I've still got some work to do.
Chelaru
Posts: 183
Joined: Wed Jul 01, 2015 10:33 am
by Chelaru » Thu May 11, 2017 8:05 am
Yee, that is some big progress, the contrast is so good. On the diffuse part you are correct. It looks like the light fall off is a bit to hard. Maybe the penumbra part, or this is related to the shadow quality? All in all its a big big progress on the contrast side. Might be a tad to dark in the non direct illuminated parts.
JeffR
Steering Committee
Steering Committee
Posts: 694
Joined: Tue Feb 03, 2015 9:49 pm
 
by JeffR » Fri May 12, 2017 7:28 am
Video showing off the actual impact lighting has when you bake the probes.

It's not perfect, but I consider it at the point where it 'works' now.



As a minor aside, this is done in debug mode. In release, the time to update the probes is ~3 seconds, and should be even faster as we trim the fat and optimize. Given that it's nearly 50 probes in that scene, it's not bad, performance-wise.
Chelaru
Posts: 183
Joined: Wed Jul 01, 2015 10:33 am
by Chelaru » Fri May 12, 2017 8:39 am
JeffR wrote:Video showing off the actual impact lighting has when you bake the probes.

It's not perfect, but I consider it at the point where it 'works' now.



As a minor aside, this is done in debug mode. In release, the time to update the probes is ~3 seconds, and should be even faster as we trim the fat and optimize. Given that it's nearly 50 probes in that scene, it's not bad, performance-wise.


Looks amazing!

JeffR the probes are set manually? If so, isn't any possibility to auto generate most of them ? I think this will help .
JeffR
Steering Committee
Steering Committee
Posts: 694
Joined: Tue Feb 03, 2015 9:49 pm
 
by JeffR » Fri May 12, 2017 4:05 pm
Yeah, the probes are placed manually at the moment, but I have mulled on automatic placement schemes.

Some basic ones would involve marking out an area, and then placing them in a grid and rejecting ones that are inside geometry, another would be an irregular grid that tries to fill a given space, etc.

Not likely something you would leave as your production result, but it would definitely be a good jump-start on placement to save time.
JeffR
Steering Committee
Steering Committee
Posts: 694
Joined: Tue Feb 03, 2015 9:49 pm
 
by JeffR » Mon May 15, 2017 3:47 pm
Bit more progress on probes:



Shows off a bit of the remaining issues, but also shows the difference between with probes, without probes, and with the flat ambient color.

During the fly-through, you can see the second floor's floor lit in green for the one hallway, and then for the ground-floor flythrough, the ceiling is lit. This is happening due to the sphere mesh over-extending and we're getting some bleed-over happening. It didn't display that before because we had the NDotL trick to reject pixel normals that faced away from the probes, just like we do for lights. The problem with that is, of course, that probes are supposed to represent ambient, omnidirectional lighting from the environment, so there isn't technically an 'away'. But when you let pixels facing away get applied, you run into stuff like this where pixels on the backside of surfaces you DIDN'T want getting it being hit.

To correct it, we need to look at tweaking the attenuation, or getting the box-mode working properly. Or maybe both. But box mode for sure, which will work a lot nicer in indoor/manmade spaces.

As a positive tradeoff, however, the irradiance lighting doesn't have semi-arbitrary darkening of pixels that are facing away, so the lighting is much less muddled, while still maintaining the directional subtlety, so it definitely pops a lot better and keeps up that good, vivid-ness :)
JeffR
Steering Committee
Steering Committee
Posts: 694
Joined: Tue Feb 03, 2015 9:49 pm
 
by JeffR » Wed May 17, 2017 6:36 am
So, for a breakdown on the todo for probes, here's what remains:

  • Get box mode working properly, with it rejecting pixels that fall outside it's volume
  • Test and tweak the reflect angle math. As-is, it's a perfect mirror reflect off the normal, which looks to empircally be a little off, so we'll double-check tat.
  • Get parallax correction added for both sphere and box modes
  • Special-case probes that are flagged with Skylight so they render first, and don't write any alpha in the buffer, so that more localized probes will overwrite it.
  • Get forward rendering/translucency working with the nearest 3 or 4 probes, similar to how we pass in the closest affecting lights
  • Add a setting that dictates if probes render with backfacing pixel rejection or not. With it on, pixels facing away from probes don't get contribution from the probes. It requires more probes in the scene, so there's more cost to ensure everything is covered, but it prevents issues like 'object reflecting itself' that can come from the other way. With it on, it's less accurate, but you need fewer probes to ensure total coverage of an area. It'll default to rejection being on, to encourage accurate reflections, but the end-user can decide if they're ok with the lower accuracy for performance trade
  • Add LOD'ing to probes(and lights) so we don't have to ALWAYS render them, particularly when they're far away. Tie it to a pref to scale the distance, and you get a lot of control over how many probes hit a scene at once so performance can be dialed in.
  • Dynamic reflection mode
  • Screen-Space Reflections to compliment the probe's reflections, allowing cheap reflections of dynamic objects, and smoothing over blendpoints and any parallax distortions.

We get all that locked in, and that's pretty much everything we've looked at for probes. We're actually already pretty close to where UE4's reflections are, so if we get all the above locked in, we'll be seriously competitive in the reflection handling.
Chelaru
Posts: 183
Joined: Wed Jul 01, 2015 10:33 am
by Chelaru » Wed May 17, 2017 9:16 am
Uuuu, this is getting really exiting.
147 posts Page 13 of 15

Who is online

Users browsing this forum: No registered users and 1 guest