#3L Eye Material in Blender (eyes of ch4 skins and onward)

238 messages · Page 1 of 1 (latest)

dire badger
#

I currently have it set up as a single node group (duplicated) that has different outputs for the image UVs and then also for the final shader, I can separate them into 2 different node groups though if it'll make adding this easier (if you do add this, ofc)!

Also the groups share some values that are used for both UVs and actual shading stuff so they're connected at the bottom, so one side will follow this other (ofc, you can also just put the values in separately on each side so they don't need to connect to each other... hope that makes sense)

I can make any other changes if needed, I really just think it'd be nice to have this stuff built into FP

#

all the parameter names are the same as in-game btw!

knotty badger
dire badger
#

If you export the eye material of a skin as a .json in fmodel, it tells you all the values for these things

knotty badger
#

Ah ok ty!

dire badger
#

I think fn porting also will bring them into blender as RGB and Value nodes to the right of the output node, but it might not idk

knotty badger
#

Ty ill try both

dire badger
#

they show up here if there's anything specific you need to put in

#

(there's a few things that aren't implemented on the node group I made, but they don't really do much from what I've seen so it should be fine, mainly just emission refraction stuff I think)

#

But ye apart from that, just make sure you're using your skin's actual eye textures (obviously) as well and you should be all set

#

and you might wanna connect these in case you need to change any of these 4 values at the bottom (helps keep them consistent)

knotty badger
dire badger
#

yep

knotty badger
#

Lemme open fmodel real quick to get comets stuff

knotty badger
# dire badger yep

What one of these would have the values or both srry for asking so many things

dire badger
#

should be the first one!

#

just open it in notepad or something like that

#

you should alos be able to just open it in fmodel

knotty badger
#

Idek what im looking for in it

dire badger
#

lemme show, one sec

knotty badger
#

Thank you so much for the help

dire badger
#

ye np!

#

so you look for the ScalarParameterValues, and itll tell you the parameter and what you need to put in for the value

knotty badger
#

What about the tint color and those things?

dire badger
#

in this case you only need to worry about the first 2 on this material, idk what RefractionDepthBias is because it seems to always be 0

dire badger
dire badger
#

just leave everything else as default

#

for the most part, human eye materials shouldnt need to be changed much too look fine

#

just gotta plug the textures into the node group and you shuld be all set

dire badger
knotty badger
#

Ok

#

It also make a really big difference (first one is your 3L eye thing and second one is default fn porting)

dire badger
#

ayy nice

dire badger
#

(which is why i made it)

#

(so hopefully half adds it🙏🙏🙏)

knotty badger
dire badger
#

TY

knotty badger
#

I see there is no refratciondepthbias slot or im just blind

dire badger
#

it's not used so i didnt bother adding

#

i think it's always 0

#

so ye

knotty badger
#

It seems like it

dire badger
#

idek what it does anyways

knotty badger
dire badger
#

dw about that

#

thats for debugging

#

i think?

#

what skin are you doing?

knotty badger
dire badger
#

ok yeah dw about eye visualize cornea

#

it's for debugging like what I thought

#

so not needed

sacred spoke
dire badger
#

Contact shadows on each light, ambient occlusion (2 m), screen space reflections >>>>

turbid quiverBOT
#

Congrats @dire badger, you are now level 7!

fluid sinew
#

this shader is useful asl

dire badger
#

I'm glad !

sacred spoke
#

for some reason on the ageless and stellan plugging in the eye uvs node it stretches the eyes. shrug

dire badger
#

their aspect ratios must be different? idrk

#

make sure you match everything from the actual material with the node group

uncut viper
#

Is there any chance that this node setup could also be used for creating eye dilation?

viscid jolt
#

i recreated that material entirely procedurally in unreal but i couldnt figure it out with blender nodes so i honestly just ended up baking a lot of this into 2 textures for the normal map and highlights 💀 only downside being its only for the human head textures really

#

i noticed your material seems to distort the eyes tho you might wanna look into that

#

it should ideally only change how the light bends on the iris with the normal map and has the spheres to add the highlights since thats how it works in game
good work though!! its really close just needs some fine tweaking

dire badger
#

yeah there's some issues with the faked refraction, i keep meaning to look into it but havent had much time

viscid jolt
#

ahh thats fair yeah

versed cedar
#

ready whenever you are

dire badger
#

i keep forgetting to update itsjfjskdf

#

ill do that now

versed cedar
#

no rushj

#

just letting you know im ready whenever you think it's done!!

#

@dire badger and idk if you wanna do it or you want me to do it, probs separate the input shader and output shaders if possible

dire badger
#

alrighty!

dire badger
#

only reason why i have it is to be consistent but ig if it's done automatically, then it doesn't matter

versed cedar
#

yeah ik your intentions

#

cleaner to separate the logic if possible tho

dire badger
#

got it

#

ty

versed cedar
#

esp if those sockets

#

are being driven by these

dire badger
#

getting there

#

the refraction is just very wonky still so i just need to redo that

#

then it'll be all set

#

tbh it doesn't even look bad without refraction?

#

much better than this at least

#

still gonna see if i can get it to work right though ofc

versed cedar
#

dub

#

lookin good

kindred tangle
#

Hey @dire badger , thanks for making this shader! I made some tweaks to make it a bit more accurate w.r.t rotations, however, it relies on the eyes being their own objects. I'm not too knowledgeable when it comes to shader dev, so I'd be curious to hear if you have any thoughts on a way to fix this? Pictured is the 'fix' on the front most eye with the back most eye still attached to the armature which I believe changes 'object space' based calculations.

Also, as an added bonus, I ported this shader to Unity for my Rufus VRChat avatar (I am also a raccoon enjoyer 🦝 ), it mostly works but the distortion of the eyes is a little noticeable when they rotate because I apply a similar fix there too. But it came out really well regardless, thank you for making it open source =D.

dire badger
#

oh that's awesome!

#

the main issue I'm having is the distortion with rotation and stuff so it's nice you could figure it out for yourself!

kindred tangle
#

Ah I'd be happy to share my changes with you!! Let me copy them over to the file you uploaded and I can reupload if you're interested?

dire badger
#

im pretty much just looking at how the nodes are done in UE and trying to copy those over but if you could show me thatt, it would be so awesome

turbid quiverBOT
#

Congrats @dire badger, you are now level 9!

dire badger
#

i appreciate it

kindred tangle
#

Here it is!! Do note that if this shader were attached to the eyes attached to the default FN armature, the refraction would mess up again. I think what needs to happen is somehow transforming 'world' space to 'eye space' instead of 'object space' where 'eye space' is the origin of each individual eye after armature modifications. Unfortunately, I have no idea how that would be done with my current knowledge.

#

I hope this helps :D? Also, curious where you can find the UE nodes for the eye shader?

dire badger
#

honestly half might be able to implement that, just seperating the material into it's own object, but idk

versed cedar
#

I don't see anything wrong with that

#

easy fix

dire badger
#

i was trying to look at it more and ig it just read what redhaze said wrong 😭

#

so it's the armature modifier on them messing up the refraction

#

It's kinda annoying to work with but if each eye is seperated into their own object, then using a child constraint to each eye bone, it works perfectly

#

ig it's since the eye mesh isn't technically moving with the armature modifier, but it is with the child of modifier

#

trying to see if i can do anything about that through shader nodes but i doubt it

kindred tangle
#

good luck 🫡 . i'm very curious what you do to fix it if you figure it out!!

#

also, sorry for my poor explanation ha

#

I think the transformation matrix to object space is based on the origin of the mesh.

#

in Unity though, it's based on the 'root node bone' when using a skinned mesh renderer. This took me quite a while to figure out 😄

simple canopy
#

Do you think something could be done with geometry nodes to help fix that issue? There might be a way to trick the eyes into acting as if they were their own separate objects without actually separating them from the main mesh 🤔

kindred tangle
#

@simple canopy , mayhaps. I was playing around with the idea. I think if you can construct the world to object matrix such that the eye is treated as if it were its own object rather than part of a larger mesh (i.e. the character itself), then I think you'd just need to replace all the world to object nodes in the shader with world to some custom object space. I know you can retrieve position and normal before mesh deformation using geometry nodes and reordering the geometry modifier above the armature modifier. But I think you may need to bake the eye position, normal, and maybe tangent (whatever is needed to create a new coordinate space relative to the eye rather than the armature's origin) with origin set to the same pivot as the eye bone.

#

At the same time, I find it hard to believe this is what epic does in their eye shader, there has to be some simpler way!!

dusk tiger
versed cedar
#

working on implementing it rn

#

it all looks fine to me

#

i dont see any issues with refraction when it's on the character mesh

versed cedar
#

bc the one redhaze sent is still one group

#

these are the only shared parts right?

#

so i would just need to replicate thoee params on both

#

oh and this

#

i just need to make sure everything is being set up properly and properties are being added to both when needed

dire badger
#

haven't sent the seperated one yet sorry

versed cedar
#

looks so much better 🙏

versed cedar
#

i just need to know which properties go where and i might be able to separate myself

#

unless you wanna do that with redhaze's then by all means go ahead, i can wait

dire badger
#

I mean I already have it all separated, it's just I haven't figured out a perfect way for refraction yet so I just haven't sent it

versed cedar
#

gotcha

#

i mean the refraction looks fine in redhaze's

#

what's wrong with this

kindred tangle
#

@versed cedar Try rotating the character 90 degrees then also try rotating the eyes around. If eyes are not their own objects, then stuff looks odd

#

90 degrees so they face a different direction while standing up that is, idk what axis that is

#

Specifically, the pupil warps and the refraction effect stops working

patent oracle
#

they are talking about this

#

90 rotation

#

0 rotation

versed cedar
#

ah I see

#

if this was copied from fn then why is this an issue

#

shouldnt the fix in their mat too

#

or is this a blender specific issue

patent oracle
#

might know the solution

kindred tangle
#

The tweaks were adding world to object transform nodes in certain places

turbid quiverBOT
#

Congrats @kindred tangle, you are now level 4!

versed cedar
#

okay well imma put this off til it's fixed

dire badger
#

prob will just redo how I do the refraction then

dire badger
#

only reason why I didn't redo it from the start is because I'd have to ofc make all the parameters work as accurately as I can

#

it'll be worth it though

dire badger
#

ok this is much simpler than i thought

patent oracle
#

fr?

dire badger
#

pretty much done LOL

patent oracle
#

echo and I were looking to see how to recreate tangent to make it constant

dire badger
#

there's like 2 things i need to fix/adjust and it'll be doe

patent oracle
#

I guess we were making it harder than it had to be 😅

kindred tangle
#

Oo Im excited to see the solution 👀

dire badger
#

gonna go into a voice channel if anyone wants to see what i have so far

#

just gonna try to fix what i need to

kindred tangle
#

Ill be lurking silently coz im still at work lmao

simple canopy
dire badger
#

@versed cedar can I rename parameter names to be a bit cleaner or is that something you might wanna do yourself if at all? (I mainly just wanna remove 'Eye' from the beginning of each one)

versed cedar
#

yes

#

I can do mappings

dire badger
#

just to look cleaner

#

alrighty!

versed cedar
#

as long as you provide the original names for me to convert

dire badger
versed cedar
#

only name changes

#

the rest I can just add in if they're identical to the param names

dire badger
#

tried on a bunch of different skins and they all worked well

#

also I didn't end up changing the names so they should be accurate

#

and i had to change this to a vector rather than a color because blender doesn't like negative values urgh

#

but anyways it should be all set :D

simple canopy
dire badger
#

so it works fine as a vector, just not a rgb value

#

since rgb values can't use negative values

#

i dont even know if there's a skin that uses it anyways

#

there's 3 different types of the highlights and most use one of the other 2

simple canopy
#

Oh I meant like if the material has that parameter with negative values, I wonder how FP is going to handle storing that since it usually adds vector params as colors. Although now that I think about it I don't think it would make it into a disconnected parameter since it would go directly into the node

dire badger
#

ohh

versed cedar
versed cedar
#

actually nvm

#

FLinearColor is float

#

should be fine

#

if it's being applied to a vector thing it should work

versed cedar
#

will set this up soon

#

enjoy contributor role

versed cedar
#

worked first try lol

#

marking this finished

stuck jungle
dire badger
#

yes

stuck jungle
#

Alright

#

thanks

stuck jungle
dire badger
#

there should be a bool to turn it on

#

one sec

dire badger
#

got distarcted mb

#

just turn UseEyeColorTinting to 1 and then you can change the color

stuck jungle
#

OMGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG

#

HOLY FRICK!

stuck jungle
dire badger
#

if it changed the color then yes ?

stuck jungle
#

Do I just add the eyes?

#

Somthing looks off

dire badger
#

OH

#

no

stuck jungle
#

Oh

dire badger
#

you take the 2 node groups from the blend file

#

the pre and post ones

#

you put the pre before the textures and post after the textures

stuck jungle
#

Can I share my screen?

#

nvm

#

I just tryed to c and p

#

uh

trim forum
#

i donbt gat a single thing here

jagged fossil
#

Can you please add control over the position of the Iris in the materials nodes?

patent oracle
jagged fossil
#

Color? No, I'm talking about the white dot

patent oracle
#

pretty sure that is a thing

dire badger
#

when you're changing it, go to RGB and adjust it from there

#

R = X position
G = Y position