Page 2 of 2

Re: Lighting

Posted: Mon Aug 03, 2015 3:21 pm
by andrewmac
Puppy shader coming soon™.

Here's a better model than the sphere with random colors:
Image
Image
Image

Re: Lighting

Posted: Mon Oct 19, 2015 1:22 am
by andrewmac
The previous shots were using radiance and irradiance cubemaps that were prefiltered in AMD Cubemapgen. I've now written the code into the skylight so it can generate a radiance cubemap and irradiance cubemap from any source skybox cubemap. It's still under development but the basic idea is working quite well. It follows UE4 and Disney's presentations and uses GGX importance sampling.

Piza:
Image

Uffizi:
Image

T3D Desert Sky:
Image

Re: Lighting

Posted: Mon Oct 26, 2015 12:37 am
by andrewmac
Playing with Point Lights:
Image

As you can see from the blue point light the light bounds are controlled by the component scale so you can trap point lights in specific areas. I'll add more options for that later.

Re: Lighting

Posted: Mon Oct 26, 2015 11:35 am
by marauder2k9
top quality work man, what method u using for shadows and shadow softness?

can this switch between static and dynamic cube maps?

Re: Lighting

Posted: Mon Oct 26, 2015 1:25 pm
by andrewmac
@ marauder2k9 : what do you need dynamic cubemaps for? I can certainly add it but it would have to be justified. I don't think dynamic per-frame cubemaps are great for much, they're expensive to render even at a lower resolution. The plan for lighting, most of which is finished, is as follows:
  • direct light
  • flat ambient color
  • skylight contribution (global cubemap)
  • local probe contribution (local parallax corrected cubemap)
  • realtime GI solution I'm working on
  • short range screenspace GI (SSDO)
  • screenspace reflections.
Both skylight and local probes technically use dynamic cubemaps but they refresh very infrequently so I wouldn't call them such. Dynamic cubemaps are just not viable for realtime dynamic reflections, it's too expensive and inaccurate. When you combine the contributions of all the things listed above you get a good, plausible picture. You can also pick and choose pieces of the above list for what fits your needs. That said, I'll add just about anything if someone can make an argument for it.

Re: Lighting

Posted: Tue Oct 27, 2015 2:16 pm
by marauder2k9
purely just as a show off tbh, the only other thing dynamic cubemaps would have a use for would be for mirrors, at least its one of the less costly ways of doing it as far as i know,

Re: Lighting

Posted: Tue Oct 27, 2015 9:52 pm
by andrewmac
Mirrors are best handled with a planar reflection. Basically all the effects where you'd want to use a dynamic cubemap are being handled by a more efficient solution.

Hmm.. the ability to render the scene to a cubemap is going to be added very soon so I can do light/reflection probes. Since the code will be there already it will be trivial to add a dynamic cubemap capture component. The component would render to some kind of slot that could then be used in a material to display the result in whatever way you want. I still think when the time comes you'll be happy enough with the lighting setup that you won't need this feature, but if you do I'll add it for you :D

Re: Lighting

Posted: Wed Oct 28, 2015 2:04 pm
by marauder2k9
awk no dont worry i will add it myself like i was just curious if u were going to add it anyway, do u know what way ur going to do shadows and shadow softness?

Re: Lighting

Posted: Thu Oct 29, 2015 12:09 am
by andrewmac
The current implementation is cascaded shadowmaps with optimized PCF5x5 done with 9 taps, same as Unity uses. It's pretty fast and produces nice hard shadows with soft antialiased edges however it's not capable of doing proper soft shadows in its current form. For now I'm happy with this although the actual implementation needs a few more fixes and improvements.

Once I'm completely happy with the state of that and fill in the rest of the missing stuff I'll explore more options for shadowmapping. One cool thing though is that all of shadowmapping is contained in the DirectionalLight scene feature. Scene features are very easy to make and work with. Here's the entirety of the directional light + cascaded shadowmaps code:

https://github.com/andr3wmac/Torque6/bl ... alLight.cc

The shaders are elsewhere obviously but that's the C++ code for the implementation. It would be really easy for someone to expand the code for more shadow features, or just make a whole new directional light scene feature in the form of a plugin with a modified shadowmap for improved shadows. I hope as the engine matures people can start making things like this and grow a similar marketplace as Unity.