Hello,
The last few threads on this subject are quite old, so I wanted an updated set of feedback.
Are decals expensive when there are thousands of them?
If so, is there a way to limit their impact?
Hello,
The last few threads on this subject are quite old, so I wanted an updated set of feedback.
Are decals expensive when there are thousands of them?
If so, is there a way to limit their impact?
Hey there @Leomerya12! Decals themselves are decently optimized but like all materials, what matters most is their complexity. Simple bullet holes? You can likely have many! Decals utilizing depth or with complex shader operations? Likely only a few before you experience significant performance hits. I’d recommend stress testing your use case and track it with insights to be sure.
I recently did some work with decals. I found that I lost about 1 FPS for every 200 decals being rendered (running in editor). In my case however I was using the UDecalComponent itself, and not creating individual decal Actors - which allowed me to save the overhead of managing an Actor (not a whole lot, but can add up)
Decals are automatically culled from the render pass based on the screen space they occupy, so if you have a very small decal you would need to be quite close for it to be rendered.
What is the use case you have for decals?
Hello, @Thnift and @SupportiveEntity !
The decals I have are all VERY simple. Basically tattoos on flat surfaces (for example: lines, markings, stains, etc.).
I have just under 6,000 of them.
If I were to do a 1:1 according to @Thnift 's calculation, that would be a loss of 30 FPS; but I’m aware it doesn’t always work that way.
So, decals are actually culled then?
Because I’ve found that PACKED LEVEL ACTORS are my friend (they level instance, lowering draw calls), but I cannot add decals to them.
@SupportiveEntity … admittedly, it’ll take some time for me to learn how to use that profiler. I’ll try it.
I’m not familiar with Packed Level Actors (PLA’s) but from my quick research it seems it’s just a way of telling the engine “Force these meshes to be 100% static”.
Is it your experience that decals don’t work on these? DecalActors are just an actor that can be placed in space, containing a projection box. Whatever intersects with that projection box will have the decal applied to it (Kind of like you dropped a 2D image straight down through the projection box)
To my knowledge this should stop you from putting a decal actor in the world space of a PLA, but if you’ve already tried that than I can only believe you.
For the screen space culling, you can take a look at:
https://docs.unrealengine.com/5.1/en-US/API/Runtime/Engine/Components/UDecalComponent/SetFadeScreenSize/
PLAs are weird because they are basically blueprints. So, actors actually can move, it’s just that instead of treating 100 of the exact same mesh as individuals, you treat them as mostly identical, save for translations (which are the only way to adjust them).
No, you cannot include decals. They aren’t supported. I’ve tried, failed, researched, and confirmed.
Also, PLA-ing allows for distance culling, which is a GODSEND.
You may want to look into it, but you can define when members are culled. Great for hiding large or obstructed structures that can gobble memory.
More… learning.
Sorry, I don’t mean to include a decal in a PLA, that I’m sure isn’t possible. I just mean placing a decal in worldspace so that it intersects with the PLA in the world.
This is again assuming that a PLA is similar to a regular blueprint object - in the sense (like you say) that they can move. However this is all just speculation from my side
Uhh… I don’t understand.
Do you mean this? Because you can see that there are a bunch of decals that are attached to (hidden/PLA Distance-culled) meshes.
Another way you can do it, with the best of both worlds is to create prefabs using a singleton instance manager - these are faster the PLAs and allow you to have any type of actor/component in them including decals.
rdBPtools can handle all the creation of them - here’s a set of benchmarks outlining the performance:
Yeah more or less, my thinking was that once you got close enough to have both the PLA and decal rendered that it would work.
Again, just speculation. It’s possible that PLA’s are excluded from the last pass render pass that handles the decals.
…my concern is that, how stable is this?
Does it play nice with default functionality (?), because this is a VERY serious project, and I’m avoiding third-party plugins like the plague.
I understand that you want to share the data you gathered, but I’d also like to suggest that “losing 1 fps” is essentially a totally meaningless measurement without additional context.
Going from 1000 fps to 999 fps is no real difference.
Going from 5 fps to 4 fps is a HUGE difference.
Also, “fps” depends a whole lot on the scene and your hardware, and additionally, it depends on where your current bottleneck lives – texture read? geometry transform? pixel shading? CPU simulation?
To quantify the cost of decals, it would be better to formulate the measurement as “on an otherwise empty scene that was fill rate limited, I lost 2% of frame time for every 200 decals.”
Regarding cost of decals: I estimate the cost of a decal to be very similar to the cost of rendering a simple static mesh of the same size in the same location. However, with the caveat that decals have to render after depth has been resolved, to support the “near Z testing” that removes the decal from areas outside the given decal volume. (At least deferred decals, which are the typical Unreal case!)
AHHH!
Weird.
I had no idea Unreal could function in such a way.
You came in a little hot there, but you’re correct about the FPS. MS is a truer metric.
That’s why I said it won’t be a 30 FPS drop; I understood what that person meant, but I also appreciate you clearing it up for others who may mistake their findings.
Like a plane, no? So I basically have thousands of small planes?
Yes, that’s a good first order of approximation! (At least, that works for me )
We use the plugins at work and they’ve been performing well - but if you’re quite a way into your project, adding something new like this may not be such a good idea - best done from the start or near.
Yeah my response was pretty simple. I was more or less addressing at the level I thought was required by @Leomerya12’s question.
From what I’ve read and seen, I’d agree with your equating it to a simple static mesh.
I appreciate the transparency!
I just tried adding a decal component to an already created PLA that I added to a level, dragged it to be a child of the Instanced Static Mesh component and it does seem to work correctly - a work-around at least:
Interesting!
I’ll have to play around with it in the future.
The only issue is that I’m so far into whatever I’m doing, I’d basically need to start over for me to apply these.