Announcement

Collapse
No announcement yet.

Last of Us style indirect shadows

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Yeah, good work!
    Uncharted 4 is using the indirect shadow system from TLOU and I guess also the next AAA games will use it.

    Click image for larger version

Name:	unch.jpg
Views:	1
Size:	21.5 KB
ID:	1079109
    Attached Files
    Last edited by Jhosep_Chevarria; 05-29-2015, 10:45 PM.
    The Virtual Photographer, welcome to my world!
    AQP City, Open World Game
    My Artstation: Click me!
    *AQP City Fan page
    *AQP City on Indie DB

    Comment


      #17
      Properly implementing this got a bit bigger then I initially thought so to be honest I haven't really been able to work on this much further. Additionally I noticed some work on surfel-based shadowing in the main source github, which might solve a similar issue, so I kind of focused on other things.

      I'll see if I can clean up the prototype and post the source here if someone else would like to attempt to create something more useful with it.

      @RyanB: The images posted here used the lookup texture from the Naughty Dog presentation as I wanted to get the basics working first. My plan was to make a simple maxscript to automate the baking. Shouldn't be to hard as you can basically bake a small coverage texture per pixel and store the average.

      Comment


        #18
        Hey guys, if anybody is curious to mess with this I made a material that can be used to render out the soft shadow lookup textures that are similar to the last of us paper (although not exactly).

        The core of the math is in this custom node with inputs d, r0, r1:

        Code:
        float div1=cos(d)-(cos(r0)*cos(r1));
        div1/=sin(r0)*sin(r1);
        
        float div2=((-1)*cos(r1))+(cos(d)*cos(r0));
        div2/=sin(d)*sin(r0);
        
        float div3=((-1)*cos(r0))+(cos(d)*cos(r1));
        div3/=sin(d)*sin(r1);
        
        float term=(2*PI)-(2*PI*cos(r0));
        term-=2*PI*cos(r1);
        term-=2*acos(div1);
        term+=2*cos(r0)*acos(div2);
        term+=2*cos(r1)*acos(div3);
        
        
        
        return term;
        The material graph:

        Click image for larger version

Name:	SoftShadowMap_Mat_01.JPG
Views:	1
Size:	145.4 KB
ID:	1079429

        Click image for larger version

Name:	SoftShadowMap_Mat_02.JPG
Views:	1
Size:	75.1 KB
ID:	1079430


        Notice that the only modifiable variable still hooked up is the light cone angle. So you render multiple textures with various light cone angles and channel pack them and lerp between them to adjust the penumbra in realtime.

        All cosine nodes have a period of 2pi so that they work the same as the custom one ones. Also notice all the starting degrees get converted to radians which makes it easier. And the UVs need to be given sphere like curvature which is why there is cosine on the UVs.

        https://www.cse.ust.hk/~psander/docs/aperture.pdf
        Attached Files
        Last edited by RyanB; 06-05-2015, 04:11 AM.
        Ryan Brucks
        Principal Technical Artist, Epic Games

        Comment


          #19
          Here is a texture to try that has channel packed light source angle.

          R=5degrees
          G=15degrees
          B=30degrees

          A=60degrees

          Click image for larger version

Name:	rgba_5-15-30-60.jpg
Views:	1
Size:	9.1 KB
ID:	1079427

          Click image for larger version

Name:	rgba_A-60.jpg
Views:	1
Size:	6.8 KB
ID:	1079428

          *edit* fixed curve mapping, it was slightly wrong before.
          Last edited by RyanB; 06-05-2015, 03:59 AM.
          Ryan Brucks
          Principal Technical Artist, Epic Games

          Comment

          Working...
          X