2D with 3D camera help needed

Godot Version

v4.6.2.stable.official [71f334935]

hi im trying to create a hollow knight style 2D game. I hate programming/ coding and so iv tried to skim past that

I’ve greyboxed part of my game, and im starting on art. I want to do parallax, and obviously the easiest way is with 2D parallax layers.

it really annoys me having to draw at different scales for backgrounds though, so i wanted to use the hollow knight approach - using a 3D camera for distances to get it automatically. I can’t get the image to work properly - i don’t even know how.

I tried to use a subviewport as a child of a texture rect, but my art looks weird and pixelated even though iv done all the filter to nearest stuff.

Does anyone have a good way to fix this/ set up 3D background layers using a 3D camera while using 2D for everything else?

You can use multiple Parallax2D nodes for this. I recommend reading the entry below, and trying it out and playing with settings before going down the road you are going down.

Thx for the reply, I found the way to use parallax nodes, but that means that I have to draw art at a squished x and y scale for further backgrounds - with the 3D hollow knight method iv heard that all you have to do is set a further z coordinate from the camera and then re-scale.

Equally you can draw further backgrounds at the same scale as everything else with the 2D parallax method, but then surely lots of the image will just be hidden? I might be confused abt this but i really want to draw everything the same size and not have it hidden, just how it was done in hollow knight.

You can scale parallax nodes just like you could scale 3D nodes, it’s probably much simpler to use 2D tools for a 2D game.

Unity is a 3D game engine, their 2D aspects are slapped on top of 3D, what you are referring to sounds like a quirk of Unity rather than an intentional design choice by Team Cherry.

Thanks for the reply. I think there’s a misunderstanding about what I’m trying to do.

I know I can use Parallax2D nodes and just set scroll scales. The problem is that if I paint a background at full room width (say 1920 pixels) and set a scroll scale of 0.5, the camera will eventually see the edges of that image because it’s not wide enough. To fix that I have to calculate exactly how wide each background needs to be based on its scroll scale, and then paint at that specific width. That’s what I want to avoid. I just want to paint everything at the same full width and have the engine handle the rest.

The Hollow Knight method uses a 3D camera with Sprite3D planes. You put a background far away on the Z axis, scale it up to fill the screen, and the perspective camera automatically makes it scroll slower. No math, no per‑layer width calculations. I think thats what Ari Gibson’s aim was really.

So scaling a 2D sprite doesn’t help because the scroll speed isn’t tied to its scale, it’s tied to the scroll scale value. I’d still have to do the width math. That’s why I was trying the 3D camera approach in the first place.

Im an artist really not a script writer and I dont really understand how to get this in godot.
Im using a 2D camera for literaly everything else though and so iv got to find a way to do this seperately

If your camera moves then there is always a chance it will see past the image edge, how do you want the engine to “handle the rest”? Do you want the background to repeat? You can set the Parallax2D’s repeat size to your image’s size, and as many repeat count as needed, for large images one or two should be enough. If you don’t want the background to repeat then you must define edges and/or scale your image up to accommodate the arena’s size.

Using a 3D camera because of perspective the engine automatically slows the movement of further objects. WHen it does this, the engine also reduces the SIZE of further objects. To combat this if you scale the size of your further object (the png) you are left with a correctly sized png that scrolls slower, simulating a parallax layer.

This is far better, because the entirety of the image you paint can be shown as well as having a parallax effect.

If you use a Parallax 2D, because the image remains the same distance from the camera in a 2D plane, if it scrolls slower, less of it will be shown. This will mean that even if you scale the image up/ down it will either
a) look the wrong size
b) part will be obscured

This means that when painting (I use Krita), I would have to paint my further backgrounds (e.g. a far cave wall) at a smaller x and y scale than the walls/ floor in the foreground.

Please correct me if im wrong but this is what everything seems to be saying.

Basically, unless i AM wrong, I need to find a way to implement my PNGs in 3D space and have them render in 2D space .

thank you if you can help.

Parallax2D is designed to replicate that 3D effect, you will have to design your art all the same 3D or Parallax2D. If you want a scrolling background then part of your background will be obscured, or repeat. If you want a background that stays in place forever you should use a CanvasLayer with a lower layer value than the rest of your game.

Can you give an example of what you want? It seems like there is a misunderstand of what 3D vs Parallax2D would accomplish (mostly the same) and what you hope to achieve with this.

You are wrong.

We keep telling you that, and you keep telling us why you are not wrong.

But I think the issue here is that it is assumed typically if you use a Parallax2D node that the left and right edges of your image are seamless. Parallax2D uses relative motion to make things appear farther away, while allowing you to make all your art the same size.

So you can take something like CraftPix’s Free Horizontal Game Backgrounds and this:

Will look like this:

Making each of the layers move at different speeds creates depth:

Which you will not be able to see unless you have a character that is moving against them.


What you are describing is a 2.5D game, where you are using a 3D world to fake 2D. And that certainly can be done with certain fixed cameras.

Like @gertkeno said, I think you need to tell us more about what you are trying to do. Because it sounds like you do not want to make backgrounds that scroll continuosly.

Thanks for taking the time to reply both of you - its been really helpful,
So I absouloutely want a background that scrolls with a parallax effect
For instance I want my far cave walls (my first ‘area’ is set in a cave) to move at probably around 0.6 speed of the player, while I want my plants to move at 1.2 times the speed of the player (theyr in front of the floor and therefore closer to the camera).

I definitely do not want a static background!

From watching Team Cherry’s dev logs and other videos, I discovered that they used a 3D camera on a 3D plane instead of 2D.
At first I thought that this was just unity being a 3D engine, but then I discovered that by using a perspective camera and placing multiple backdrop pngs further and closer, a 3D parallax effect can be achieved. However, when a png is placed further from the camera on the z axis, it automatically gets smaller. By rescaling the png to fit its original size, the parallax slower moving effect remains, the sizing is correct and all of the image can be shown.

I was unsure of this at first - I set up a 3D perspective camera with a camera at z = 10 looking towards coordinates 0,0,0 and then placed my PNG art files at different places (my plants at z = 5, my ground, walls and ceiling at z = 0 and some background chains at z = -10). I then rescaled these all until they were their original sizes and by panning in the 3D editor they did indeed move perfectly with a parallax effect at their painted scale.

To me that was preferable to any 2D camera effect - the whole image was shown AND the parallax effect remained.

But im pretty new to all this stuff, and when I tried to put this onto a 2D game plane using a subviewport and subviewport container (i later tried a texturerect as well) I was unable to get it all to work properly and I have no idea why.

I also tried using canvas layers (like in this video: 2.5D parallax effect in GODOT 2D engine. Similar to the background parallax in Hollow knight!)
with just normal 2D planes, and sure I got it working quickly but scales got mixed up and changed.

Apologies for the long reply, and thank you for taking the time to read this and being patient.
If I were to upload screenshots of what I was trying to do would this help at all?
thanks!

So lets say the player walks all the way to the right edge of your backgrounds. What do you expect to happen?

Also, are you using an orthographic camera in 3D?

I am using a reference rect as a Camera Limit (iv written a script in godot and made a group for camera limits) so the camera stops following the knight at a room edge and the background stops ‘scrolling’

I was using a perspective camera actually - i heard thats how team cherry did it

Ok, then you do not want to use a Parallax Background, because they repeat. That’s the point of them. You do not want your backgrounds to repeat.

So then the answer to your original question is, no, there’s no easier way to do the thing you’re doing.

ok - do you know if theres a way to render 3D things onto a 2D plane?

Yes, with a SubViewport and a camera afaik

ok - I tried to do this for ages but i couldnt get it to work well - i couldnt find any videos of anyone else who tried to use this method for backgrounds

Every time I tried i eeither couldnt see the subviewport or when I could it was in the wrong place/ wrong scale or was incredibly blurry for no reason

Well then I recommend you read this post and give us enough information to help you:

Viewports work fine but they are tricky to use.

Sorry if my posting has been unclear - again I am a beginner and do not fully understand godot.

I want to render PNGs in the form of 3D sprites on a 2D layer in a 2D game that uses a 2D camera.

I am struggling to use viewports. My backgrounds will need to ‘scroll’ as they are more than one viewport size in length and height.
What is the easiest/best way to do this?
I would be very grateful to receive any help on this, and I can provide any additional information needed.