Texture projection (AoE effect)

Hi,

Just wondering if anyone could give me some idea about how to do texture projection in PlayCanvas. For instance Unity has a projector component.

The goal is to achieve a texture that sits under the player character to indicate AoE spell effects.

Cheers.

You can use a spotlight, in the entity properties the last option is to add a texture and the trick is donecircle

Thanks for that idea. It certainly gives the right effect! However the problem we MIGHT have is that there a number of characters that could potentially trigger this simultaneously - and given that PlayCanvas is not a deferred renderer, I think we will hit some performance issues (unless I am misinterpreting how this works…?? That is possible!).

I should have probably specified performance might be a concern.

I don’t know much about performance, i think it would greatly affect performance if you activate shadows, but for your purpose i think it’s not necessary. Anyway someone of the staff can be more precise. In my case that function is used for player spells and to show the enemy targeted (as in the image). It can became a problem with RTS indeed.

From my experience with Unity, a projector is very heavy too, similar to an additional light, as it re-render all the objects that can be a receiver of the projection, for each projector!

If you need many concurrent effects on multiple characters, is better to find an alternative solution. If the ground is flat, a transparent additive quad could be the cheapest solution.

You can choose to use the deferred rendering pipeline in Unity though - performance doesn’t seem so bad in that case. In forward renderers (in general), yes, you do incur the cost of computing against all objects in the scene. But we don’t have that option in PlayCanvas… I mean, I’m sure there is a solution - we were doing this back in the day of fixed function piplelines so…

(Edit: it’s possible the performance of projectors is independent of the rendering pipeline - but I’ve seen conflicting reports on how heavy they are).

I COULD use a quad - but I have walls to consider - which I either have to “cut out” - or accept the texture will penetrate under the wall and now I either have to accept a user can be ‘hit by the AoE’ while they are behind a wall or have a user wonder why they weren’t hit by the AoE while being clearly in the radius. Either way it’s got some problematic design issues associated with it.

The reason I became concerned with performance was an early test I did with illuminating projectiles - it killed performance when more than a few lights where in the scene. To be expected I guess.

With your example, how do you prevent the texture from projecting on the player character? I notice in the image there looks to be the red outline of the cookie on the players shoulder?

Sure, but I what I meant is that even if it would be possible to replicate the exact same system of Unity projector in PlayCanvas, the performance would be bad anyway, as it is in Unity with the forward rendering.

Yes, I don’t know your specific scene layout and requirement, but if you could pass the info of the wall positions to the shader, you could skip the rendering inside/over the walls. A vector array maybe, not sure. I never tried this.

I understand what you mean - makes good sense. Thanks for the input - you’ve given me some good hints to go on. Cheers. :slight_smile: