Sign in to follow this  
JCPalmer

Stranded Hair Update

Recommended Posts

Well, have published a test scene to experiment with hair color.  I have a question about what is the color shade , used by LineMesh, supposed to be doing with alpha?  Its use can actually give a good effect (try it with platinum blonde), but not knowing what it does makes me nervous.

This process seems to be close to working, but have come to the realization that the width of the lines is always the same # of pixels.  This means very far away, it can tend to look like shag carpet, due to the head being small.  When really close the scalp is very visible.

For the very close case, I suppose I could try using an emitted material in areas where you should not see the the skin.  Any thoughts?

Share this post


Link to post
Share on other sites

I guess I wondered what is it being mixed with.  Just did some experiments changing the scene clear color.  It had no effect.  Seems the mix color is white.

As far as ribbons, I did not see that ribbons had a width.  Even if it did, planes would look weird from different angle.  What might work is for every point received, create 3 vertices around it perpendicular to the next vertex.  Each strand would like an extruded triangle.

Technically, that would multiple the number of vertices by 3, matrix weights & indices, and vertex colors by 3, BUT could probably get away with the number of strands from the 30k (150k vertices).  5K strands are probably good.  Since there are no normals with vertex colors, it is going to be hard to see the edges of the triangles.  Even if you can, it would just look like more strands.

I need another beer. (At least I only would need to change the JS side, since all python passes is the points & list of strand lengths).  Time to do a repo commit of this.

Share this post


Link to post
Share on other sites

@JCPalmer : Nice Jeff. As for the close up view - a skull cap the same as hair colour, or maybe just a different material on the mesh where the hair is.

One day I must look at this QI closely and try and understand it :o

cheers, gryff :)

Share this post


Link to post
Share on other sites

@gryff:  That is my back up plan.  It reminds me of the spay hair product from a long time ago for sparse areas.  I saw a woman with it once.  It looked like paint.  I fear once you breech a certain distance, it is really going to suck.  In this setting,  the material would be too uniform without a lot of screwing around.

spray_hair_material.JPG.1647f0522055914a75060beba29ad140.JPG

 

Going to give the triangular spaghetti a try.  Going back to my original proof of concept scene.  No need to complicate things.

straightHairs.jpg.37e4c5ad7d89a5fd5f3bf8229d42340b.jpg

Share this post


Link to post
Share on other sites

Well made an attempt at triangular spaghetti.  While it might be obvious to someone that because I was sub-classing LinesMesh, that I would not get filled triangles, but not to me.  Also, the point of one strand is connected to the next.  Here is a picture of a 2 strand Hair mesh.  I made the triangles really "wide", for diagnostic purposes.

asTris.jpg.ebe2f631125157993ac65f7ac1e42b76.jpg

I tried switching to sub-classing from Mesh with a reasonable wide, no material, and vertex color.  It looks promising from a zoom standpoint.

asTrisFromMesh.jpg.9cde3cd1e0926120b64245e5c9e2cb6f.jpg

Here is the live scene. Performance of the first scene is destroyed.  It will not even load, so do not bother right now.  Many less strands would be required, and have not done that yet.  What I would like to know, it what do I need to do to the color.vertex.shader to get it to draw filled triangles not lines?  Do not want to use the default shader.  I could get specular with it, but way too slow.  The default shader has just so much stuff, finding anything is really tough.

Share this post


Link to post
Share on other sites

actually, I figured out why the original scene hung (1/2 a billion console log messages).  It looks weird from some angles due to going all white, but zoom looks great from this angle.  Number of strands could greatly be reduced.  Maybe could use default shader, but is all the white about?

59935aa39e344_headwithtris.thumb.jpg.0b432aafbbfa7258695847a809065236.jpg

Share this post


Link to post
Share on other sites

Update of the "update topic". I figured out what the "going all white" from a certain angle was.  I forgot that now that I was not doing lines, that I had to do normals.  Here is my latest committed snaphot, same url as above.

I looks great in black & dark brown.  You can even move that "Color Spread" slider to zero, and it almost looks photo realistic from ANY distance.  That slider was for inter-strand variation.  Back when things were just lines, rather than triangular spaghetti, a slight random difference of the root segment of each strand was needed.  There is also a very subtle spread of each strand segment that there was no slider for. If I get rid of inter-strand variation, could switch what that slider doe to the intra-strand variation.

Now the new PROBLEM.  The lighter colors have all this black running through them.  The triangular spaghetti produces very stark normals.  Any ideas?????  The 2 I am going to try are:

  • Add a material with an emissive color. (Not my preferred method)
  • Calculate the normals, then try to throttle them towards either towards -0.5 or 0.5.  The overall values for the colors might need to be brightened (fixable), but I actually do not want the geometry to noticeable, so coming up with weird ass normals that get me photo realistic on the cheap is ok by me.

Share this post


Link to post
Share on other sites

Well goofing with normals just made a mess.  But thinking about adding a material with emissive, having no material just uses the default material, so no extra harm in overriding it.  I add a material with only emissive (no specular / diffuse / ambient).  The color I use is 0.8 * of the base color selected.  Works really good.  White & Platinum Blonde were just too bright though, so I backed the values for those down a little.  I also put a ceiling on a component value of the emissive to be a max of 0.5.

This is starting to look production worthy.  Definitely defaulting the inter-strand color spread to 0.  Wondering if I even need the intra-strand spread.  Am going to test that tomorrow.

Share this post


Link to post
Share on other sites
12 minutes ago, JCPalmer said:

Wondering if I even need the intra-strand spread

@JCPalmer :

Well Jeff it does allow for the adding of er ... " platinum, glitter, wisdom  or stress highlights"... that us old folk get :o

cheers, gryff :)

Share this post


Link to post
Share on other sites

Looks like both intra * inter are both public properties, so probably not a problem just keeping them.  I have set the defaults to zero, though.  I have not exposed intra yet in the scene with a slider of it own, but I loaded a version of the scene before & one after intra set to zero for side by side. @gryff, these 2 shots of "Light Brown" first with intra at 0.02, and second at zero.  There is green in some of the strands.

withIntra.thumb.jpg.ccf6b7bd7fdd542b79e4abb7c97e4b02.jpgwithoutIntra.thumb.jpg.f0e544321a0ace1884a74c99f12da635.jpg

The definition of what these 2 spreads is different.  Going to have to look at changing how intra is implemented.  Stay tuned.  FYI, since the values for the channel of the emissive color are maxed at 0.5, I increased the color to be 95% of the reference color from 80% as well.  I thought it would lighten, but looks like the opposite happened.  Still looks richer.

Share this post


Link to post
Share on other sites

@JCPalmer : Well I watch with interest Jeff. I just tweaked the color spread slider - which did not seem to differentiate between intra/inter to the casual observer.

Mind you, can you produce something like this:

Hair Streaks

As I walk around downtown I see that there are many young ladies into that type of hair coloring :o

cheers, gryff :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.