Garry's Mod

Garry's Mod

29 ratings
EyeReflact Shader [ENG]
By Thousand Shells
Valve Developer Community EyeReflact Wiki

This article is about the shader. For the preceding shader, see Eyes. For the QC property of $model, see Eyeball. For the tool, see qc_eyes.
EyeRefract (DX9+) is a material shader available in all Source Source games since <Source><Source> Source 2007 . It is used to create realistic eyes, which are affected by map lighting and dynamic lighting, such as those from flashlights. This shader is a successor to the Eyes shader from Half-Life 2 Half-Life 2 .

My Contacts:
   
Award
Favorite
Favorited
Unfavorite
❒ Introduction
Good afternoon, gentlemen, today I want to teach novice fashion designers and all those who manipulate models to create an EyeReflact shader
And so, to begin with, you need a number of such programs as:

• 1 [Blender] - A program for manipulating the model
• 2 [Blender Source Tools] - Extension for Blender.[steamreview.org]
• 3 [Crowbar] - Decompilation of the model and compilation.
• 4 [VtfEdit] - VMT and vtf editing software.[gamebanana.com]
Most importantly, you should have a basic understanding of the Blender program, then how to install this or that extension can be found on the Internet
⚑ Separating the model from the main mesh
  1. Step One : Go to "Edit Mode*"
  2. Step two : With the shift , select all the vertices of the eye, or use the L button on the mesh *.
  3. Step Three : After selecting all the vertices, press the P button and select the "Selection" punt
  4. Step Four : Create a collection and transfer our eyes there.

*Selection of all meshes via L does not work with all models, and therefore in this case you will have to manually select vertices.
.• Creating UV scans and eye textures.
  • Step One - Go to the section "UV Editing".
  • Step Two - By pressing the Tab button, go to Edit Mode.
  • Step Three - Select the eye mesh, in the left window click RCM->Unwarp.


  • Step Four - Go to the tab at the bottom right "Materials Propertites"
  • Step Five- Click on + you should have a new material created.
  • Step Six - Name your material "eye_l" and click "Assign"

    Do the same procedure with the second eye and name the texture "eye_r"
ϟ Prescribing eye coordinates in QC
Open your QC file with the model and add the data :
$Model "eye" "head.smd" { eyeball "eye_right" "ValveBiped.Bip01_Head1" -1.4171 -2.87923 69.771 "eye_r" 1 4 "iris_unused" 0.63 eyeball "eye_left" "ValveBiped.Bip01_Head1" 1.3872 -3.05434 69.7716 "eye_l" 1 -4 "iris_unused" 0.63 flexcontroller eyes range -25 25 eyes_rightleft flexcontroller eyes range -2 2 eyes_updown }
Explanation of lines of code:
  • "eye" is the name of the mesh displayed when compiling the model.
  • "head.smd" is your eye reference name.
  • "eye_right" - Names for QC.
  • "eye_left" - Names for QC.
  • "ValveBiped.Bip01_Head1" - the bone to which the weight of the mesh is tied.
  • -1.4171 -2.87923 69.771 - Coordinates of the location of the left eye.
  • 1.3872 -3.05434 69.7716 - Coordinates of the location of the right eye.
  • "eye_r" and "eye_l" are the names of vmt eye texture files.
  • "iris_unused" - the shell of the eye
  • 0.63 - pupil size
  • flexcontroller eyes range -25 25 eyes_rightleft - Responsible for the range of eye movement.
  • flexcontroller eyes range -25 25 eyes_updown - Responsible for the range of eye movement.
● Step one: Go into the blender and select a point in the middle of the eye. ● Step two: Copy the X and Z coordinates, paste them instead of our old coordinates. ● Step Three: We select the edges of the eye mesh Y coordinates and paste them in the same way. ● Step Five: We compile our model.
◍ Editing Textures
  • Step One: Download the archive that I will attach from the bottom.
  • Step Two: Transfer all files from the archive to the folder with your model's materials
  • Step Three: Open the vmt file "eye_l" and "eye_r"
  • Step four: Write down the path to the texture files that you have uploaded.
  • Step Five: Save and go to Garry's Mod to check what happened.
Explanation of eye textures:
  • "$Iris" - The texture for the iris. The alpha channel controls the noisiness of the cornea.
  • "$AmbientOcclTexture" - An ambient occlusion texture overlaid onto the entire eye (be sure to adjust the iris scale of the Eyeball in the qc to make it fit) to make it appear darker near the borders. The texture is multiplicative (white changes nothing, black turns the result darker).
  • "$AmbientOcclColor" -Tints the $AmbientOcclTexture. Default "[0.33 0.33 0.33]".
  • "$CorneaTexture" - A texture to specify the shape of the cornea, similar to a normal map. Influences lighting and dilation. The red and green channels are used for the normal mapping, the blue channel is a mask for parallax mapping (straight multiply), and the alpha channel seems to be a multiplier for lighting. Because the $iris is warped in various ways the normals will not match 1-to-1 with the base texture.
  • "$Envmap" - Enables cubemap reflections. This shader has a specific cubemap made for it, engine/eye-reflection-cubemap-.vtf, but others can be used, including env_cubemap
  • "$EyeballRadius" - Requires $Raytracesphere 1. Radius of the eyeball. Should be the diameter of the eyeball divided by 2. Default 0.5.

  • "$Dilation" - Dilates the pupil using the cornea texture to determine the shape of dilation. Default 0.5.
  • "$ParallaxStrength" - How much the viewing angle should influence the positioning of the eye. Stronger values cause the iris to be smaller, but also move slower, making it seem "inset further". Default 0.25.
  • "$CorneaBumpStrength" - Strength of the $Corneatexture
  • "$Halflambert" - Enables half-lambertian lighting.
  • "$Nodecal" - Disabling the visibility of bullet holes.
  • "$RaytraceSphere" -Enables sphere raytracing. Each pixel is raytraced to allow sharper angles to look more accurate.
  • "$SphereTexkillCombo" - Requires $RaytraceSphere 1. Causes pixels which don't hit the raytraced sphere to be transparent, instead of rendering the "non-raytraced" eye behind it.
Eye materials and VMT files
[disk.yandex.ru]
✇ Additional files and thanks
A small gift from me : Large base of eye textures

GRATITUDE

★★★TheDizcordumSeventh - For mentoring and teaching everything I've learned. Thanks to this, I can share information with people and teach something new, as you did.
(THIS DOES NOT MEAN THAT HE NEEDS TO CLOG UP IN THE BOS WITH A REQUEST TO TEACH)

★★☆The Alium - For the help in the bath of re-salivations of unholy authors who re-salivate addons.

With love from Russia!
♡ Thank you for reading my guide! I hope I helped you and taught you something new!
♡ If you have a desire to help me financially - DonationAlerts [www.donationalerts.com]

5 Comments
GreatStuffGary 12 May, 2024 @ 6:11pm 
Does anyone know how to make the eyes not wash out the colors of the iris?
bobby 25 Jul, 2023 @ 10:13pm 
Nevermind, fixed it by enabling raytracesphere and setting eyeballradius.
bobby 25 Jul, 2023 @ 10:06pm 
Worked great for me, small problem though: The eyes always follow me in game, no matter what. They only stop when using the eye poser tool. Is there a way to stop this? It's eerie. Thanks.
hild my hind 26 Feb, 2022 @ 4:52pm 
nice :bar_buggy:
Thousand Shells  [author] 24 Feb, 2022 @ 11:58pm 
Important! Blinking is a Shape Key, which refers to facial posing, this is something I don't know how to do yet, but I think if I'm not too lazy, I'll learn and write another guide.