Pseudo 3D in Godot 4

Поділитися
Вставка
  • Опубліковано 3 чер 2024
  • Hello everybody,
    Today I will show you how to write a shader in Godot 4 that tackles a very interesting topic: Pseudo 3D
    Pseudo 3D is a 2D environment that uses Affined 2D Textures to create the illusion of depth and perspective. This effect was mostly seen in the 90s but has died out because of the advancements in computer technology. Yet the visual style does still intrigue people enough to re-invent it.
    Hopefully you can too, and don't be scared if things are a bit difficult to understand. You can always ask me in the comments for help.
    Good luck and success with your project!
    Download the project here:
    github.com/GitKindoSaurProduc...

КОМЕНТАРІ • 96

  • @KindoSaur
    @KindoSaur  Місяць тому +17

    Hello there!
    If you have any questions or you've spotted improvements to the code or explanation please let me know.
    I am here to help and listen to get you further in your project =)
    Good luck!

    • @RabidTunes
      @RabidTunes Місяць тому +1

      Thanks for the tutorial! I'm just curious, you mentioned that the sprite needs at least 1 transparent pixel on the borders. Why is this?

    • @KindoSaur
      @KindoSaur  29 днів тому +3

      Sorry for my late response, didn't see ya there :)
      Well the shader takes the last color that's on the border to fill in the remaining viewable shader.
      Meaning that the shader is trying to always show a rectangle and not any other kind of shape we force our map to look like.
      If you look at my example map of Mario Kart you can see that, if my ALPHA border wasn't there, the last color it would use is the BLACK color. Which isn't something you'd want to see around your maps background.

    • @RabidTunes
      @RabidTunes 29 днів тому +1

      @@KindoSaur Aaah I see! I just tested this and I noticed it yeah, the border colors extend to the infinite haha. Thanks for taking the time to respond!

  • @tiefensucht
    @tiefensucht Місяць тому +73

    Something is wrong with the rotation. Doesn't look like the driver is in the center of the rotation, possible it happens in the bottom, but it should be exactly where the player is to make the illusion work.

    • @KindoSaur
      @KindoSaur  Місяць тому +42

      That's true, I simply placed a Yoshi sprite ontop of the Shaded Sprite2D.
      But you can add a small offset to the Rotation Pivot Point to fix this.
      I didn't do this to because I wanted to finish the video at some point, I was a bit excited to show it to you all.

    • @matheusnico1as
      @matheusnico1as 29 днів тому +10

      @@KindoSaurwhat about a part 2? Very interesting video, you could give us more details and whatnot. Great video!

    • @KindoSaur
      @KindoSaur  29 днів тому +14

      Thank you for your compliment!
      I am thinking to build further on this as well. But I am not sure what kind of extra details need to be added.
      Unless we want a full remake of Super Mario Kart SNES specifically 🙂

    • @r0adk1ll88
      @r0adk1ll88 29 днів тому +6

      @@KindoSaur One possible addition is to detail how to add topographical elements to the 2d space. For example, pipes which move with map, or a possible background with some sort of parallax that adds a dynamic backdrop. (I don't even know if this is possible, I'm only a few weeks in)

    • @declanmoore
      @declanmoore 24 дні тому +1

      It would be fun to get into the weeds of manipulating the transformation matrix per scanline to produce the 3D illusion like the original game :)

  • @FiggsNeughton
    @FiggsNeughton Місяць тому +23

    I was just considering this style of 3D the other day... I think it might be my favorite. Looking forward to copying this technique, thanks for posting.

    • @KindoSaur
      @KindoSaur  Місяць тому +7

      You're welcome!
      Keep me posted if you've started a project.
      Let me know if you need any help

  • @_buns_
    @_buns_ 5 днів тому

    Super unique tutorial! Thanks for making it

  • @jdselig
    @jdselig Місяць тому +7

    This is really impressive, thank you!

    • @KindoSaur
      @KindoSaur  Місяць тому

      Thanks for your compliment =)

  • @RblxRC
    @RblxRC 28 днів тому +6

    If you're going to expand on this, I HIGHLY request adding collision. That is one of the core things you need to make a 3D game.

    • @KindoSaur
      @KindoSaur  28 днів тому +2

      There is a ton of requests going for a Part 2. So you'll see it appear soon I bet =)

    • @Aeduo
      @Aeduo 19 днів тому

      For collision, you could probably have a bunch of collision shapes somewhere in the scene and have them be the actual object physics and then adjust the transformation of the map and sprites relative to the map based on their locations.

  • @Angemell
    @Angemell 21 день тому

    😮.... this was one of my highest myisteries ... thanks a lot for this approach!!

  • @jorgeaugusto30
    @jorgeaugusto30 27 днів тому +3

    I enjoy watching videos showing love for Mode7!
    I would like a tutorial for rendering sprites within the context of mode7. :)
    Keep up the good work!

    • @KindoSaur
      @KindoSaur  27 днів тому +2

      Same here!
      It really needs to be shown more because you can do some really fun stuff with it
      And thanks for the compliment =)

  • @Ivcifer
    @Ivcifer 22 дні тому

    amazing, man! thanks for sharing 👏

  • @Erwjable
    @Erwjable 29 днів тому +1

    Super cool, thanks for sharing!

  • @hanzelibardo2242
    @hanzelibardo2242 18 днів тому

    This is mind blown🤯

  • @zs3501
    @zs3501 28 днів тому +2

    Great video! This is a good way to get into pseudo 3d and SNES Mode 7-type games! 🙂👍
    One thing you could expand upon when it comes to pseudo 3d is sprite scaling as seen in games like OutRun and Road Rash, I'd be curious to learn more about that aspect as well.

    • @KindoSaur
      @KindoSaur  28 днів тому

      Thanks for your suggestion, I'll look if I can add it in the next part =)

  • @gregorywatine
    @gregorywatine 29 днів тому +3

    Congrats ! This reminds me the game "Street Racer" on Sega genesis, which managed to make pseudo 3d even if it was supposed to be impossible outside of the super nintendo. (a forgotten really fun game)
    I'm really curious if you make a sequel to this video !

    • @KindoSaur
      @KindoSaur  29 днів тому +2

      True, I recently played another fun Racing game on the GBA called: "Shifting Gears - Road Trip"
      This one uses even more bends and curves!

  • @Aeduo
    @Aeduo 19 днів тому

    I'm not quite old enough to have a strong appreciation for this style, but I could see it used to good effect for some things, especially now that you can certainly plop down and transform many many sprites as billboards and have that kinda 80s Sega arcade look like afterburner or outrun.

  • @vellengaming
    @vellengaming Місяць тому +2

    great video, you should make more! It was very well done! Would you by chance take requests for game features to make tutorials on?

    • @KindoSaur
      @KindoSaur  Місяць тому +1

      Thanks for your compliment!
      I always like to hear what people are currently looking for in the next tutorial but I do need to add that I'm not always available to work on tutorials.
      I do keep a notepad near so pass me a topic and I'll write it down =)

  • @anarkyworld
    @anarkyworld 29 днів тому +2

    It's so complex, thanks for sharing ❤, I'll have to watch the video several times. It would be great if you made a template that can be modified and can be used as a started pack for a retro game.

    • @KindoSaur
      @KindoSaur  29 днів тому +1

      What kind of retro aspects would you want to see in such a package?
      For this tutorial you can download my project from my Github page so that you can tinker around as well =)

  • @erictrinque6513
    @erictrinque6513 Місяць тому +2

    subbed, great content my friend

    • @KindoSaur
      @KindoSaur  Місяць тому

      Thank you for the sub and the compliment!

  • @KelKidGamez
    @KelKidGamez Місяць тому +2

    This is awesome

  • @jackwinner4810
    @jackwinner4810 27 днів тому +2

    Wow Awesome great project merci beaucoup !!! thank you very much I am not speak english

    • @KindoSaur
      @KindoSaur  27 днів тому +1

      Thank you very much =)

  • @igorgiuseppe1862
    @igorgiuseppe1862 3 дні тому

    awesome tutorial

  • @xainjaya
    @xainjaya 18 днів тому

    Thank you

  • @quinndepatten4442
    @quinndepatten4442 28 днів тому +1

    Hey, I've been looking for something like this!

    • @KindoSaur
      @KindoSaur  28 днів тому +1

      Happy to see that this video came right on time =)

  • @strcache
    @strcache 27 днів тому +1

    Awesome video with great explaining. 👍
    next, can u make video Pseudo 3D like Outrun Game? 🤤

    • @KindoSaur
      @KindoSaur  27 днів тому

      I have seen quite a lot of requests for it :)

  • @elModo7
    @elModo7 28 днів тому +1

    My favourite SNES mode.

  • @scruffyscruff
    @scruffyscruff 28 днів тому +1

    This is awesome - now i have to subscribe in the off chance you make a flat plane into a sphere shader 😂

    • @KindoSaur
      @KindoSaur  28 днів тому

      Thanks for the compliment and ... maybe ;)

  • @sayftysayfty4228
    @sayftysayfty4228 Місяць тому +4

    Hey great video. One question though, can´t you do this in real 3d? Would that not be the same visualy?

    • @KindoSaur
      @KindoSaur  Місяць тому +3

      Its indeed possible within a 3D environment and its also a lot easier to do (Just a couple and planes or Sprite3D Nodes).
      But its the technique that I found the most interesting to work on.
      And I also saw quite a lot of people asking to recreate this effect but outside of OpenGL.
      Thanks for asking =)

    • @stevendorries
      @stevendorries 23 дні тому

      @@KindoSaurwhich is more performant on low end hardware though?

  • @officialsquadrilogystudio
    @officialsquadrilogystudio 23 дні тому

    For those of you who don't know this art style was the pioneer of 3d games. By squishing and stretching a 2d image they were able to emulate perspective.
    A division of Nintendo experimented with Polygons thus creating the original Donkey Kong Country. How ever the SuperNintendo wasnt powerful enough to carry 3d models so they converted the polygons into sprites.
    It wasn't until the N64's release that Nintendo could do games that were fully 3D. But even then 2D sprites were still being used in some scenes such as Mario Kart 64.

    • @Aeduo
      @Aeduo 19 днів тому +1

      Donkey Kong Country was done by Rare, and the technology they used was by SGI. 3D games in general are considerably older than any of these. Both drawing polygons and mapping textures to surfaces with perspective correction. Going even further back for non-realtime purposes. Pixar did a lot for this in the 80s, among others.
      The best examples of early 3D for nintendo would probably be Doom on the SNES as well as Starfox on SNES, but for this effect specifically, pilotwings and f-zero being launch titles. Those experimenting with rendering polygons on the SNES or at least an enhanced SNES were Argonaut, who i don't think were part of nintendo at all.
      But yeah, Nintendo were one of the first to bring such 3D effects to home consoles. Some features of the SNES were almost designed with this in mind.
      Kinda right in some of the broad strokes, but getting a lot of the details not quite right, but Nintendo were generally using methods that had already been well-established, but they were able to bring the technology to consumers.

  • @Feizenbara
    @Feizenbara 27 днів тому

    Great video ! My suggestion for part 2 : how to simulate slopes like in Outrun :) s

    • @Aeduo
      @Aeduo 19 днів тому +1

      Outrun worked pretty differently in giving its illusion than super mario kart. It had almost like, different graphics for the road that various components would animate over time and sprites would move and scale around with the appearance of following the track, and would for each row of pixels, follow a curve to give the appearance that the track was turning and either skipping or doubling rows of pixels to give the appearance of going up or down a hill. This is certainly possible to do in godot, but it would require a different approach.

    • @Feizenbara
      @Feizenbara 19 днів тому

      @@Aeduo thanks for the clarification :)

  • @rocket007
    @rocket007 4 дні тому

    I usually call this mode 7.
    Love2d days

  • @5minutemovies977
    @5minutemovies977 29 днів тому +2

    5:32 Shouldn't xy be equal to -98 instead?
    Also, at the end, it seems like the map rotates around the camera and not around the car.

    • @KindoSaur
      @KindoSaur  29 днів тому +1

      I think you are right 😅
      In another comment I indeed adressed this issue as well. And was simply because I wanted to show my project after working on it for a pretty long while.
      You can add a small offset to the Pivot Rotation Position to make this effect work again =)

    • @Afreshio
      @Afreshio 27 днів тому +1

      I was on my way to comment this, just a nitpick on the dot product operation, a small mistake. But nonetheless it's important to point it out just in case.

    • @KindoSaur
      @KindoSaur  27 днів тому +1

      Worst part is that I kept checking and recalculating to see if I was correct before adding that part into the video.
      Oh well, lets just say that its just difficult to calculate

  • @desoft8b
    @desoft8b 28 днів тому +3

    The only thing missing is being able to do it with a tilemap.

    • @KindoSaur
      @KindoSaur  28 днів тому

      Might be a new challenge I can do 😁👍

  • @gokusupersaiyan6
    @gokusupersaiyan6 29 днів тому +1

    How can one implement drifting and sliding?

    • @KindoSaur
      @KindoSaur  29 днів тому

      I'll be back for this one

  • @tejaswithme3713
    @tejaswithme3713 Місяць тому +2

    😥😭You are just late by one day, wanted to make something like this in a game jam...
    Thus I then tried 2.5d in 3D

    • @KindoSaur
      @KindoSaur  Місяць тому +1

      Aww man!
      I am sorry to hear that, hopefully you can apply this in the next Jam :)
      Keep me posted if you do!

    • @tejaswithme3713
      @tejaswithme3713 Місяць тому +1

      ​@@KindoSaur No issue brother! I'll let u know!!! ✨✨✨
      Btw, thanks for project file 🗃️

    • @KindoSaur
      @KindoSaur  Місяць тому

      No problem!

  • @desoft8b
    @desoft8b 28 днів тому +1

    This effect is well known as MODE 7 from SUPER NES.
    If you add that to the title of the video, more people will be able to see this video.

    • @KindoSaur
      @KindoSaur  28 днів тому +1

      Good suggestion, I had added this Mode inside of the Tags of this video so it should be visible already.
      I did see TheOneLoneCoder also use both names.
      Thanks for the heads up =)

  • @TheRealKaiProton
    @TheRealKaiProton Місяць тому +3

    Will this be continued to add collisions ?

    • @KindoSaur
      @KindoSaur  Місяць тому +4

      I am thinking about it as this was my favorite project to do =)

  • @Montagafy
    @Montagafy 16 днів тому +1

    This is REALLY cool appearance-wise, but you can do 2.5D in Godot with 2D assets in a 3D scene.

  • @derciferreira2523
    @derciferreira2523 25 днів тому

    What language is Godot written?

    • @Reznovelty
      @Reznovelty 24 дні тому

      Gdscript, similar to python. You can also use c#

  • @gustavols6699
    @gustavols6699 28 днів тому +1

    But I may ask... Why? (Im considering your goal is finish a game, not just learning)

    • @KindoSaur
      @KindoSaur  28 днів тому +2

      I really want to reintroduce retro game techniques to this era of development.
      So that Pseudo 3D (in this example) becomes more common and allow new unique games to be made.
      And I want to create an archive for myself for when I get stuck re-using this effect.

    • @Akahigep
      @Akahigep 23 дні тому

      Coz why not? Depends of what aesthetic or retro style you are searching for

  • @DeJach
    @DeJach 29 днів тому +1

    Nice video. I think you could skip the matrix multiplication section since most people should have learned that in algebra class, and if someone doesn't know it it's going to be a while before they understand the why of any of the other math. (Like, deriving the height matrix.)
    A cool extension would be to add a bit more fake 3D by procedurally extruding the colorful course blocks into cubes.

    • @KindoSaur
      @KindoSaur  29 днів тому

      There is a game made for the Gameboy Advance called Asterix and Obelix XXL. And there they have full fake 3D environments and objects.
      I reaally wanna know how they did that, maybe what you're saying is a part of that puzzle.

  • @ryonagana
    @ryonagana 24 дні тому

    nintendo did it using assembly and a limited hardware, limited color pallete

  • @lizardrain
    @lizardrain 29 днів тому +3

    Dealing with all that matrix math is unnecessary if you just rely on Godot's built-in 3D engine. You can achieve the same effect with a flat polygon plane for the terrain and a 3D camera. This is only worthwhile as a developer exercise to learn the math and recreate history. An end consumer will not care how it is created.

    • @KindoSaur
      @KindoSaur  29 днів тому

      That is indeed true,
      In the end it does not really matter to the player what is done to present a game to them. But if you wanted to make an actual Retro game for a real Retro system, Godot could help you Demo the idea as this doesn't require you to setup OpenGL with GLFW (to name something).
      And for some it might even present a solution to other types of shader effects :)

    • @herrlehrer1479
      @herrlehrer1479 25 днів тому

      But that is not pseudo 3D

  • @UltimatePerfection
    @UltimatePerfection Місяць тому +9

    Why do this when you can do real 3D and make it look like pseudo 3D, saving time for the same end result?

    • @KindoSaur
      @KindoSaur  Місяць тому +11

      The reason for me making this effect within a shader has to do with the fact that it allows for an extra challenge, which I always like, and also getting to know the WHY and HOW this effect was/is done.
      It might also help people look for different approaches to solve certain issues, since both your approach and my approach come with positives and negatives.
      Thanks for your question :)

    • @ikec-pw5sb
      @ikec-pw5sb 24 дні тому

      "Why so much work when-"
      Vibes. The vibes, man

    • @wouf_
      @wouf_ 16 днів тому

      If you care only about result I’m just telling you it doesn’t really work like that in the industry, it’s fine tho, but also a bad practice 🤷‍♂️

  • @bilyez
    @bilyez 27 днів тому +1

    why wouldn't you use 3D?

  • @owenlloyd2528
    @owenlloyd2528 29 днів тому +1

    Thank you