Hi, I'm trying to code an algorithm which can make a fake 3d ground/floor like, e.g., in super mario kart (here's a video: http://coolrom.com/roms/snes/7973/Super_Mario_Kart.php).
I'm trying with the kx and ky parameters of love.graphics.love (and rotation) but not sure of what should I do.
I have only this: https://mega.co.nz/#!E8BUVDYQ!a--OQQxb0 ... fFf1ExjWSk
the ground and the rocks (that are suposed to rotate along the ground) rotate with left and right arrows.
What would be a good technique? Many thanks.
How to make a false floor in 3D?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- alberto_lara
- Party member
- Posts: 372
- Joined: Wed Oct 30, 2013 8:59 pm
Re: How to make a false floor in 3D?
What you want to achieve is called Mode 7. Unfortunately it is not possible to achieve with LÖVE's onboard functions. kx and ky always do affine transformations. That means that two parallel lines in the texture always stay parallel.
Some people on this forum have implemented Mode 7 in LÖVE. Have a look here, for example or use the forum search.
For a few cases it is possible to use kx and ky to get a 3d effect by applying a transformation on the image in a preprocessing step. I posted an example here, but this method is not very common and only works in very restricted cases.
Some people on this forum have implemented Mode 7 in LÖVE. Have a look here, for example or use the forum search.
For a few cases it is possible to use kx and ky to get a 3d effect by applying a transformation on the image in a preprocessing step. I posted an example here, but this method is not very common and only works in very restricted cases.
Check out my blog on gamedev
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: How to make a false floor in 3D?
I am going to give a blind strike here and say that you can probably implement mode 7 with shaders. But I have no idea how.
When I write def I mean function.
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: How to make a false floor in 3D?
I made a Super Mario Kart clone a while ago using the fake Mode 7 Canvas technique I learned for the other project I was doing at the time, a Wolfenstein 3D clone with floor texture support. (Like Blake Stone) It uses canvases to the extreme though as it requires two separate large canvases per surface. So it might not be optimal for projects where you want to keep support high.
My code was a mess though. But if you want to look at it, it's in one of the files in this zip file, probably game.lua..
https://www.dropbox.com/s/mwr7ncynxeenvfx/Kart.zip
It's not that good though as graphically it looks bad so you probably won't want to use it. But whatever. I'll be removing the file from my DropBox probably next week so grab it while you can. It's also for 0.8.0 I think and is really outdated.
But shaders or something are probably a better method.
Bottom line, 3D in Löve is one of those things everyone has tried, including me. Some of us have done some really cool stuff actually. (I've posted video examples numerous times in other threads. A couple are right here, two of the 3D examples are my own.) But it's not something Löve is built for out of the box.
My code was a mess though. But if you want to look at it, it's in one of the files in this zip file, probably game.lua..
https://www.dropbox.com/s/mwr7ncynxeenvfx/Kart.zip
It's not that good though as graphically it looks bad so you probably won't want to use it. But whatever. I'll be removing the file from my DropBox probably next week so grab it while you can. It's also for 0.8.0 I think and is really outdated.
But shaders or something are probably a better method.
Bottom line, 3D in Löve is one of those things everyone has tried, including me. Some of us have done some really cool stuff actually. (I've posted video examples numerous times in other threads. A couple are right here, two of the 3D examples are my own.) But it's not something Löve is built for out of the box.
- master both
- Party member
- Posts: 262
- Joined: Tue Nov 08, 2011 12:39 am
- Location: Chile
Re: How to make a false floor in 3D?
I like how you search that post with the word uselessJasoco wrote:(I've posted video examples numerous times in other threads. A couple are right here, two of the 3D examples are my own.) But it's not something Löve is built for out of the box.
- alberto_lara
- Party member
- Posts: 372
- Joined: Wed Oct 30, 2013 8:59 pm
Re: How to make a false floor in 3D?
Thanks to all for the answers, I don't know a lot about shaders but I'll take a look.
About that "LOVE doesn't do anything" thread... I hope it's just a sarcastic joke.
About that "LOVE doesn't do anything" thread... I hope it's just a sarcastic joke.
- alberto_lara
- Party member
- Posts: 372
- Joined: Wed Oct 30, 2013 8:59 pm
Re: How to make a false floor in 3D?
Jasoco, I guess the Kart game was made for löve 0.8.0, I 'm trying to change the code to 0.9.0 but I get this and I don't know why:
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: How to make a false floor in 3D?
It was a troll.alberto_lara wrote:About that "LOVE doesn't do anything" thread... I hope it's just a sarcastic joke.
I am so glad I left that part in the URL. It was the only way I could remember how to find the thread.master both wrote:I like how you search that post with the word useless
It's an old project that never went anywhere. Sadly the code for drawing the floors relies on the raycasting code the original project was based on. The reason you are getting the error is because the map doesn't exist. I don't know why it doesn't. I might have deleted it, or it never existed. Or I was in the middle of coding when I gave up on the project. Either way, it won't work. Tell you what...alberto_lara wrote:Jasoco, I guess the Kart game was made for löve 0.8.0, I 'm trying to change the code to 0.9.0 but I get this and I don't know why:
Edit: DropBox link removed. Instead, go to this thread post where I just discovered I had already uploaded this code to the forum, lololol
http://love2d.org/forums/viewtopic.php? ... 76#p105928
This project probably actually works. It's my 3D Wolfenstein clone engine as it was when I stopped working on it. It might actually work. Just remember, it still relies on the same raycasting math your current project might not use. I remember having a problem getting the floor and walls to line up correctly. And yes, it's for 0.8.0.
Edit: I'll explain how it works. It works by creating a floor canvas that consists of the entire floor map predrawn onto a canvas. This floor canvas is drawn onto a container canvas of a significant size (Usually the same size as the floor) at the rotation and offset of the camera. Then, an array of quads is created from top to bottom of the container. Lastly, the floor casting function creates an array of rays from the central vertical point to the bottom of the screen and scales them based on the distance from the camera. Thus you get the illusion of a floor. Reverse the process for a ceiling. It doesn't look perfect though. Since it's canvases, you either need to use small canvases with low resolution textures or rely on a very small fraction of users being able to run it in order to get larger ones.
Last edited by Jasoco on Fri Dec 20, 2013 7:43 am, edited 1 time in total.
- alberto_lara
- Party member
- Posts: 372
- Joined: Wed Oct 30, 2013 8:59 pm
Re: How to make a false floor in 3D?
Ok, thanks anyway.
Re: How to make a false floor in 3D?
Wouldn't you be able to use a Mesh?
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 4 guests