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
67 Replies
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
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.
Then just use the function and plug it's output to World Position Offset pin in the material
I think I've posted some example somewhere, let me find it
Ah, I know DigbyTool has a custom material that uses Panini projection
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.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?
Also, is it normal for the child MI's to appear so dark?
the parent material
It's broken in game too
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
(I've updated the normal map settings. the child materials still have the same warning)
The sampling problem is either in the samplers or in the textures you use in the material instances
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
"panini mask"?
I'm trying to localize the paniniprojection to the hands using a mask
the legs are affected too
Multiplying the mask with the WPO should work.
What I've attempted
Wouldn it make sense to have multiple material slots on that mesh?
It does have them
are you saying I should modify it to localize the panini affect?
You can use material slots to apply panini / non-panini material instances to parts of the mesh, instead of using masks
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
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)
yes
the goal is to filter out the legs and localize to the arms
Hmmm, which skeleton are you using?
Does this also look weird in 3rd-person?
1PCharacter_Skeleton
3P model is fine. I have the panini projection toggled off for those materials.
Fine = legs are in the blade runners?
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
What's your current FOV?
120
Does FOV = 90 make the legs look OK?
it should.. let me see
yes
(at that FOV setting, the Panini projection doesn't have an effect from what I've seen)
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
Hmmmmm, where do you see that mask?
here.
Fmodel shows what the texture actually looks like.
It's used in this material.
Hmmm, not sure what this texture does
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
I mean the legs paninimask
Maybe it's plugged into one of the inputs of
MF_PaniniProjection
Could be worth looking at this material
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 MIConveniently enough, FModel can show this info
Hmmm, apparently the boots' 1p material has
UsePaniniProjection
set to falseHmm that is weird
Maybe it has a child handling it
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)
I don't think it's getting scaled at all so it doesn't have it on
It's not supposed to
So the legs have to transition between panini and non-panini
That's the purpose of the leg mask
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
)Does it matter which one?
Yes, but it shouldn't be too hard to find via trial and error (at worst)
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
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 valuelooks like its gonna work 🎉
I thought you were making a custom player model, not a dark Mercer Sphere :LUL:
:Nightcat_dumbsmile: don't get too close now
>just noticed this ss is at 90 FOV
what it looks like in game
It's so close
I think I might need to adjust my mask to have a smoother transition
:FA_NeonNice:
(FOV 120)
(FOV 90)
looks like there is a single vertex that needs adjusted but besides that :FA_NeonNice::FA_NeonNice::FA_NeonNice:
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
heads up @Aurias people looking for help with character replacer might benefit from this info
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)