Source Filmmaker

Source Filmmaker

Greene Aug 2, 2017 @ 10:18pm
Adding EyeRefract to an Existing Model
So I hope somebody can give me guidance on what problem I'm facing.

So I have two similar .dmx models that were created for SFM and have proper eyeposing. However, one of them uses a simple $basetexture and $iris for the eyes:
Picture[imgur.com]
2B_Eye_L.vmt file:
"eyes" { //$basetexture "JawSFM/Nier Automata/2B/2B_Iris" $basetexture "JawSFM/Nier Automata/2B/2B_white" $iris "JawSFM/Nier Automata/2B/2B_Iris" }

And the other uses a EyeRefract shader that I like more:
Picture[imgur.com]
eyeball_l.vmt file:
"EyeRefract" { "$Iris" "models/tfa/nier/yorha/android/eye_d"// Iris color in RGB with cornea noise in A "$AmbientOcclTexture" "engine/eye-extra" // Ambient occlusion in RGB, A unused "$Envmap" "engine/eye-reflection-cubemap-"// Reflection environment map "$CorneaTexture" "engine/eye-cornea" // Special texture that has 2D cornea normal in RG and other data in BA "$EyeballRadius" "0.55"// Default 0.5 "$AmbientOcclColor" "[0.4 0.33 0.3]" // Default 0.33, 0.33, 0.33 "$Dilation" ".85" // Default 0.5 "$ParallaxStrength" "0.3" // Default 0.25 "$CorneaBumpStrength" "0.75" // Default 1.0 "$halflambert" "1" "$nodecal" "1" // These effects are only available in ps.2.0b and later "$RaytraceSphere" "1" // Default 1 - Enables raytracing in the pixel shader to make the eyeball look round "$SphereTexkillCombo" "1" // Default 1 - Enables killing pixels that don't ray-intersect the sphere }

Because both already have working eyeposing, I tried copying the EyeRefract settings from one model to the other (while changing the $Iris path to an appropriate path like: JawSFM/Nier Automata/2B/eye_d, after copying eye_d.vtf's file into the folder because I believe the QC files lists which folders/directories to search for materials).

However, when I did that, both eyes became shiny and black (I assume are the Iris) and smaller.

Picture[imgur.com]

So I modified the settings to get them looking more similar, which was done by primarily increasing eyeballradius and parallax strength to pull the 'whites' of the eye back. However, although it now looks comparable, eyeposing has broken for some reason. Regardless of where I move the viewTarget the Iris is stuck facing the camera/work camera that is facing it. Furthermore, the eye lost the 'gleam' of the original eye where you could see light reflected inside of the eye. So I'm certain that something else is wrong as well.

Updated .vmt file for 2B_Eye_L and 2B_Eye_R:
"EyeRefract" { "$Iris" "JawSFM/Nier Automata/2B/eye_d"// Iris color in RGB with cornea noise in A "$AmbientOcclTexture" "engine/eye-extra" // Ambient occlusion in RGB, A unused "$Envmap" "engine/eye-reflection-cubemap-"// Reflection environment map "$CorneaTexture" "engine/eye-cornea" // Special texture that has 2D cornea normal in RG and other data in BA "$EyeballRadius" "0.9"// Default 0.5 "$AmbientOcclColor" "[0.4 0.33 0.3]" // Default 0.33, 0.33, 0.33 "$Dilation" ".55" // Default 0.5 "$ParallaxStrength" "1." // Default 0.25 "$CorneaBumpStrength" "0.75" // Default 1.0 "$halflambert" "1" "$nodecal" "1" // These effects are only available in ps.2.0b and later "$RaytraceSphere" "1" // Default 1 - Enables raytracing in the pixel shader to make the eyeball look round "$SphereTexkillCombo" "1" // Default 1 - Enables killing pixels that don't ray-intersect the sphere }

Picture[imgur.com]

One thing of note is that in the original EyeRefract model, the eyes are small hemispheres, while the model I'm trying to change has spheres as the eyeballs.

The Original/Working EyeRefract Model I'm Copying[imgur.com]



The Original Eye Model I'm trying to Change[imgur.com] (the Iris is copied into the back of the sphere, but moves with viewTarget accordingly)

My Modififed Model's Eyes[imgur.com] which creepily stares into the Work Camera.

So if anyone has suggestions, I'd greatly appreciate any help or directions on how I can fix it. I'm using JawSFM's 2B model (normal cheap eyes), and TFA's 2B model (eyeRefract), which are available in Steam's Workshop, though I can upload any file/script if requested.

Here are the links, because if I'm asking for help, I want to make it easier to find things:

JawSFM


TFA
Last edited by Greene; Aug 2, 2017 @ 10:43pm
< >
Showing 1-12 of 12 comments
Zappy Aug 3, 2017 @ 3:40am 
What happens if you set $EyeballRadius back to 0.55, and $ParallaxStrength, $RaytraceSphere, and $SphereTexkillCombo to 0?
Greene Aug 3, 2017 @ 3:08pm 
Sorry for the long reply. Just got back from work. The eyeball went back to being a black sphere.

Front View[imgur.com]

Inside View[imgur.com]

The other eye is one I 'corrected' but ignores viewTarget and stares at the work camera.
Zappy Aug 3, 2017 @ 3:11pm 
Alright. Then what happens if you use the same material as before, except just with $ParallaxStrength set to 0?
Greene Aug 3, 2017 @ 3:18pm 
Inside View[imgur.com]

Set everything back to before, but with parallax strength it looks like it did before; big black orb (I assume is the black iris)?
Zappy Aug 3, 2017 @ 3:21pm 
What happens if you set $Dilation to 0? (The default, un-"stretched" value is 0.5, but the iris gets shrunk down with lower values.) Edit: While keeping $ParallaxStrength at 0 as well.
Last edited by Zappy; Aug 3, 2017 @ 3:27pm
Greene Aug 3, 2017 @ 3:29pm 
Inside View[imgur.com]

So using the settings from the last config you suggested (everything back to my OP attempt, except $ParallaxStrength to 0), WITH $Dilation set to 0, the blue iris separates from the black pupil, however there is no sclera (white part of eye).

However, one notable thing is that the black part of the eye is following the viewTarget, which I kept in the photo so you can see. So that's good!

Edit: Here's the current config, just so we're all on the same page
"EyeRefract" { "$Iris" "JawSFM/Nier Automata/2B/eye_d"// Iris color in RGB with cornea noise in A "$AmbientOcclTexture" "engine/eye-extra" // Ambient occlusion in RGB, A unused "$Envmap" "engine/eye-reflection-cubemap-"// Reflection environment map "$CorneaTexture" "engine/eye-cornea" // Special texture that has 2D cornea normal in RG and other data in BA "$EyeballRadius" "0.9"// Default 0.5 "$AmbientOcclColor" "[0.4 0.33 0.3]" // Default 0.33, 0.33, 0.33 "$Dilation" "0" // Default 0.5 "$ParallaxStrength" "0" // Default 0.25 "$CorneaBumpStrength" "0.75" // Default 1.0 "$halflambert" "1" "$nodecal" "1" // These effects are only available in ps.2.0b and later "$RaytraceSphere" "1" // Default 1 - Enables raytracing in the pixel shader to make the eyeball look round "$SphereTexkillCombo" "1" // Default 1 - Enables killing pixels that don't ray-intersect the sphere }
Last edited by Greene; Aug 3, 2017 @ 3:31pm
Zappy Aug 3, 2017 @ 3:34pm 
Alright. Good to know. One thing you should know is that the "Eyes" and the "EyeRefract" shaders don't use the same size for the UV map generation for the eyes. One of them is twice as wide and twice as tall as the other, which seems to be EyeRefract judging by this stuff.

So all I can suggest to do is to edit the iris texture to be twice as wide and twice as tall, without actually making the textured part of it bigger (so the textured part fills the middle 50% of the texture's width and height), with the eye white stretched around the new edges. Then you can try setting $Dilation to 0.5 again afterwards.
Last edited by Zappy; Aug 3, 2017 @ 3:35pm
Greene Aug 3, 2017 @ 3:52pm 
To be clear, that would mean this one?:

"$Iris" "JawSFM/Nier Automata/2B/eye_d"// Iris color in RGB with cornea noise in A

Is there a VTF editor that would be ideal to editing it? I tried using GIMP to expand the canvas sides and leaving the textured part the same size, like this[imgur.com], and it ended up like this[imgur.com]. (noting that I centeed the texture using the offset, and that the rest of the texture is now a transparent area because there are no layers there)

I know I must've did something stupid, the color's completely gone and everything.

Edit: In fact, when I "undo" what I did in GIMP, and reexported to VTF, it's still 'broken' and looks tan and white. Only when I replace the eye_d.vtf with the original one from the Steam Workshop does it go back to being a blue iris.

Edit2: The reason my last attempt led to a strangely tan-colored iris I think was because gimp, even with the VTF plugin interpreted the colors incorrect or something, and when I exported back to VTF kept the new color values. But it doesn't change that with a larger .VTF file, it fixes eyeposing and such.
Last edited by Greene; Aug 4, 2017 @ 11:07am
Greene Aug 4, 2017 @ 11:04am 
So does anyone else have any ideas on what I might be able to do? In regards to Zappy's suggestion, I used VTFEdit and converted my Iris file to JPEG, made the image twice as wide and tall while leaving the textured bit in the middle, and I'm unable to get eyeposing to work.

When I move $dilation back to 0.5, it turns back to a black orb. Any number higher than 0 for $parallaxstrength brings back the sclerea (whites of the eye) back but stops the eyeball from following viewTarget and just follows the workcamera.

Picture[imgur.com]

If there's anything else of note is that the original Iris from the model I'm trying to change is 512x512, and the eye_d iris of the working eyeRefrac tmodel that I'm trying to copy was ALSO 512x512 to begin with.

And the second thing of note that may be relevant is that the eyeball of the model I'm trying to change is a full sphere, while the working eyeRefract model I'm using has a hemisphere eyeball. Could it have something to do with that?
Last edited by Greene; Aug 4, 2017 @ 11:06am
Zappy Aug 4, 2017 @ 12:53pm 
Originally posted by Greene:
- I used VTFEdit and converted my Iris file to JPEG, -
Do not do that. JP(E)G images don't support alpha, which is a very important thing for iris textures. Instead, try doing a PNG export... and then don't use GIMP to edit it, because it either still does or in earlier versions used to consider anything with an alpha value of 0 to just be black, even though in this case it's important to keep it coloured.

As for the rest of the stuff you're encountering, I don't really know; I'm not used to change an eye from the Eyes shader to EyeRefract without having the source files of the model available.
Last edited by Zappy; Aug 4, 2017 @ 12:53pm
Greene Aug 4, 2017 @ 4:32pm 
I ended up using .bmp because converting to .png or .tga resulted in the same tan-colored iris. I edited it with paint.net, expanded it while keeping the textured bit in the middle, still the same.

When you're talking about the soruce files, do you mean things like the .qc files + files before decompiling?

Before I came here, I tried decompiling it with Crowbar to try and understand how they made eyeRefract work, but there were errors when I tried recompiling it. Hmmmm. In any case, does anyone else in the Steam Community have any suggestions?
Marco Skoll Aug 4, 2017 @ 5:03pm 
Originally posted by Greene:
Hmmmm. In any case, does anyone else in the Steam Community have any suggestions?
Not hugely. I have updated models from Eyes to EyeRefract before*, but I can't see the flaw in your process that would have broken eye-posing.

While SFM can do some slightly odd things if you try changing a material's shader mid session, it should reset when the program is restarted.

* Eyes has an odd bug when lights use constant or linear attenuation (which I use a lot), so I've had to update quite a few older models so that their eyes stop glowing!
< >
Showing 1-12 of 12 comments
Per page: 1530 50

Date Posted: Aug 2, 2017 @ 10:18pm
Posts: 12