SubUV vs Pixel Shader Flipbook costs

So in Unreal you can’t use a SubUVMovie with a GPU particle - but there’s nothing stopping you using the Flipbook node in the material editor and doing your flipbook animation there. This method also allows you to do things like create a variable frame rate by using a Dynamic Parameter set to Uniform and Spawn Time Only which isn’t a feature available in Cascade.

So i was just wondering how the two compare cost wise? Presumably they’re doing very similar things under the hood but is there any optimisation advantages to using the Cascade Sub UV rather than in the Pixel Shader?

A little pixel cost I would think - doesnt the built in system go through vertex shader instead? (wrt to the SubUV logic, obviously the Tex sampling doesn’t)

To replicate all of the built in SubUV system in a pixel shader would take a bit of work and you’re front loading to a common bottleneck. You could direct the logic in to the material custom UV channel stuff but I wouldn’t personally vouch for that just yet as I’ve not yet got shipping knowledge of it.

Also, SubUV cutouts atm.

1 Like

On more of a tangent and not advice but just my way of thinking, but fwiw everytime you go with a built-in solution in cases like this you’re falling back to years of wisdom and tested methods.

Who knows what esoteric platform specific things are happening under the hood and who’s had to fix what in the past!

This in no way answers the original question

yeah, you definitely can’t use Particle Cutouts if you’re faking the Flipbooking, but there’s obviously other advantages - i’ll continue to just use it as a tool when i need it.

“Years of wisdom and tested methods” could also be read as “outdated technology and legacy bugs” though :stuck_out_tongue:
there’s plenty of things in Cascade that haven’t been updated in ages and don’t actually work as intended - for example Uniform Distribution on a Frame Rate. I realise they’re putting most of their effort into Niagara atm but there’s so many small features/inconsistency’s/UI improvements they could make.

When it comes to gpu particles and pixel cost…if you want to tank the system, add the 3d noise and watch your computer begin to cry.

1 Like

I’m probably incorrect for this, but I always like to imagine that the material editor is smart enough to toss early UV instructions like that onto the vertex shader. I know it does this for a few things, but unfortunately doesn’t do a good job surfacing when/why it uses vertex shader or pixel shader. I find quite a few of Epic’s functions have comments/bools that say things like “use vertex shader”, and looking under the hood, they just avoid sampling from anything requiring pixel accuracy.

If this works like our material editor at Naughty Dog did, we just abided by the rule of: The branch of the shader will be in the vertex shader until it can’t anymore, then it’ll be in the pixel shader.

2 Likes

I’m with Keith on this one, I just assume those instructions will go into the vertex shader. I’ve been doing my own custom flipbooking instead of using subuv just because I find it much more convenient and I haven’t found a way to have a scrolling mask at the same time. So custom solution it is.

For the cutouts you can still use them, just not a specific one per frame. You could add all of your flipbook frames into a single lil texture and use that for a cutout instead, might be worth it depending on the content.