specular reflection from eyes

If your topic doesn't fit anywhere else, put it here.

Moderator: joepal

specular reflection from eyes

Postby blindsaypatten » Fri Jun 09, 2017 4:31 pm

Right now it seems like the default behavior of eyes is a little different than I would expect. I think that the physical properties are that the outer surface is wet and therefore glossy and transparent, while the inner layer is diffuse. When I edit the object to assign two different materials with those properties the result looks good to me. I don't think one should see specular reflections from the underlying eyeball/iris. I believe that MakeClothes is limited to one material per object, but I don't know if MakeHuman has that limit. If not, would it make sense to assign two materials as the default? If it has a one material limit could a specular image be used to make the outer surface glossy/shiny and the inner surface rough/non-glossy/unshiny?

Only tangentially related to this, and offered in hopes that it will be of use to other people who don't already know about it, glossy surfaces tend to spawn fireflies so when I made the eyes glossy I started getting fireflies around the eyes. In the Light Paths section of the Render properties there is a Filter gloss setting and increasing it from 0 to 0.5 banished the fireflies from my particular render anyway. This is a tip I saw in a Blender Guru tutorial.
blindsaypatten
 
Posts: 586
Joined: Tue Mar 14, 2017 11:16 pm

Re: specular reflection from eyes

Postby joepal » Fri Jun 09, 2017 5:05 pm

MH is limited to one material per item. However, there is theoretical support for glossymaps, which I guess could be used to assign different glossiness to the outer and inner surfaces. I did, however, not check if MHX2 supports or takes heed of this.
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 4625
Joined: Wed Jun 04, 2008 11:20 am

Re: specular reflection from eyes

Postby punkduck » Fri Jun 09, 2017 7:56 pm

blindsaypatten wrote:Right now it seems like the default behavior of eyes is a little different than I would expect. I think that the physical properties are that the outer surface is wet and therefore glossy and transparent, while the inner layer is diffuse. When I edit the object to assign two different materials with those properties the result looks good to me. I don't think one should see specular reflections from the underlying eyeball/iris. I believe that MakeClothes is limited to one material per object, but I don't know if MakeHuman has that limit. If not, would it make sense to assign two materials as the default? If it has a one material limit could a specular image be used to make the outer surface glossy/shiny and the inner surface rough/non-glossy/unshiny?

Only tangentially related to this, and offered in hopes that it will be of use to other people who don't already know about it, glossy surfaces tend to spawn fireflies so when I made the eyes glossy I started getting fireflies around the eyes. In the Light Paths section of the Render properties there is a Filter gloss setting and increasing it from 0 to 0.5 banished the fireflies from my particular render anyway. This is a tip I saw in a Blender Guru tutorial.


First: there is a way to create an eye material with only one material. Aranuvir combined the original setup and combined it with my setup. I got this as a PM:

http://www.makehumancommunity.org/forum/download/file.php?id=4683&mode=view

We had a discussion about a way to assign this material to the eyes. Aranuvir thought of a "material_type" included in the mhx2 export and as a keyword in the .mhmat file. A specific shader combination should be assigned in Blender to this type. Since mhx2 is a Makehuman => Blender exchange format there is no problem of doing something like a material list. But how many elements should we create? When I look at "my" clothes there are not too many. Even the more complicate ones like the setup of skirt with no normalmap on the inside may be a own material_type. Should we create one procedure per material? Should this procedure get parameters again, like

material_type eyeballs <glossiness>

We always forget: there are other programs using our characters. I asked Aranuvir about a kind of "meta format" as a common denominator (I don't know one, even in Blender there are two standard methods, Blender render and Cycles) for the shaders. And last not least the offering of all maps in the material editor is something like a meta format. I know, that not all maps are implemented in the import into Blender. And the real gurus will then ask for PBR shaders.

When we want to use more than one material, how should we do it? The .obj file (wavefront-format) normally might give us a

usemtl <string Material_Name>

(see https://en.wikipedia.org/wiki/Wavefront_.obj_file)

and all the following faces will be of this material. Should we use the MTL format to assign the faces? When we load this data, this information must be kept in MH and appended to the different exports and we have to implement a method to display these materials in Makehuman also. MTL format gives us a list of possibilities but we are limited to the openGL Standard, I don't know if everything is available. MH cannot use the CPU to create the material when you rotate the character unless you want to wait 10 minutes per frame ...

It is a lot of experimenting until I give my assets to the user contributions. You know, that the import of a new created asset always looks weird in MH when you import the material the first time. To explain all the dependencies for a piece of cloth only using a single material is not simple. When we have a method with multiple materials only experts will be able to create clothes :shock:

I'm still looking for good ideas to solve this problem without "killing" half of the concept of MH ... but even then the answer from the "core team" might be that this will not be the purpose of MH. As far as I understood the main aspects in near future are "maintenance work", the software should use the Qt5 and python v3.

joepal wrote:However, there is theoretical support for glossymaps, which I guess could be used to assign different glossiness to the outer and inner surfaces. I did, however, not check if MHX2 supports or takes heed of this.


The specular map is supported, see topic about Nate's Hair from Lindsay ;)

http://www.makehumancommunity.org/forum/download/file.php?id=4644&mode=view

For the eyes the specular map is dark grey (or even black) with a small white circle in the bottom right edge (see diffuse map). :D I've never tried it that way, but it should work also.
User avatar
punkduck
 
Posts: 1260
Joined: Mon Oct 17, 2016 7:24 pm
Location: Nuremberg, Germany

Re: specular reflection from eyes

Postby blindsaypatten » Fri Jun 09, 2017 11:59 pm

I probably need to read PunkDuck's response a few more times to really comprehend it but I did some experimentation and will give the results.
1) As PunkDuck noted, specular map images are supported and appropriate nodes are created when imported, for cycles anyway, I didn't look at BI
2) The node network is slightly off. It mixes Gloss and Diffuse first and then the mix is mixed with transparent using the alpha channel from the diffuse image.
If the diffuse image is fully transparent then no diffuse (correct) and no gloss (incorrect) is output. The alpha channel of the diffuse texture doesn't affect gloss so it should be the factor for a transparent and diffuse mix with the resulting mix then mixed with the gloss.

This image will prevent gloss on the inner surface but allow it on the outer surface, and will work if the mixing is reordered as described above:
specular_map.png
specular_map.png (3.55 KiB) Viewed 5697 times


Here's the resulting render:
EyesWithSpecularImage.png


But that's with a constant factor for the gloss mix node, I also discovered that using the Fresnel as the factor for mixing in gloss causes the corners of the eyes to go dark with side lighting, which I had previously thought was some sort of geometry problem:
DarkEyeCorners.png

Although, lower the IOR on the Fresnel from 1.45 to 1.2 gets rid of that.
blindsaypatten
 
Posts: 586
Joined: Tue Mar 14, 2017 11:16 pm

Re: specular reflection from eyes

Postby blindsaypatten » Sat Jun 10, 2017 5:10 pm

Here's a first draft replacement function for materials.py that fixes the transparency mixing issue I mentioned. It needs work on producing a tidier node graph.
The use of the Fresnel node for the gloss mix factor is problematic, it is difficult to avoid the sides of the eyes going dark and it somewhat kills the catch light effect. Using a constant value works much better, at least where eyes are concerned. I don't know if the Fresnel factor is just not appropriate for eyes or if there is some modeling problem. I rather suspect that using zero/black in the specular map isn't correct and is why the eyes appear quite dark. Probably what is really needed is a roughness map rather than or in addition to the specularity map, so that the outer surface can be very smooth and the internal surface rougher. I need to do more research.

<code deleted>

The code I posted was physically correct but screwed up things like polygon hair which have used transparency to achieve invisibility without actually removing specularity. A specular map would have to be added to all such assets to achieve that. The current built-in assets have incorrect physics because they rely on transparency to achieve invisibility without also setting specularity to zero.
blindsaypatten
 
Posts: 586
Joined: Tue Mar 14, 2017 11:16 pm


Return to General discussions about makehuman

Who is online

Users browsing this forum: No registered users and 2 guests