Home 3D Art Showcase & Critiques

Approximated Sub Surface Scattering Demo - UDK

2

Replies

  • Frankie
    Options
    Offline / Send Message
    Frankie polycounter lvl 19
    I haven't tried it but make sure your rays aren't going out too far when you invert everything. They would need to terminate without hitting anything so it thinks it can see the sky before it hits the other side and gets occluded. If you had infinite length AO rays inverted baking would give you a fully black map.

    Probably....
  • Arkadius
    Options
    Offline / Send Message
    Arkadius polycounter lvl 13
    A totally black map is what I got, So I'll try to play around with the ray settings and see what that yields. Thanks!
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Max has a Subsurface map render, Render to Texture -> Subsurface Map.
  • Ryan Smith
    Options
    Offline / Send Message
    Ryan Smith polycounter lvl 11
    Sorry for being absent during all this... just started a job at Gearbox.

    Anyways it took me a while to figure out how to bake the map out properly when i was first doing this. IT's all in the Ambient Occlusion options in your RTT dialogue in max.. IF i recall correctly, you have to set the distance to 0 (that way the rays cast are infinite) and then you have to set the samples to something like 64 or 128 so you get enough detail. Remember... this is APPROXIMATED.

    You'll end up getting s aplotchy mess, which you then have to bring into photoshop and blur to get the final result. I also took an edge map, and overlayed it on top of the Blurred AO map to get the sharper highlights in the map.


    The bottom line, is that you're not going to get a perfect render at all when you do this... it requires some time and effort in post to generate a map that is going to work well for your asset.

    I hope that clears things up.
  • Joshua Stubbles
    Options
    Offline / Send Message
    Joshua Stubbles polycounter lvl 19
    I was able to get decent results. It's all about the ray distance. I had to set it very small in order get proper results. Otherwise it came out looking like leper flesh :|
  • LoTekK
    Options
    Offline / Send Message
    LoTekK polycounter lvl 17
    Blender's inverted approximated AO bakes pretty much work out of the box (after that it's just a matter of tweaking in PS). :D

    Managed to get it working in Unity without too much hassle. Added a few more tweakables, as well, like SSS color, and also takes full-color thickness maps, if I feel like being a bit silly.

    Quick screenshot with some semi-exaggerated settings. The light on the right side is sitting inside the taller box.

    approximatedSSStest.jpg
  • Progg
    Options
    Offline / Send Message
    Progg polycounter lvl 11
    Finally got some time to mess around with rebuilding this in UDK. I was curious if anyone could offer some suggestions. I seem to get hung up on a few things. I only know real basic HLSL but I am pretty well versed in UDK.

    half3 vLTLight = vLight + vNormal * fLTDistortion;
    half fLTDot = pow(saturate(dot(vEye, -vLTLight)), fLTPower) * fLTScale;

    All of this is pretty straight forward converting to UDK nodes...(atleast I think I did it right)

    half3 fLT = fLightAttenuation * (fLTDot + fLTAmbient) * fLTThickness;
    half3 cLT = cDiffuseAlbedo * cLightDiffuse * fLT;

    However, at line 3 (half3 fLT = fLightAttenuation * (fLTDot + fLTAmbient) * fLTThickness;) is where I get lost...


    I know what 'light attenuation' is, but how exactly does this translate to UDK nodes. I understand the fLTThickness is essentially the depth map, is fLTAmbient just a vec3 color node added to the first collection of nodes in order to apply a color to the fake SSS?

    Also, how exactly does this hooked up? I assume it should be set to a custom lighting model correct?

    Thanks
  • KazeoHin
    Options
    Offline / Send Message
    KazeoHin polycounter lvl 8
    This is why I wish my brain can work with code. Nice work!
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Hey Progg I saw this yesterday when you posted but I guess Polycount was down or sometihng anywho, guessing for UDK terms it would be something like the square root of dot product of the light vector by itself to get the distance and for the actual attenuation:

    1 / (constantFactor + (linearFactor * distance) + (quadricFactor * (distance)^2))

    The constant factor is close, linear is medium and quadric is far or thats how I think of it. I think thats the standard formula for attenuation but as always there's different curves.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Hey Rhino I saw this yesterday when you posted but I guess Polycount was down or sometihng anywho, guessing for UDK terms it would be something like dot product of the light vector by itself to get the distance and for the actual attenuation:

    1 / (constantFactor + (linearFactor * distance) + (quadricFactor * (distance)^2))

    The constant factor is close, linear is medium and quadric is far or thats how I think of it. I think thats the standard formula for attenuation but as always there's different curves.

    As far as I'm aware, UDK doesn't allow you mess about the attenuation in the traditional sense (they even mention that in the Docs IIRC), it's extremely hacky, and half of the time, the distance node seems to act more like a glorified Dot then anything.

    I hope I am wrong, but all my test's so far concluded that Distance node = Dot node in term of results.
  • Progg
    Options
    Offline / Send Message
    Progg polycounter lvl 11
    Ace-Angel wrote: »
    As far as I'm aware, UDK doesn't allow you mess about the attenuation in the traditional sense (they even mention that in the Docs IIRC), it's extremely hacky, and half of the time, the distance node seems to act more like a glorified Dot then anything.

    I hope I am wrong, but all my test's so far concluded that Distance node = Dot node in term of results.

    Then what would you substitute for light attenuation in that code?
    half3 fLT = fLightAttenuation * (fLTDot + fLTAmbient) * fLTThickness;
    half3 cLT = cDiffuseAlbedo * cLightDiffuse * fLT;
  • tuxmask75
    Options
    Offline / Send Message
    tuxmask75 polycounter lvl 10
    Progg wrote: »
    Then what would you substitute for light attenuation in that code?
    This is basically where I'm stuck at as well.
2
Sign In or Register to comment.