0 votes

I am attempting to make "pixelated" particles by placing a Particles2D node inside of a custom Viewport and setting its parent ViewportContainer to stretch mode. Since the Viewport will "pixelate" everything inside it, the particles will snap to the actual game pixels and produce the pixelated effect that I want. Here's a gif comparing normal particles (right) with the pixelated version (left).

This system works great except for one problem: non-local coords. While I'm not sure exactly why, my theory is that the global transform that the particles are supposed to use in non-local coords mode is actually the custom Viewport itself, rather than the "root" Viewport. Since the custom Viewport is itself instanced in other nodes that want to use pixelated particles, the inner particles end up just following that viewport, rather than the "root" one that I want. Here's a gif demonstrating this effect. Note that both particle systems in this example are using non-local coords (regular on the right, pixelated on the left).

Is there a way to get the inner particles in the custom viewport to use the "root" viewport as the base of the global transform? Alternatively, if there are easier ways of pixelating particles in Godot than this I'm open to suggestions for that as well.

Thanks in advance for the help! You can find the project files here if you want to mess around with this yourself.

in Engine by (45 points)
edited by

can't you just do something like global_position = local_position - customViewport.position + globalViewport.position?

Unless I'm misunderstanding, I'm not sure that will work. I don't want to affect the global position of the particles node, I want the particles themselves to emit in non-local coords where the coords they use instead are the root viewport's coordinate system, rather than the custom viewport's coordinate system (which is what appears to be happening).

Please log in or register to answer this question.

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.