Using the Unreal Engine eye shader with Daz characters?
jumaiy2016
Posts: 0
Has anyone been able to use the Eye shader and materials that come with the UE4 digital human sample, on a Daz character that they have brought into Unreal? I saw someone mention this as a tip on Youtube but I have no idea how I would use it on a Daz character when the eye is split up into different materials. Also I can't seem to find the actual static mesh for the eye in the Digital Human project. Many thanks
Comments
Hello. We got this working on the Daz To Unreal Discord.
I will post the solution here as well. I also updated some pictures and steps.
Remove the eyes in Daz Studio
In Daz Studio go to Tools - Geometry Editor
Right click on your character and choose: Geometry Selection -> Select by -> Face Groups -> lEye
Right click on your character again and choose: Geometry Selection -> Select by -> Face Groups -> rEye
Right click on your character a third time and choose: Geometry Editing -> Delete Selected Polygon(s)
Send to - Daz to Unreal as usual
The Digital Human project eyes are built into the head mesh so that won't work but the Content Examples project has a really good eye example.
You can find the Content Examples project in the Epic Games Launcher - Unreal Engine Learn Tab
Click the cloud icon to download and create a project from it.
Open the Content Examples Project. In the maps folder find and open the Character_Rendering Map.
Click on the SKM_Eye_00 mesh (Either in the Viewport or World Outliner)
In the Static Mesh panel click on the magnifying glass
This will bring you to where the eye static mesh is in your Content Browser
To Migrate the model and all its materials and textures into your project:
From the Content Browser right click on SKM_Eye_00
Mouse over Asset Actions then select Migrate
this will show you a list of item that will be migrated - Click OK
Browse to your game's project folder - click on your Content folder and click Select Folder
The eye mesh, materials, and textures can now be used in your game.
In your Character Blueprint
Select the character mesh either from the viewport or the component list in the upper left.
Drag the SKM_Eye_00 mesh into your blueprint.
In the details panel on the right: Find Sockets - Parent Socket
Click the little magnifying glass to get a list of bones and search for and select lEye
Scale and Rotate as needed
Re-Select the character mesh and do the same for the right eye - Parent to rEye of course :)
They say the eyes are the windows to the soul so if you still want to use the Daz textures that make your character unique you can do that too!
Find the textures you want to use. You can find them in:
Daz3DFiles\Runtime\Textures\DAZ\Characters\Genesis8\(CharacterName)
Note: Some character paths may be a bit different searching for *eye in the texture folder will pull up all of them.
I very much recommend copying the textures to another folder before editing so I don't risk making changes the original files.
Open the texture up in an image editor (I'm using Gimp)
Select just to the outside portion of the iris color
Copy selection and Create New from clipboard
Scale the new image down to 512x512
if the irises aren't already filled in use the color picker to get a color sample just inside the iris color (Usually black but might be slightly lighter)
Bucket fill that color (Set the threshold amount to control how much gets filled in)
Do a little cleanup with the pencil or paint tool
Export your new texture and import into your UE project
Back in your Character Blueprint:
With one of the SKM_Eyes selected go to the Materials section click on the little magnifying glass to find the Material Instance being used
Open the Material Instance. In the Texture Parameter Values find the IrisColor
From here you have a couple options
You could simply replace the IrisColor texture with your Daz iris texture
AND THEY ARE B-E-A-U-T-I-F-U-L-!!!
This would become the default texture everywhere that material instance is used.
Or, if you would like to be able to change the texture dynamically go into the Construction Script of your character Blueprint
Create a Dynamic Material Instance Node
Set the Parent material to M_Sparrow_EyeRefractive_Inst
You can either find it in the drop down menu, drag it in from the content browser and land it into that spot, or select it in the content browser and click the little arrow to the right.
Pull off from the Return Value and Promote to Variable
This will create a reference to the Dynamic Instance Material we are creating so we can use it later.
Next create a Set Texture Parameter Value node, put IrisColor as the Parameter Name, and pull off from Value and Promote to Variable
Name the Variable Iris Texture
Add a Set Material Node
From the Component tab in the upper left drag in SKM_Eye_00 and SKM_Eye_01 and connect them both to target
Connect from Set Eye MID variable to the Material pin on the Set Material node
Compile the Bluepinrt
Click back on the Iris Texture variable and set the texture you want to use.
In the list of variables on the left click the little eye icon to the right of Iris Texture to make the variable Public
Also check Instance Editable in the upper right.
Checking those two boxes will let you change the the texture for each instance of the Blueprint you place in the level.
In the Variable Details panel if you also check Expose on Spawn you will be able to set the texture when spawning your Blueprint into the level
Batch Crop and Resize textures
I like to use IrfanView for it's Capture/Screenshot and Batch Conversion/Rename features.
I have to admit I found it quite meta to be using IrfanView's Capture/Screenshot feature to capture screenshots of IrfanViews Batch Conversion/Rename features for this part of the tutorial.
We will start back in Gimp
With the rectangle slection tool still active and positioned arround the pupil as described above find the position and size on the left hand side.
In this case position is 317 and 2347 and the size is 1400 x 1400
In IrfanView gup to to file and select Batch Conversion/Rename
In the Batch conversion menu click Advanced
Put a check mark next to Crop and fill in the position and size you got from Gimp
Also make sure there is a check mark next to Resize and set the new texture size to 512 * 512 (higher or lower depending on your needs)
Click OK
Again, I would recommened copying your characters eyes to another folder to make sure you don't accidently write over the original files.
Once done go up to the top of the menu and set "Look in" to the folder where you copied those files.
If you click Use current ("Look at") folder then the new files will apear in the same folder. Or you can browse to select a different folder for the new files.
Click Options to set the naming format for these new files.
In this case we will use $N to reuse the old file name first then _512 to add the size of the new file to the old name
The result will be something like Darius8Eyes02D_1006_512.png
Click OK
Next click Add all to add all these files to the batch
Click Start Batch
When the batch is finished you can either click Exit Batch to close down IrfanView or Return to batch to make further adjustments or do some more.
Go back into gimp to fix the white space in the pupil like before and import into Unreal
Changing textures in game
To change texture in game their are a few methods. Here is one of those.
Go back into your Character Blueprint and create a Custom Event node
Change the name to something like Change Iris Color
Add a New Paramter Input
Set the Input Variable type to Texture and choose Object Reference
Name the variable Iris Texture
Go into the Construction Script and select all but the Construction Script node
Right click and Copy these nodes.
Paste them into your Event Graph and delete the Iris Texture variable
Connect the New Texture pin from the Change Iris Texture node to the Value input of the Set Texture Parameter Value node
Go back into the Construction Script and create a Change Iris Color node
Drag in the Iris_Texture variable from the left and connect to the New Texture input
This will execute the Change Iris Color - Custom Event you created in the Event Graph when the character is dragged into or changed in the level.
We will be using the Level Blueprint to make pressing the 1,2,3,4 keyboard keys change your character eye texture.
This setup could also be put into a player controller instead.
Go up to Blueprints and select Open Level Blueprint
We need a way for the Level Blueprint to know which of the characters in your scene to change
If the character is already in the scene click on them or select them in the World Outliner panel.
In the Level Blueprint right click and create a reference to your character
OR
you can spawn a new character into the scene then pull off from the Return Value and Promote to Variable
Name this variable Spawned_BP
Almost there!!!
Still in the Level Blueprint right click in the Event Graph and press the number one key
Under Keyboard Events click the number 1
Do the same for 2,3, and 4
Using either the Spawned_BP variable or the reference variable to the character in your scene you created earlier
Pull off the pin and create a Change Iris Color node
Pull off from the New Texture pin and Promote to Variable
Name the Variable New Iris Texture
Create four nodes to Set the New Iris Texture variable
Connect them to the Pressed output of the 1,2,3 and 4 nodes
In each of the Set New Iris Texture nodes change the texture to something different.
Now when playing the level if you press 1,2,3 or 4 the New Iris Texture variable will get set in your Level Blueprint and the Change Iris Texture Custom Even of your character will be called and the new texure will be applied.
@UpL8Rendering you are a legend. Thanks for taking the time to create this tutorial.
We were able to do an eye swap as we have a need to post process heads from Daz G3. Export as normal with out eyes into Unreal 4. Export from Unreal 4 the modified version with the renamed root to "root" Add a set of eye objects edited from one of the Paragon characters, We use Sparrow as it has a near perfect fit. and rig it to the G3 rig.. Select the character, rig and eyes and export to FBX. In Unreal 4 set the character imported to combine mesh and re import the mesh. Your character should now be combined with Unreal mapped eyes and you can use any of the Paragon eye materials, and I assume the MetaHuman as it "seems" to use the same material base.
Yet to be tested but it should work and I just need to find time to test the theory.
No reason Epic based eyes could not be imported into DS as a prop, added to the base character, and sent to Unreal 4.
The skin material used by MetaHuman on first look is also based on the realistic skin material used in the digital human project and swamping in G3-G8 textures might produce interesting results.
You're welcome. It was a question I had seen a few times so I thought it might make a good tutorial.
I have checked out a couple Paragon characters but not the MetaHuman stuff yet. Mixing and matching materials, textures, and parts would be very interesting. Please let us know how your experiments turn out.
Sorry to necro this thread, but the Character Rendering map in the Content Examples project has been removed. Does anybody know of any other way to use the Metahuman eyes on a Daz character? I know of the Epic Eyes Geometry github project, but that's only for G8/8.1. I'm looking to use Genesis 9 with metahuman eyes.