Search Unity

Pre-Integrated Skin Shader - announcements and feedback

Discussion in 'Assets and Asset Store' started by cician, Feb 26, 2013.

?

What should I focus on for next releases

  1. optimizations and mobile

    45 vote(s)
    24.9%
  2. realism

    83 vote(s)
    45.9%
  3. ease of use

    8 vote(s)
    4.4%
  4. just fixes and compatibility, it's awesome as is and you better make a hair shader...

    45 vote(s)
    24.9%
  1. ThunderTruck

    ThunderTruck

    Joined:
    Sep 25, 2013
    Posts:
    61
    Thanks,
    I see what you mean, the shader keywords limitation is a real bother and I was thinking about ad-hoc shader also for tessellation.
    Anyhow the cut-out feature is really really important with the characters who use additional mesh for clothes that overlap the skin otherwise have to use their shader that are as standards, very far from the quality of your skin shaders...
     
  2. u3gt6o8

    u3gt6o8

    Joined:
    Jun 9, 2014
    Posts:
    17
    Thanks. I don't see the problem with the standard shader
     
  3. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    I'll have to know more about the setup to understand/reproduce the issue.
    - whether you use deferred or forward rendering (or legacy deferred)
    - do you have dynamic GI enabled?
    - the lights, have they shadows enabled? any cookies?
    - number of real-time lights in quality settings
    If possible, the best thing would be a screenshot of the scene and of the lighting configuration window.
     
  4. u3gt6o8

    u3gt6o8

    Joined:
    Jun 9, 2014
    Posts:
    17
    Ok.

    This is a very simple scene with a character and three spotlights.
    I use forward rendering. The three lights are all realtime without shadows or cookies.

    The effect looks like if the back light going through the mesh of the head from the back and effecting the front face.
     
  5. u3gt6o8

    u3gt6o8

    Joined:
    Jun 9, 2014
    Posts:
    17
    I am adding screenshots:
    1. is with back light and the skin shader.
    2. is without back light and the skin shader.
    3. is with standard shader (it looks the same with or without the back light)

    1.jpg 3.jpg 2.jpg
     
  6. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    Please try reducing translucency power and let me know if that removes the red glow.
     
  7. u3gt6o8

    u3gt6o8

    Joined:
    Jun 9, 2014
    Posts:
    17
    I lowered it to zero, but nothing changed
     
  8. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    Sorry for a kinda difficult question, but if you rotate the view around the sphere, does the light remain as an outline at edges of the sphere or does it just follow a gradient in world space as in the following image? upload_2015-10-30_19-43-15.png
    Also does the back light's range intersect or cover the sphere?
     
  9. u3gt6o8

    u3gt6o8

    Joined:
    Jun 9, 2014
    Posts:
    17
    The light remains as an outline.
    The back light range cover the sphere.

    I also noticed that if on the front there is a hole, than its outline also effected by the light ( like I said before, it looks like the light is going through the object).

    Hope it helps
     
  10. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    Sorry if I ask too many questions, but I'm not yet sure where does it come from.
    If you set environment intensity to zero, does it disappear? Does changing specular intensity affect it?
    Otherwise, if it's simpler for you, you could make a minimal project that reproduces the issue and share it with me via dropbox (or similar).
     
  11. u3gt6o8

    u3gt6o8

    Joined:
    Jun 9, 2014
    Posts:
    17
    No problem.
    Setting the environment to 0 and removing specular does not change the effect.
    I will try to create a simple project for you and send it.
     
  12. u3gt6o8

    u3gt6o8

    Joined:
    Jun 9, 2014
    Posts:
    17
    I am adding a simple project with the issue: https://www.dropbox.com/s/ig1hyhybmb9ahi1/SkinShaderTest.zip?dl=0
    In the example scene I have also added the low poly character from the skin shader example, to show the problem around the mouth. When you turn up the back light intensity, you can see the effect of the light on the mouth of the character (which does not exists when using standard shader).

    I really appreciate the effort and I hope my example will help.
     
  13. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    OK. You can pull the link now.

    I've looked at the test project. Basically, since your depth map is fairly bright (it's the shader that kinda expects a fairly dark texture, if you prefer), you need to tune down scattering power accordingly. Try something between 0.1 and 0.2.

    ps.: I may not have access to the internet for a while starting tomorrow, hopefully in about a week the new line is ready.. hopefully:rolleyes:
     
  14. u3gt6o8

    u3gt6o8

    Joined:
    Jun 9, 2014
    Posts:
    17
    Even if I pull down the scattering power to zero, I can still see the effect when I turn up the intensity of the back light. Also when using the demo character i can still the outline of the mouth effected by the back light even though the light should not influence the mouth at all (not showing with standard shader).
     
  15. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    Note that in your test project you have non zero translucency power as well.
    Translucency is meant to penetrate to the other side of the object.

    Assuming there aren't differences in rendering between our systems, what you see is not a bug, but by design.
    This image is from your test scene with two lights removed to isolate only the back light contribution and camera moved a bit up to see the whole sphere.
    Red color wraps to the other side of the sphere due to high scattering. Think jelly.
    upload_2015-10-31_23-35-49.png

    Now with scattering power set to zero. There's still red glow on the "dark" side due to translucency.
    upload_2015-10-31_23-43-7.png

    Now translucency power is set to zero, and scattering power to 0.2, which should look reasonable.
    upload_2015-10-31_23-46-46.png

    Translucency [unfortunately] doesn't account for the real depth of the object and instead relies on approximate thickness from the depth map.
     
  16. u3gt6o8

    u3gt6o8

    Joined:
    Jun 9, 2014
    Posts:
    17
    But if I turned up the intensity of the back light, there is a light inside the mouth as you can see with the attached image (not with Standard shader)

    Test.jpg
     
  17. u3gt6o8

    u3gt6o8

    Joined:
    Jun 9, 2014
    Posts:
    17
    If I set all the sliders of the shader to zero there is still a problem in the mouth. The white inside the mouth shouldn't be influenced by the back light at all!!!

    test1.jpg

    And with the standard shader the problem does not exists. I have this problem with my character inside the mouth and the eyes outline in my real scene (even if all the sliders of the shader are set to zero)
     
    Last edited: Nov 1, 2015
  18. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    393
    Hey matey, just wondering if there are any plans to integrate a wrinkle maps into the shader? Possibly something along the lines of what was seen in The Blacksmith demo
     
    Last edited: Dec 6, 2015
  19. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    I'm back online, finally! I lurked here from work office, but couldn't respond.

    Wrinkle maps are were discussed a bit on the previous page. I probably won't implement them as part of this asset. On the bright side I'm experimenting with other approaches to skin shading and may create a new asset that would allow more features in a scalable way. More on that later.
    Also there's an interesting entry in the 5.3 changelog: "Graphics: API for blend shapes". I'll see what it provides exactly.

    Sorry, but I'm still not convinced there's an issue with the shader. Other than it's too difficult to setup maybe.
    Some differences you mentioned are meant to be there, as it's what it makes the subsurface scattering effect itself work, which the standard shader doesn't have.
    Light leaking inside of the mouth is the unfortunate effect of the cubemap technique used for reflection probes and is not restricted to this shader. There are slight differences compared to standard shader that may make the leak appear in one or the other more likely. For example Unity 5.2 applies reflection probes in screen space which makes things more precise than old per-object interpolation. The problem is that skin shader can't use the new method since it's limited to deferred shading. This shouldn't very noticeable though, unless you use the skin shader on large surfaces like floors, which you shouldn't do anyway.
    I haven't seen yet much effort to solve this problem in real time graphics, other than replacing local reflection with SSR (which slipped to Unity 5.4 and I guess will be limited to deferred rendering, leaving forward shading materials with same problems).
    My shader gives you a possibility to suppress problematic areas with ambient occlusion and if that doesn't help, limit the reflection probes intensity overall (which breaks the physical correctness, but may be necessary).

    To some degree I can help you setup your material and if you're not satisfied you can ask for a refund.
     
  20. mkgm

    mkgm

    Joined:
    Apr 10, 2015
    Posts:
    134
    Help with Genesis 2 from DAZ
    I'm working with Genesis 2 from DAZ STUDIO and I can't get any acceptable result.
    I followed the videos and the docs but nothing :(

    Anybody that worked with G2 & Pre-Integratef SS... please HELP!
     
  21. K-JBrothers

    K-JBrothers

    Joined:
    Feb 27, 2013
    Posts:
    43
    Can you show us your results?
    Here is a quick setup I did few minutes ago, glossiness map is a perk since it's not present in daz, you have to do one by yourself, but it's doable from specular and bump mix, just blur both and then try to combine them in photoshop/gimp, masking parts. For example use parts from bump map texture for overall skin and specular texture parts for lips and fingernails. I don't know if it's easy to understand.. I may do a tutorial if I have some spare time.
    PISS with DAZ.jpg
    PS:
    If you find sss skin blurriness not strong enough try to crank up right arrow of Blur range slider
     
    OfficialHermie and KWaldt like this.
  22. mtl2553

    mtl2553

    Joined:
    Jul 27, 2015
    Posts:
    1

    Hello , I have the same problem with Genesis 2 DAZ , and probe as mention before and the problem is I can not get the glossines left alone on the lips and at the same time this transparency in the ears and may not apply to all skin .
    I'm currently using the ''PreIntegratedSkinShaderV2.0_combined''
     
  23. K-JBrothers

    K-JBrothers

    Joined:
    Feb 27, 2013
    Posts:
    43
    I'm not sure what you mean. Can you show some images? Otherwise I don't know how to help :(
    Here is a little tutorial what to do to get Glossiness map:
    Glossiness steps.jpg
    This procedure must be repeated to all body parts. In case of limbs you should mask finger/toe nails.
    To use combined version of the skin shader you have to combine textures, please check out the manual.
     
  24. Dan_lala

    Dan_lala

    Joined:
    May 14, 2015
    Posts:
    42
    Could you add a little tutorial or just the code for the change in your shader ? I'm also interested in this :)
     
  25. 6789077

    6789077

    Joined:
    May 27, 2014
    Posts:
    4
    OfficialHermie likes this.
  26. mkgm

    mkgm

    Joined:
    Apr 10, 2015
    Posts:
    134
    Yes, a tuto will be awesome.
     
    OfficialHermie likes this.
  27. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    Any update for mobile version?
     
  28. Freddy888

    Freddy888

    Joined:
    Sep 13, 2014
    Posts:
    165
    Can anyone help with this - I'm getting poor quality shadows with the shader. Not quite sure what to change.

    Only the face on this model has had the skin shader applied to it. The regular Unity shader shows shadows properly.

    Thank you.
     

    Attached Files:

    • hmm.jpg
      hmm.jpg
      File size:
      10.4 KB
      Views:
      923
  29. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    If you look closely you'll notice that the standard shader shows the same artifacts, but much less visibly. The fact is that my skin shader makes the already bad quality of unity shadows even worse. Your options are:
    1. play with shadow quality setting and, in particular shadow distance. For directional light you can tweak the shadow cascade ranges.
    2. in the shader source comment out the line
    #define PSS_PENUMBRA_SCATTERING_ON 1
    this will make the shadows look like on the standard shader, but you'll loose the penumbra gradient typical to human skin. Humans are pretty receptive to this little visual phenomenon, but if you cannot get rid of the artifacts then you may be better off without.
     
  30. Freddy888

    Freddy888

    Joined:
    Sep 13, 2014
    Posts:
    165
    OK thanks.

    I put the shadow quality up and it's a bit better, bias cleaned it up a bit too, couldn't see a 'distance' setting, where is that please ?
     
  31. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    In quality settings there is Shadow Distance as well as Cascade splits. Lowering the distance betters the quality level, but cuts the shadows over the specified distance, which is bad for big scenes/open worlds. Cascades let you decide the distribution of shadowmap resolution based on distance to the camera.

    upload_2016-3-19_17-31-17.png
     
  32. Freddy888

    Freddy888

    Joined:
    Sep 13, 2014
    Posts:
    165
    Hmm, the character will be in an open world, so I could only adjust cascade which made the shadows go all flickery.

    Guess I will have to go with what I have.
     
  33. jwilliamsen

    jwilliamsen

    Joined:
    Aug 8, 2010
    Posts:
    56
    Hmmm - getting compile errors when I try to build under Steam VR and the Windows platform. A very simple scene, barely any background, one character, one directional light. Works fine in the editor. Originally, I was getting DX9 errors, so I shut off that option in the player options, but then I started getting DX11 errors:

    Shader error in 'Skin/PreIntegratedSkinShaderV2.0_combined': can't use flow control on this profile at Assets/PreIntegratedSkinShader V2.0/PreIntegratedSkinShaderCore.cginc(512) (on d3d11_9x)

    Compiling Fragment program with DIRECTIONAL SHADOWS_OFF LIGHTMAP_OFF DIRLIGHTMAP_OFF DYNAMICLIGHTMAP_OFF
    Platform defines: UNITY_NO_LINEAR_COLORSPACE UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_MOBILE

    Error building Player: Shader error in 'Skin/PreIntegratedSkinShaderV2.0_combined': can't use flow control on this profile at Assets/PreIntegratedSkinShader V2.0/PreIntegratedSkinShaderCore.cginc(512) (on d3d11_9x)

    Compiling Fragment program with DIRECTIONAL SHADOWS_OFF LIGHTMAP_OFF DIRLIGHTMAP_OFF DYNAMICLIGHTMAP_OFF
    Platform defines: UNITY_NO_LINEAR_COLORSPACE UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_MOBILE

    Any idea what might be causing this?

    Thanks

    Joe

    EDIT: OK - Super-Bizarre ... I changed the camera to an HDR camera and the project compiled (!) What the hell .... Oh - and it's Unity 5.4 B17
     
    Last edited: May 17, 2016
  34. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    I'll look into it. The last beta I tested on windows was 5.4b13.
     
  35. jwilliamsen

    jwilliamsen

    Joined:
    Aug 8, 2010
    Posts:
    56
    It should be repeatable - I've tried in a couple other mini-testing projects, and when I have the skin shader in the scene, I get the error - but as soon as I check HDR on the camera, it goes away and I can build. Add another camera (non-HDR) and it errors out - check HDR - it works. This has been the story on two different machines - both running 5.4 B17

    Thanks for the quick response :)
     
  36. pyroakm

    pyroakm

    Joined:
    May 18, 2016
    Posts:
    31
    Hi.

    We have some problems with your shader.

    First, it doesn't compile and work correctly on PS4 platform, I've done some fixes:
    - Removed the target model 2.5 subshaders.
    - Moved the declaration for LookUp samplers in front of other samplers in PreInttegratedSkinShaderCombined.shader.
    - Removed the rpc() function, and replaced in with 1.0/x in the code.

    Second, we have a very huge project and we need to use different quality levels (Edit/Project settings/Quality):
    When we reduce the texture quality to half, quarter and height res, the lookup texture are then reduced and affect the color of the skin (darker color).
    I've tried to detect the resolution with a float4 _LookupDirect_TexelSize.z but the size seem not modified when changing the quality.
    I've tried to use a bigger lookup texture but that doesn't work.
    Have you got an idea to fix this problem?
     
    Last edited: May 19, 2016
  37. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    I've fixed the compilation issue. The fix is available in the repo and will be part of next bugfix release.

    Unfortunately I don't have access to PS4 or other console dev kits so I couldn't test:( So officially consoles are not supported, but if you have some time to spare I'd love to make it work. It would be nice if you could report error messages you have with unmodified shader.

    As for the texture quality issue, I was able to reproduce it, but it may not be that easy to fix. The problem is that Unity applies a texture mip level bias to everything and there's no way to make an exception for lookup textures (that I know of). Shame on me I should have imagined it would be the case or at least realized sooner. Now I have to make some heavy changes to remove mip map usage from lookup textures (or nag Unity Tech. to add some kind of exception).
     
  38. pyroakm

    pyroakm

    Joined:
    May 18, 2016
    Posts:
    31
    Thank you for the answer.

    - The PS4 version already work with the modifications I've described. I can send you the sources if you give me a way to send them (mail or ftp).
    - For texture quality, I will try to disable the use of the lookup sampler when it is reduced...
     
  39. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    I'll gladly integrate your changes, thank you. Mail me assetstore@jagiello.it or if you prefer there's a git repo at gitlab.com.

    For texture quality I'm afraid there's no quick fix, though I'm still investigating. Separate samplers are not supported on all platforms and Unity may actually skip mips from being loaded into VRAM. I'll make changes to avoid mip map usage in lookup textures, though penumbra scattering feature may need to be sacrificed (disabled on default).
    I actually thought of a workaround but it's a bit ugly and wasteful so I probably won't do it: add spurious mips into the lookup texture and apply mipBias to it based on QualitySettings.masterTextureLimit.
     
  40. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Hello!

    I want to know if there a guide to your code, I want to customized it to my need.

    For example I want to know how it behave without LODblur.
    Here is a test I made with LUX (free), can you tell which one is the unmodified shader?

    Left



    I used this
    Code (CSharp):
    1.            float3 Snorm = float3(0,0,1)*0.79;//IN.worldNormal * 10;
    2.             Snorm = normalize(half3(o.Normal.xy + Snorm.xy, o.Normal.z * Snorm.z));
    3.             Snorm = WorldNormalVector( IN, Snorm );
    4.             #if defined (_LUX_SKINMICROBUMPS)
    5.                 half3 MicroBump = UnpackScaleNormal(tex2D(_MicroBumpMap, IN.uv_MainTex * _MicroBumpMapTiling ), _MicroBumpScale);
    6.                 o.Normal = normalize(half3(o.Normal.xy + MicroBump.xy, o.Normal.z * MicroBump.z));
    7.             #endif
    8.             o.BlurredNormal = Snorm;
    instead of

    Code (CSharp):
    1.             fixed3 blurredWorldNormal = UnpackNormal( tex2Dlod ( _BumpMap, float4 ( IN.uv_MainTex, _BumpBias, _BumpBias ) ) );
    2.             blurredWorldNormal = normalize( lerp(o.Normal, blurredWorldNormal, _BlurStrength
    3.             #if defined (LUX_LIGHTINGFADE)
    4.                 * IN.blendState ) );
    5.             #else
    6.                 ) );
    7.             #endif
    8.             blurredWorldNormal = WorldNormalVector( IN, blurredWorldNormal );
    9.             o.BlurredNormal = blurredWorldNormal
    I think I could do better than a naive blend by using a proportional curve to approximate the blur. Basically the main idea is that the blur basically soften the slope, I approximate that by blending a up normal.

    I want to see if I can use wrinkle map

    I wonder if you have any reference for black skin, and I don't mean brown, I mean dark, see the guy on the left, it seems light behave a bit differently on these skins. I want to see if I can have a model that scale from one type to the other.

     
  41. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Also do you have any tips about combining ramp texture into zonal harmonics? :D
     
  42. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    There's no guide to the code, only a user manual, but if you have any specific questions I can help.

    You can see the effect of the blur by commenting out the line "#define PSS_BLURRED_SAMPLING_ON 1".

    Wrinkle maps is a recurring topic, but I haven't implemented them (yet?). Mostly because with limitations of traditional forward rendering it could be a performance killer, unless limited to like a single blend between two wrinkles or so.
    I'd love to implement construction of diffusion profiles from physical parameters, like melanin amount. I don't yet have a proper understaning of how to do that though. I may get back into it one day.
    For now you can only create them by guesswork or from empirical observations (shine a laser dot on the skin and try to make the profile match it). For black skin the SSS effect is much less pronounced so you can just start with caucasian profile and tune down scattering to bare minimum and concentrate on the specular, which is more important to get right in this case.

    My shader does SSS on spherical harmonic lighting from probes and IBL. I'm not 100% confident I got all the math right, but it works quite well. The lookup texture generation source is included.
    If you want to dive in the math there's Mathematica workbook in the repo https://gitlab.com/jbrothers/pre-integrated-skin-shader/blob/master/spherical_harmonics.nb (for repo access see https://gitlab.com/jbrothers/pre-integrated-skin-shader-public-wiki/wikis/beta-and-git).
     
    ksam2 likes this.
  43. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    It's really cool. I can create every kind of skins with this shader. thanks.
    Now I need to increase amount of normal map a bit more like 1.5 but there is no parameter like standard shader to increase it.
     
  44. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Thanks for the answer, I read the code, the commented graveyard can be safely erased? or is it stuff left in with potential optimization or alternative for obsolete hardware?

    There is a bunch of thing I don't get, I don't understand most internal texture either, what they actually do and if I can optimize. Also there is a weight list ?

    About the spherical harmonic, I don't mean from lightprobe, I mean to compress the subsurface look up texture.

    I'm using scan data too, so I must find a way to replace the curvature code by actual map, but I don't know how I would create that map, any pointer?

    Is the problem with wrinkle map related to reading samples from the normal texure mipmap? Is it's that I have solve this problem with my approximation.

    I haven't fully tested your shader yet, I need to create the needed map for my model.
     
  45. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    There is a slot for general normal map, can you add a second normal map for more detail? that can help.
     
  46. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    By commented graveyard do you mean functions in PreIntegratedSkinShaderCommon.cginc? If so, these are different takes on optimizing specular shading that I tried and kept for reference, they can be removed safely (see this link if you want to understand why http://www.filmicworlds.com/2014/04/21/optimizing-ggx-shaders-with-dotlh/).

    If by internal texture you mean lookup textures then you'd need to understand the original Pre-Integrated Skin Shading work (warning, math heavy stuff): http://advances.realtimerendering.c... Advances in Real-Time Rendering Course).pptx, but if you want some light customizations then you shouldn't need to.
    With time I diverged a bit from what is described in the presentation and mixed in a bit from other techniques, but the base principle is the same. The original penner's technique uses a single lookup with the diffusion profile baked into an RGB texture, which is faster but less flexible. Instead here you have a monochromatic lookup that is accessed multiple times for different variance levels of the diffusion profile. You may want to understand how diffusion profiles come into play and relate to blur levels. See this http://http.developer.nvidia.com/GPUGems3/gpugems3_ch14.html, and/or this http://www.iryoku.com/screen-space-subsurface-scattering. Each weight in the diffusion profile apply to the corresponding variance (read blur level). Together they model the scattering in multi-layered skin.

    I specifically disabled texture compression on lookup textures because you need high precision that is not achievable with commonly available compression formats. DX11 formats may make the cut, but weren't available at all in Unity then and require recent hardware. But I guess you didn't mean that either.

    The problem with wrinkle maps is the sheer amount of bandwidth needed to sample multiple high resolution normal maps to blend which is per light in forward rendering.

    TLDR;

    This shader does rely on the "depth" map (instead of implicit curvature from standard derivatives) and using scan data doesn't mean you can't bake one. If you haven't yet, take a look here.
    Maybe you mean a subsurface map? They are currently unsupported.

    I hope I addressed some of your questions and din't just add to confusion.
     
  47. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    I did some experiments with detail texturing. Visually the results were encouraging, but performance was kinda bad so I dropped it in favor of other more important features (was working on IBL and rewrite for Unity 5 at that time). I may get back into it give it a second chance.
     
    ksam2 likes this.
  48. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Well there is many subject, let's go one by one :)

    By look up I mean:
    _look up direct
    _look ip direct sm2
    _look up SH
    _look up spec AO

    They don't looks like penner's at all :)
    Assuming some are about the dotLH?

    What do they do each? especially each channel don't seem to encode the same things
     
  49. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    Lookup direct's red channel is the actual direct light SSS lookup parametrized with N.L and curvature/scattering radius. It's actually a 3d lookup with shadow penumbra in mip chain, combining this way two lookups described by Penner. This kinda backfired though because unity messes with textures' mip offset, see recent posts above.The lookup is kept independent of diffusion profile by adjusting the curvature with variance.
    Other channels are lookups for approximated GGX specular. If you read the first link it should be clea. Here again I used mip chain for roughness, using the fact that you need less precision for high roughness.

    Direct SM2 is again bogh SSS and specular, but without mip tricks because shader model 2 doesn't support LOD. So on Shader Model 2 penumbra scattering is off and specular is implemented a bit differently.

    SH stands for Spherical Harmonics and is used for ambient light/probes and IBL. This wasn't covered by Penner IIRC, but there's a presentation on shading in Order 1886. It's a bit crude math though.

    And the last one is used only on shader model 2 just to cut a few instructions, that are otherwise better done in ALU.
     
    ksam2 likes this.
  50. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    Simply the best skin shader for Unity ever.
    I think Skin should have emission too, It can be really useful specially in night and dark places. Can you add this too?