Help with FOV scaling for custom model

I am working on importing a custom model into the game and I can't find a shader available in the games assets to reference that supports the FOV scaling and also supports panini maps. I need to be able to mask and thus localize the FOV scaling effect to the hands
No description
67 Replies
Archengius
Archengius•2w ago
The material function is called Panini Projection and should be applied to the first person mesh only. You can also just use one of the existing materials as a base and they will have panini support built in
Katari
KatariOP•2w ago
I'm trying to do the latter but I'm unable to find a suitable material The xeno zapper material for example supports panini projection but doesn't seem to have a mask for it.
Archengius
Archengius•2w ago
Then just use the function and plug it's output to World Position Offset pin in the material
Rex
Rex•2w ago
I think I've posted some example somewhere, let me find it Ah, I know DigbyTool has a custom material that uses Panini projection
Rex
Rex•2w ago
This one isn't from DigbyTool, but it's good enough to serve as an example. The idea is that you need to enable Use Material Attributes in the details panel (left side, below the preview), and connect things to a MakeMaterialAttributes node instead of the root node (the rightmost node, which has a lot more inputs when Use Material Attributes is unchecked). The Panini magic is between MakeMaterialAttributes and the root node: there's a static switch parameter (named UsePaniniProjection for consistency with the game's own materials, but could have any name) which controls whether the material attributes go through the MF_ApplyPaniniProjection node, which is a Material Function (this is what the "MF" prefix stands for). You can double click on that node to see what's inside that MF, IIRC it only updates the attributes' World Position Offset using the Panini projection. After creating the material, one needs to create MIs (Material Instances) for 1p (1st-person, Panini ON) and 3p (3rd-person, Panini OFF). The approach I would suggest is to create the 3p MI first, configure material parameters (e.g. textures) accordingly, and save it with a _3p suffix. Then, create the 1p MI using the 3p MI as parent, enable UsePaniniProjection on the 1p MI and save it with a _1p suffix. This way, the 1p MI inherits all the parameters (except UsePaniniProjection) from the 3p MI, so the visuals should remain consistent between the two.
No description
Katari
KatariOP•7d ago
I tried something like this but I'm completely new to unreal engine and shader graphing and I couldn't figure out how to enable Material Attributes This is so helpful thank you !! How do i create a shader with both translucency and specular shading?
Katari
KatariOP•7d ago
Also, is it normal for the child MI's to appear so dark?
No description
Katari
KatariOP•7d ago
the parent material
No description
Katari
KatariOP•7d ago
It's broken in game too
No description
Rex
Rex•7d ago
There's a warning about the sampled texture Please show the details panel, I want to see the material domain and the like. I don't recall the exact names, just take a screenshot that shows the same things mine shows
Katari
KatariOP•7d ago
(I've updated the normal map settings. the child materials still have the same warning)
No description
Rex
Rex•7d ago
The sampling problem is either in the samplers or in the textures you use in the material instances
Katari
KatariOP•7d ago
not sure what I did but I changed the sampler type to virtual normal and then back to normal and its working for the children now well the warning is still there... but the normal map is working anyways How do I add a Panini mask into this? might figure it out.. I am trying to multiply the panini output with a mask
Rex
Rex•7d ago
"panini mask"?
Katari
KatariOP•7d ago
I'm trying to localize the paniniprojection to the hands using a mask the legs are affected too
D4rk
D4rk•7d ago
Multiplying the mask with the WPO should work.
Katari
KatariOP•7d ago
What I've attempted
No description
Rex
Rex•7d ago
Wouldn it make sense to have multiple material slots on that mesh?
Katari
KatariOP•7d ago
It does have them are you saying I should modify it to localize the panini affect?
Rex
Rex•7d ago
You can use material slots to apply panini / non-panini material instances to parts of the mesh, instead of using masks
Archengius
Archengius•7d ago
Why are you trying to localize panini projection It is supposed to be applied to the entire mesh, not to a part of a mesh
Rex
Rex•7d ago
But I'm not sure why you'd want to do that, do the legs look weird? IIRC I didn't have issues regarding legs in 1st person when testing stuff with Manny (UE5 Mannequin)
Katari
KatariOP•7d ago
yes the goal is to filter out the legs and localize to the arms
No description
Rex
Rex•7d ago
Hmmm, which skeleton are you using? Does this also look weird in 3rd-person?
Katari
KatariOP•7d ago
1PCharacter_Skeleton 3P model is fine. I have the panini projection toggled off for those materials.
Katari
KatariOP•7d ago
No description
Rex
Rex•7d ago
Fine = legs are in the blade runners?
Katari
KatariOP•7d ago
yes I can just toggle panini off for 1P and the legs look fine but then the hands don't so panini is being applied to the legs too
Rex
Rex•7d ago
What's your current FOV?
Katari
KatariOP•7d ago
120
Rex
Rex•7d ago
Does FOV = 90 make the legs look OK?
Katari
KatariOP•7d ago
it should.. let me see
Katari
KatariOP•7d ago
yes
No description
Rex
Rex•7d ago
(at that FOV setting, the Panini projection doesn't have an effect from what I've seen)
Katari
KatariOP•7d ago
it doesn't it's used to scale the model with the FOV the pioneer has a special panini mask image just for its legs I just don't know how to replicate that
Rex
Rex•7d ago
Hmmmmm, where do you see that mask?
Katari
KatariOP•7d ago
here. Fmodel shows what the texture actually looks like.
No description
No description
Katari
KatariOP•7d ago
It's used in this material.
No description
No description
Rex
Rex•7d ago
Hmmm, not sure what this texture does
Katari
KatariOP•7d ago
I'm away from my computer right now but the torso paninimask is almost completely white I'm assuming white is scaled while black is masked
Rex
Rex•7d ago
I mean the legs paninimask
Rex
Rex•7d ago
Maybe it's plugged into one of the inputs of MF_PaniniProjection
No description
Katari
KatariOP•7d ago
Could be worth looking at this material
Rex
Rex•7d ago
Most materials in the editor are stubs Okay, there's an EnablePaniniMask static switch parameter (the material stubs seem to be missing those for some reason) set to true in this MI
Rex
Rex•7d ago
Conveniently enough, FModel can show this info
No description
Rex
Rex•7d ago
Hmmm, apparently the boots' 1p material has UsePaniniProjection set to false
Katari
KatariOP•7d ago
Hmm that is weird Maybe it has a child handling it
Rex
Rex•7d ago
Oh, I know Feet must be on the ground But you can't just make the feet be non-panini while the rest of the mesh is panini (feet would be detached)
Katari
KatariOP•7d ago
I don't think it's getting scaled at all so it doesn't have it on It's not supposed to
Rex
Rex•7d ago
So the legs have to transition between panini and non-panini
Katari
KatariOP•7d ago
That's the purpose of the leg mask
Rex
Rex•7d ago
I'm pretty sure this texture is used as a distance fade kind of thing, converting UVs to distance from camera So you would need to make a similar texture somehow, then plug it into one of the inputs of this node (screenshot is from MF_ApplyPaniniProjection)
Katari
KatariOP•7d ago
Does it matter which one?
Rex
Rex•7d ago
Yes, but it shouldn't be too hard to find via trial and error (at worst)
Katari
KatariOP•7d ago
True What node should I use? I'm completely new to shader graphing I think I should just be able to plug in one of the RGB channels from my mask image into it
Rex
Rex•7d ago
Grab your material, double click on the MF_ApplyPaniniProjection node, copy the contents into your material (replacing the MF_ApplyPaniniProjection node with its contents, the material should behave exactly the same at this point), and then wire up one input (at a time) to a new texture sampler for your panini mask texture. If you want to be fancy, there's some debug blink function you can use with a lerp node to automatically alternate between the original value and the panini texture. So you can easily see in-game what happens when changing that particular value
Katari
KatariOP•7d ago
looks like its gonna work 🎉
No description
Rex
Rex•7d ago
I thought you were making a custom player model, not a dark Mercer Sphere :LUL:
Katari
KatariOP•7d ago
:Nightcat_dumbsmile: don't get too close now >just noticed this ss is at 90 FOV
Katari
KatariOP•7d ago
what it looks like in game
No description
Katari
KatariOP•7d ago
It's so close I think I might need to adjust my mask to have a smoother transition
No description
Katari
KatariOP•7d ago
:FA_NeonNice:
No description
Katari
KatariOP•7d ago
(FOV 120)
No description
Katari
KatariOP•7d ago
(FOV 90) looks like there is a single vertex that needs adjusted but besides that :FA_NeonNice::FA_NeonNice::FA_NeonNice:
No description
Katari
KatariOP•7d ago
I ended up injecting the mask post panini calculation and I figured out how to use the multiply function here the materialattributes data was interfering with the multiplying earlier
No description
Robb
Robb•7d ago
heads up @Aurias people looking for help with character replacer might benefit from this info
Aurias
Aurias•7d ago
Ah yep yep! I've actually been helping Katari figure this out and already talked about potentially adding it to the guides! 100% should be super helpful (I say helping them figure it out, I've probably been moot help for this particular issue compared to others but we've talked some at least hahaha)
Want results from more Discord servers?
Add your server