3Delight Surface and Lighting Thread

191012141552

Comments

  • wowiewowie Posts: 2,029
    edited February 2014

    I decided to revisit my hair preset and tweaked it a bit (well, a lot actually) to get the general idea on how to achieve a similar look.

    I re-used velvet but with much sharper falloff to gave the hair more light at the outer edges. To get a stronger response to the main light, I'm using the first layer specular pretty much as a third diffuse channel. The second specular is still used, giving some areas a little bit more light. To get colored shadows, I'm using a tinted opacity color.

    There's still problems with the hair getting too much transparency with very strong incoming light and the diffuse and translucence color/shade could be better matched. I'm seriously thinking about using SSS instead with maybe bump maps to control the strength. Placing some geometry inside the hair to act as a light blocker/shadow caster but invisible to the camera also seems to be a good idea since it seems like it does work with some parts of the hair.

    Hair2.png
    800 x 988 - 674K
    Hair1.png
    800 x 988 - 834K
    Post edited by wowie on
  • mjc1016mjc1016 Posts: 15,001
    edited December 1969

    A couple of things that work against transparency mapped hair and translucency/other 'effects'...

    1. Strand/curve hair is calculated as if it was a tube...so there are 2 surfaces that light passed through, minimally. Transmapped hair is a single thickness plane. One thing this means is that there will be a lot less room between 'not enough' and 'too much' on transmapped hair. Doubling the individual planes, geo-shells, etc won't help/will make things worse...if only from the hit to render time from doubling the amount of transparency mapping done.

    2. Somewhat related to #1...the basic layout of tranmapped hair is just a few layers thick, while on strand/curve hair at any given point you are 'looking' through 10s to 100s of layers, so even if each individual layer is 'too translucent', 'stacking' them will lower the overall effect to something approaching 'good'.

    3. The 'width' of the surfaces also play a large role. Anisotropy, occlusion, shadows, etc are all going to be affected because instead of being calculated for something thin and long (strand) they are being calculated for something wide and flat (plane).

    All of that said, yes, there is massive room for improvement in shading transmapped hair...but I think it's going to need a custom (ShaderMixer/ShaderBuilder) network and not adapting any existing shaders to do it.

  • wowiewowie Posts: 2,029
    edited February 2014

    Here's a test render after some tweaking. I think I've managed to get translucence and standard diffuse quite close to each other. The most annoying thing I'm seeing is having the head shape visible with some angles. I'm using opacity color to allow light to bleed through the transmapped strands. So, it does affect the opacity.

    I've had some success multiplying the second layer diffuse so the strand doesn't look too transparent, but it does come with a performance penalty.

    HairTest2.png
    800 x 1040 - 1M
    Post edited by wowie on
  • mjc1016mjc1016 Posts: 15,001
    edited December 1969

    wowie said:
    The most annoying thing I'm seeing is having the head shape visible with some angles. I'm using opacity color to allow light to bleed through the transmapped strands.

    I think that's a good example of what I was saying about not enough layers. You've got only a couple there, while if you had a curve based hair, you'd have at least 10x as many. And getting more transmapped layers WILL severely impact render times.

  • Testing6790Testing6790 Posts: 1,091
    edited December 1969

    I read the first couple pages and the most recent page, sorry if this has been said (I'm not reading 20 pages of forum just to be sure).

    The uber-environment preset called "Daylight" that came with the Church scene has become my go-to lighting preset. It's a moderately fast ray-tracing setup (my goal is always a happy medium between speed and quality) that comes out really clean. A little too grainy for realism, but since the discussion is on lighting in general that's OK. I suggest everyone trying it out.

  • mjc1016mjc1016 Posts: 15,001
    edited December 1969

    A little too grainy for realism, but since the discussion is on lighting in general that's OK. I suggest everyone trying it out.

    That's easily fixable by playing with the samples...but then there will be a render time hit.

  • wowiewowie Posts: 2,029
    edited February 2014

    This is a test with using the blend mask option at 50%. This method does help a bit with opacity problems. Haven't had the chance to tweak the colors so it would match the shade though. While it's not a perfect solution, it's a workable one. Takes about 5 minutes to render the hair. I would say you could get away with just having 2 or 3 layers of strands on top of each other. Or maybe add the same number of geometry shells so it would darken the area with AO.

    From last experience, rendering fibre mesh hair takes much longer (even though it's just very short hair).

    I do think all this trickery can be avoided with a shader especially made for hair though. One that can refract light (allowing some bleedthrough), while still honoring opacity settings. I guess you can also do it the other way around - bake the lights for each layer of strand. Probably will render a lot faster too.

    Hair4.png
    800 x 1040 - 1M
    Post edited by wowie on
  • mjc1016mjc1016 Posts: 15,001
    edited December 1969

    wowie said:
    From last experience, rendering fibre mesh hair takes much longer (even though it's just very short hair).

    Fibremesh...yes, a lot longer...it's 'geometry'. Curve based hair is NOT geometry and is done on the fly...what you see is the end result of the calculations of both the curves and the shader. It doesn't really 'exist' until rendered...and is MUCH faster to render than fibermesh and in many cases (although without raytracing, maybe not) than transmapped hair.

    The tests I did, back during the Garibaldi beta testing ran between 10 and 50% faster for Garibaldi hair...I know that this took less than an hour and any other 'hair' would take well over an hour, on my system. I don't have times on any others..and the other renders may be on the other hard drive, but there is one where I made a similar hairstyle to Koz-messy and it was always faster to render than the Koz-messy hair.

    Found one...this one rendered in a few minutes...maybe 15 max...

    hair208.jpg
    800 x 1000 - 338K
    skunk2.png
    800 x 1000 - 583K
  • wowiewowie Posts: 2,029
    edited December 1969

    Yes, adding more geometry, whether renderable or fantom is unavoidable. I do wish we have more flexibility with geometry instancing though. For instance, for hair I would like to use maybe just two or three strands which then can be instanced to populate the skull cap. Correct me if I'm wrong, but right now there's no way to make a hair figure with such methods.

    The closest I've gotten into such a model was a smartpropped one. Basically a dummy node with child nodes referencing the same geometry. I wonder if it's possible to use geografting for that instead? Have a skull cap or a basic hair volume/shape and have strands as geografted items. Hmm, it might work but I won't know for sure until I try. It should also give me more flexibility like adding bones so the strand can be posed. It will not be the same as dynamic hair, but it should be more flexible than the static hair we have now.

  • Mustakettu85Mustakettu85 Posts: 2,933
    edited December 1969

    wowie said:

    I think the technique can also be applied to transmapped hair. If I read the WIP notes correctly, it's using a combination of DSM lights, no AO, colored shadows and a gradient falloff. It's the gradient falloff that's stumping me.

    It's coloured shadows that should be stumping you first and foremost. Because you'd want the light that casts coloured shadows to only see hair. And it means that right now you are limited to using AoA's spotlights since these are the only directional lights that can understand flagging surfaces.

    On the other hand, you could try fiddling with opacity colours to get the shader to cast coloured shadows - we're using transmapping, so we're already in the "shader" hitmode and suffering increased render times, so coloured shadows should not add much. But it's tricky to get right overall. Here's a render of a sphere that has the same map applied to Diffuse Colour and Opacity Colour (not strength). You can see it casts shadows of inverted colour.

    Yes, adding more geometry, whether renderable or fantom is unavoidable. I do wish we have more flexibility with geometry instancing though. For instance, for hair I would like to use maybe just two or three strands which then can be instanced to populate the skull cap. Correct me if I'm wrong, but right now there's no way to make a hair figure with such methods.

    LAMH will instance whatever you want for you. I´ve seen people do feathers and flower fields.

    RiCurves are still the best option for human hair. I have both LAMH and Garibaldi, they provide comparable results in renders, but usability-wise... I really wish the guys behind them would unite and create a plugin that combines the strengths of both.

    diffusemap_opacitycolour.png
    618 x 800 - 682K
  • wowiewowie Posts: 2,029
    edited February 2014


    On the other hand, you could try fiddling with opacity colours to get the shader to cast coloured shadows - we're using transmapping, so we're already in the "shader" hitmode and suffering increased render times, so coloured shadows should not add much. But it's tricky to get right overall. Here's a render of a sphere that has the same map applied to Diffuse Colour and Opacity Colour (not strength). You can see it casts shadows of inverted colour.

    Already did this in the examples above - using opacity colors to let some bleedthrough (you don't need to plug in the texture). I generally found values below 240 will create too much transparency. For example, in the latest version, I'm using something like 240/245/250 to get a slightly reddish bleedthrough.

    I think what we need is a shader that decouples opacity and refraction. That way you can maintain opacity (so the hair will honor transparency maps) but can still let some bleedthrough. In combination with properly layered hair model and a skull cap that's painted properly, we could end up with much more convincing model.

    Post edited by wowie on
  • mjc1016mjc1016 Posts: 15,001
    edited December 1969

    What features are wanted/needed in a shader specifically made for transmapped hair...

    Anisotropy, fresnel, translucency, diffuse...all obvious.

  • Mustakettu85Mustakettu85 Posts: 2,933
    edited December 1969

    wowie said:

    I think what we need is a shader that decouples opacity and refraction.

    We do, true, and not just for hair. It just does not make that much sense otherwise. I linked a good PRMan article that deals with this very concept a few posts above, in the one with my glassy-bunny render.

    I'll see what I can come with through Shader Mixer. It may not be the fastest shader ever, but at least it is relatively easy to make, and it's user-editable. Give me a few more days, though, I'm busy with real life stuff right now.


    What features are wanted/needed in a shader specifically made for transmapped hair...

    Anisotropy, fresnel, translucency, diffuse...all obvious.

    Re: anisotropy, I noticed (on non-hair objects) that a high enough bump will alleviate the need for anisotropy emulated within the shader. The grooves on the bump map do their job, as they would IRL. But that was with a glossiness lower that I'm normally using for hair...

  • mjc1016mjc1016 Posts: 15,001
    edited December 1969


    mjc1016 said:
    What features are wanted/needed in a shader specifically made for transmapped hair...

    Anisotropy, fresnel, translucency, diffuse...all obvious.

    Re: anisotropy, I noticed (on non-hair objects) that a high enough bump will alleviate the need for anisotropy emulated within the shader. The grooves on the bump map do their job, as they would IRL. But that was with a glossiness lower that I'm normally using for hair...

    Yes...but I've noticed that the quality of most bump/displacement maps (if any) for hair don't lend themselves to being pushed high enough to work that way. Most maps for hair tend really mess up on higher values...

  • Mustakettu85Mustakettu85 Posts: 2,933
    edited December 1969

    mjc1016 said:

    Yes...but I've noticed that the quality of most bump/displacement maps (if any) for hair don't lend themselves to being pushed high enough to work that way. Most maps for hair tend really mess up on higher values...

    Unfortunately it's also true. I think I edit maps a lot, and often there are no bump maps at all... so, hi-passing and curves and all that stuff.

  • RAMWolffRAMWolff Posts: 10,146
    edited December 1969

    Displacements for hair should be done with more gray to black with just touches of white here and there. I've gotten some great results using maps like that. I tend to use the same map for the bump map to keep things traveling along the same rhythm!

  • mjc1016mjc1016 Posts: 15,001
    edited February 2014

    I think the actual problem with the bump/displacement maps for hair is the bit count...I think most of them are low bit greyscale. There's just not enough 'detail' there for them to work well.

    Hair is subtle, unless you are talking about something like Einstein's hair or something like that. It's very fine and moves displaces along the length, so 'smoothness' of the gradients is very important...and low bit greyscale just aren't that smooth.

    Post edited by mjc1016 on
  • wowiewowie Posts: 2,029
    edited February 2014

    I tried using the LAMH player and one of the preset available on the website. Since I couldn't find a preset made for G2F, I used one for Genesis (Genesis-FemalePartedHair).

    Using my light setup and US2 snaders, the LAMH hair preset is taking way too much time (around 13 minutes or so). That's an automatic fail for me. For comparison's sake, the same light/shader setup with the EoS hair takes about 4 minutes at most at the same distance (head/neck/uppermost torso visible). Toulouse hair which is about the same length and less complex takes about 2 minutes (render times are just for the hair alone).

    I played around with the hair quantity settings (I was using the Human - Light Blonde preset = 160000) and adjusted it to something like 1/10, but render time was generally the same as the Toulouse hair (around 2 minutes). The problem is at those settings, I can still see the head's silhouette that shouldn't be visible with a strong backlight. Hair quantity needs to be something around 60K to effectively block bleedthrough. At those settings, render time is about 5 to 6 minutes (5 min 45 sec to be exact) without opacity and about 7 minutes (6 min 50 sec) with opacity.

    Haven't tried Garibaldi yet, but I don't think it will be any different.

    60KBleed.jpg
    800 x 1040 - 154K
    60K.jpg
    800 x 1040 - 155K
    16K.jpg
    800 x 1040 - 157K
    Post edited by wowie on
  • Mustakettu85Mustakettu85 Posts: 2,933
    edited February 2014

    wowie said:

    Using my light setup and US2 snaders, the LAMH hair preset is taking way too much time (around 13 minutes or so).


    Have you tried shaders that are supplied with LAMH? I think they render faster.

    RAMWolff said:
    Displacements for hair should be done with more gray to black with just touches of white here and there. I've gotten some great results using maps like that. I tend to use the same map for the bump map to keep things traveling along the same rhythm!

    To tell the truth, I could never understand the reasons for using the same map for bump and displacement. Displacement is a costly operation, especially if you raytrace after displacing. Bump is almost free.

    The way I see it (and the way most documentation to modeling packages advises), one would best use displacement for actual _geometric_detail_ (the kind that should noticeably distort the silhouette of your mesh), and bump for texture relief that is so small it does not change the profile.

    I.e. individual hairs should be modeled with a bump; groups of hairs (locks? strands? my English fails me) would be displaced from the underlying flat mesh.

    Does it make any sense? I would've painted an example, but I just don't have the time right now... =(((

    I think the actual problem with the bump/displacement maps for hair is the bit count...I think most of them are low bit greyscale.

    Yup, 8bit (256 level) greyscale is something that is to be avoided... For the reasons you describe, and also because if you stick an 8bit map into a colour channel (like, specular colour), it will interpret white as red.


    ____________________________________________

    Ooookay now, I made a special shader mixer network, but I'm not really happy with it. Mostly because of stuff I cannot fix: the Translucence mixer brick is fairly unpredictable, and anisotropic specular functions keep generating checkerboard artefacts. It's possible to do without anisotropy when using a good bump map, but either way, since the only thing that would make this shader truly different would be raytype-informed opacity, I think there is a better way to get those coloured shadows that do not mess with the rest of the material, and that's retaining all the familiar features of UberSurface.

    I suggest turning "cast shadows" off for the hair, creating a geometry shell to cast shadows (with the offset of 0) and applying the following simple network to the shell materials (see attached image).

    It is transparent for camera rays, so there's no worry about it occupying the same geometric space as the hair (otherwise it would generate artefacts).

    The downside to this method is that it will only cast raytraced shadows (since deep shadow maps are generated through temp cameras). However, the original shader network I made does not cast coloured DSMs either (because it relies on "transmission" raytype check; I have not yet figured out if it's possible to distinguish between lightcameras and normal cameras in RSL...). If anyone wants that network, I will upload it, free for any use. It has a funny "fake scatter" which is like ambient modified by edgeblend.

    Here's a series of comparison renders - a simple hair with UberSurface, same hair with shadows off, and same hair with a geometry shell casting coloured shadows (the lighting looks a little different because I switched to raytraced shadows for the final one). The UberSurface translucency (responding to backlighting) in my renders is the same throughout, which means it can be dialed down when using this trick.

    No render times given because I was doing this on a 32bit system, so this won't be a valid benchmark.

    PS Test renders do not use any occlusion, only several spotlights; GC on, gamma 2.2. The character is FW Danika, BTW.

    FWDanika_Toulouse_Compare.jpg
    1344 x 640 - 212K
    SimpleShadowFaker.png
    1116 x 641 - 65K
    Post edited by Mustakettu85 on
  • wowiewowie Posts: 2,029
    edited February 2014

    Which shader? I believe there's four of them.
    Standard shader - 7 min
    Advanced shader - 7 min 30 sec
    Ambient Occlusion - 2 min 56 sec
    Human Hair shader - above 7 min

    I think the only way you could render it faster is by using the AO shader and use darker root colors with lighter tip/body colors. Basically, you have a gradient falloff from the tip to the root. But I don't think you'll have translucence unless you're willing to tweak/edit the shader.

    You could probably tune the hair model so it would have thinner strands near the hairline and progressively thicker into the hair mass. But that has its own tradeoffs.

    So for me, transmapped hair still is the best option to go. I just wish they make better hair models/textures.

    HH.jpg
    800 x 1040 - 251K
    AO.jpg
    800 x 1040 - 168K
    Adv.jpg
    800 x 1040 - 243K
    Std.jpg
    800 x 1040 - 182K
    Post edited by wowie on
  • JonnyRayJonnyRay Posts: 1,744
    edited December 1969

    If anyone is interested in getting into the very technical world of hair shaders, I've recently added an article in my blog where I identify some of the best (in my opinion) research papers on the topic.

    Hair Rendering - Current State of the Art

    I've been doing research for a new DAZ Studio shader specifically designed for transparency mapped hair. Since I had to follow all sorts of links and leads (and Google searches), I thought I'd try to capture some of the best information for anyone else who is interested in the topic.

    A little warning, though, the math involved in this makes subsurface scattering seem trivial!

  • mjc1016mjc1016 Posts: 15,001
    edited December 1969

    JonnyRay said:
    A little warning, though, the math involved in this makes subsurface scattering seem trivial!

    I'm not sure, but maybe it makes the first Moon shot seem trivial, too...

  • JonnyRayJonnyRay Posts: 1,744
    edited December 1969

    mjc1016 said:
    JonnyRay said:
    A little warning, though, the math involved in this makes subsurface scattering seem trivial!

    I'm not sure, but maybe it makes the first Moon shot seem trivial, too...Hehehe. You might be right. My daughter (age 5) and I have been watching Discovery's "When we left Earth" mini-series. It blows me away with how many things they did and admitted "We weren't sure what was going to happen."

    I won't lie. It took me between 2 and 3 weeks until I even understood the symbols and figures they use to document their equations well enough to begin to understand what they were trying to do in them.

  • mjc1016mjc1016 Posts: 15,001
    edited December 1969

    JonnyRay said:
    I won't lie. It took me between 2 and 3 weeks until I even understood the symbols and figures they use to document their equations well enough to begin to understand what they were trying to do in them.

    25 yrs ago, it probably would have been a few hours reading...now, I'm with you...a couple of weeks to read/understand it. What's weird is even though I've forgotten most of that, there's the occasional thing the pops up out of the blue.

    I've got bits and pieces, some working and most not of various hair shaders I've worked on over the years...I should probably dust them off and re-examine them again.

  • wowiewowie Posts: 2,029
    edited February 2014

    Found this also.
    http://eprints.ru.ac.za/131/

    I like it since it doesn't only cover shaders, but also how to model the hair.


    I suggest turning "cast shadows" off for the hair, creating a geometry shell to cast shadows (with the offset of 0) and applying the following simple network to the shell materials (see attached image).

    It is transparent for camera rays, so there's no worry about it occupying the same geometric space as the hair (otherwise it would generate artefacts).

    The downside to this method is that it will only cast raytraced shadows (since deep shadow maps are generated through temp cameras). However, the original shader network I made does not cast coloured DSMs either (because it relies on "transmission" raytype check; I have not yet figured out if it's possible to distinguish between lightcameras and normal cameras in RSL...). If anyone wants that network, I will upload it, free for any use. It has a funny "fake scatter" which is like ambient modified by edgeblend.

    Ah that's quite a creative and clever solution. Why haven't I thought of that before? So, the technique basically separates the shadow pass for the hair by way of the geometry shell and retains the opacity of the original hair model. Thanks.

    I did some experiment to try and mimic something similar with my setup. You still need to make a geometry shell (or conform another copy of the hair model) then use Ubersurface or Ubersurface2 on it. Turn off everything except the opacity controls (color, strength) so you can have colored shadows. You do need to put the hair's opacity maps in the opacity strength slot(s). Don't forget to turn on fantom and turn off accept shadows.

    Render times are about the same, but you can see the technique allows the original hair to retain opacity. There are some differences when viewed from the shadowed side because I enabled occlusion on the shell and not the hair. If occlusion is enabled on the hair, it looks very similar.

    OriginalplusShell3.jpg
    800 x 1040 - 179K
    Original2.jpg
    800 x 1040 - 170K
    OriginalplusShell.jpg
    800 x 1040 - 179K
    Original.jpg
    800 x 1040 - 188K
    Post edited by wowie on
  • Mustakettu85Mustakettu85 Posts: 2,933
    edited December 1969

    wowie said:

    Ah that's quite a creative and clever solution. Why haven't I thought of that before? So, the technique basically separates the shadow pass for the hair by way of the geometry shell and retains the opacity of the original hair model. Thanks.

    You're welcome!

    That's some cool results you're getting with the hair, what is this model?

    And as for hair textures, here's an old 3DUniverse tutorial for generating useful procedural maps: http://www.3duniverse.co.za/articles/?Creating-Hair-Textures-in-Photoshop

    If you skip the fake highlight gradient and do something else like a linear gradient from "roots" to "tips", it can make for interesting effects. It can be further combined with photo-based maps, etc.

    I also often make noise-based textures to enhance or replace bump maps: first, generate greyscale noise in your image editor, then motion-blur it with a long distance (around 200 pixel) and an angle that is close to 90 degrees but not exactly (88 degrees).

  • wowiewowie Posts: 2,029
    edited February 2014


    That's some cool results you're getting with the hair, what is this model?

    It's the End of Summer hair. The same hair long hair I used on earlier shots.


    If you skip the fake highlight gradient and do something else like a linear gradient from "roots" to "tips", it can make for interesting effects. It can be further combined with photo-based maps, etc.

    I also often make noise-based textures to enhance or replace bump maps: first, generate greyscale noise in your image editor, then motion-blur it with a long distance (around 200 pixel) and an angle that is close to 90 degrees but not exactly (88 degrees).

    I was thinking in the same lines for the gradient fall off. Just take the opacity maps, add a layer with the gradient. slot it in the diffuse strength channel and you're done. It's not as cool as (or as flexible) as doing it via the shaders, but it can work. You can also fake or bake AO that way, though the results will likely be different than actually doing it.

    Btw, I also found that with your technique, you can use the opacity controls not just to control shadows (intensity and color) but also the amount of AO as well (if you use occlusion on the shell).

    Post edited by wowie on
  • j cadej cade Posts: 2,310
    edited December 1969

    This seems like the best place to post this. I too am trying to make a better hair shader. I am attempting to use anisotropic highlights by setting the daz default block to glossy metallic. The bad news is it seems dependent on the resolution of the mesh. Now, you would think I should be able to subdivide the mesh and be happy; however, this only seems to work on basic objects. If I take a sphere, or the like, and turn on subdivision, it works perfectly. I take a hair mesh, however, and no matter what I do I get ugly squares.

    I would understand if it were always bound to basemesh resolution. I would be sad, but I would understand. As it is, I am very perplexed right now.

    example.png
    1070 x 707 - 539K
  • mjc1016mjc1016 Posts: 15,001
    edited December 1969

    Kamion99 said:
    This seems like the best place to post this. I too am trying to make a better hair shader. I am attempting to use anisotropic highlights by setting the daz default block to glossy metallic. The bad news is it seems dependent on the resolution of the mesh. Now, you would think I should be able to subdivide the mesh and be happy; however, this only seems to work on basic objects. If I take a sphere, or the like, and turn on subdivision, it works perfectly. I take a hair mesh, however, and no matter what I do I get ugly squares.

    I would understand if it were always bound to basemesh resolution. I would be sad, but I would understand. As it is, I am very perplexed right now.

    One of the problems with transmapped hair...it's ancient. Very little progress has been done with the basic underlying method, let alone how the mesh is built. For things an anisotropic highlights, UV mapping is everything. And most hair meshes have poor mapping. Yeah, it's good enough to show a texture map without too much distortion, but that's about it. This is because most of them still use baked highlights, that don't need to be concerned with making sure the planes that make up the 'hair' are actually mapped optimally. In fact, on many hair meshes, optimal mapping for shader/lighting generated effects would make texture mapping more difficult.

    I think part of the problem we are running into is the fact that a very large percentage of the hair meshes are just not made to be able to do anything but use a 'standard' surface shader and supplied texture maps. I believe in many cases, attempting to use anything else ends up making things worse.

  • j cadej cade Posts: 2,310
    edited December 1969

    It's not UVmapping here though. that sphere on the left isn't mapped at all. I was testing whether daz primitives had any hidden settings or such that could effect how it was rendering. That sphere was imported from blender and subdivided, but it has no UV maps whatsoever.

Sign In or Register to comment.