#Can you render a sprite to a viewport, but have it be a child of a different node?

49 messages · Page 1 of 1 (latest)

stuck flax
#

Is it possible?

#

for example:

scene:
  player:
    particles (gets rendered on the pixel_perfect_viewport)
  pixel_perfect_viewport
rigid mist
#

Someone may correct me if I'm wrong, but a viewport just needs information on what to render, it can render things that aren't its children.

visual elbow
#

how would that work?
this would come in handy for me too.

rigid mist
#

I'm not sure but if it wasn't possible you wouldn't be able to have a split screen or a hind camera or similar things.

rigid mist
#

I think it's easier if you explained what you want to achieve.

stuck flax
rigid mist
#

Can you go into more detail?

stuck flax
rigid mist
#

I'm sorry, I cannot visualise this.

stuck flax
rigid mist
#

You say 'all particles' but I don't know what particles you're using. I don't even know whether the game is 2D or 3D, I don't know where this second viewport is being rendered, or how a shader makes it pixel perfect, or what pixel perfect even means in this context.

stuck flax
#

Its 2d, gpu particles, its getting rendered on the screen, how the shader makes it pixel perfect doesnt really matter, but if you wanna know, i will just snap the UV

visual elbow
#

After some searching, I concluded that Manock is wrong and this is not possible.
Split screen is possible because of the World2D is already part of the tree and rendered to root Viewport.
It appears that to benefit from the viewport, you need to have everything as a child of the viewport.

#

To clarify, it needs to be a child of some Viewport so it can be passed around, given your use case, I think the best solution would be to spawn the particle emitters as children of the viewport directly via signals. (like in the event bus system video by GDQuest)

rigid mist
#

How can two viewports show the same game world when the other camera exists in a separate world entirely?

visual elbow
#

World2D, read the documentation

rigid mist
#

Can you explain, I don't understand what World2D does.

#

I've never used a World2D or World3D in any of my games. I once tried reading it but it makes no sense to me. I don't place any objects in it. Any objects I place are just children of the root viewport.

#

I looked at the docs again and neither World nor World2D really explain what they are.

#

I'm not saying I can't be wrong, I probably am, but now I'm curious why I'm wrong.

#

In addition, do you somehow understand what particles are being rendered or where the second viewport is being rendered? Or what pixel perfect means?

stuck flax
rigid mist
#

What particles are we talking about though?

visual elbow
#

First off, anything rendered to Viewport is pixel-perfect.

stuck flax
visual elbow
rigid mist
#

Like, when I think of particles I think of stuff like fire or flashy effects that require a lot of small images to be rendered all at once.

stuck flax
rigid mist
#

Like do you want to render particles to a viewport that is overlaid on top of the regular one?

visual elbow
#

you did

rigid mist
#

Whether or not you did, to me it was very unclear. That's what I've been asking this whole time.

stuck flax
#

well anyways, im gonna go find a workaround or something, thanks for the answers

visual elbow
rigid mist
#

But these particles are just... What am I thinking of? Flash effects from sword swipes or something?

rigid mist
#

Yeah but what particles? What sort of effect do you want to show on the screen?

stuck flax
#

particles?

visual elbow
#

Please Manock you are kind of derailing the conversation if you don't understand the problem by now.

rigid mist
#

I'm sorry for committing the awful crime of trying to help.

visual elbow
#

@stuck flax if you are modifying the scale of the particle, only the approximation will be drawn onto the viewport.
The same situation happens if the particle's rotation is different form 0

What is the resolution of the game?

visual elbow
#

and what resolution it is rendered at? the window i mean
i am assuming that the game is not played at this resolution

stuck flax
visual elbow
#

I still think what i suggested earlier is the simplest solution

stuck flax
#

i could also try and make a shader to lower the res of each particle