0 votes

Is it possible to apply/make outline sprite shader (like one in 2d shaders demo) on 2d particles system? Not on individual particles but on the whole of the particles emited (whole system). Like in the image below.enter image description here

in Engine by (244 points)

I think it could be possible for each emitter, look at the glass bubbles demo structure to see how to apply it.

Or maybe having the particles on its own canvas layer you can make a full screen shader that affects only these nodes.

1 Answer

+4 votes
Best answer

If you want a shader to produce this outline, you need to render the particles on its own offscreen viewport, then draw it in the game world using a ViewportSprite that has a CanvasItemMaterial and the outline shader.

The reason why is that the shader needs to access pixels from the final result, not individual particles as they are drawn.

Another idea would be to have the particle system draw twice: once where particles are a bit scaled up and coloured differently, and a second time normally, over previous ones. On circular and square particles it would work and produce an outline without shader, but I don't think particles allow this without C++ modification.

by (28,788 points)
selected by

Thanks again Zylann!!! I think that your first suggestion is approach that I will try to implement as it seems straighforward one.

I had tried your first suggestion and it works like a charm. Thank you! :)

Hello, can you describe how you did that? I want to achieve the same effect but I'm not sure about how to draw on a offscreen viewport and all that stuff.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.