How to make a false floor in 3D?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: How to make a false floor in 3D?

Post by micha »

No you cannot. See this image from wikipedia:
Image
User avatar
Ref
Party member
Posts: 702
Joined: Wed May 02, 2012 11:05 pm

Re: How to make a false floor in 3D?

Post by Ref »

Is this anywhere near what your want to do?
I have created a front-end loader for xXxMoNkEyMaNxXx shader which makes life a little easier.
Edit: Or maybe something like this- the textured quad. Just a thought.
Attachments
texturedQuadLove9.love
Animated quad
(14.74 KiB) Downloaded 138 times
3DPlaneLove9.love
Shaded plane
(6.55 KiB) Downloaded 154 times
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: How to make a false floor in 3D?

Post by slime »

micha wrote:No you cannot. See this image from wikipedia:
Image
You can use a Mesh, you just need to do some trickery in a vertex shader, e.g. using a custom perspective projection matrix and storing the Z-component of the position of the mesh vertices as a texture coordinate or color component (and then making use of it in the vertex shader.)
User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: How to make a false floor in 3D?

Post by micha »

slime wrote:You can use a Mesh, you just need to do some trickery in a vertex shader, e.g. using a custom perspective projection matrix and storing the Z-component of the position of the mesh vertices as a texture coordinate or color component (and then making use of it in the vertex shader.)
Thanks. Good to know.
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: How to make a false floor in 3D?

Post by alberto_lara »

Well, I really want to learn how to do something like this:
Image

The reason is that I want to make something like a star wars racer tribute (just for fun), I was thinking of doing a version like in the gb color:
Image
But not convinced of the eagle vision for this kind of game.

Anyway, what I want to do (at least for the very first version) is a totally retro version (NES style) and aside (for now) the mode 7 technique.
This is what I wanna do (the ground in the game even has hills which are ups and downs throughout the race):
http://www.youtube.com/watch?feature=pl ... gfrc#t=108

I'm relatively new to this stuff so I could be wrong/confused about many things but any help would be welcome, many thanks for your answers.
User avatar
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?

Post by Jasoco »

Ref wrote:Is this anywhere near what your want to do?
I have created a front-end loader for xXxMoNkEyMaNxXx shader which makes life a little easier.
Edit: Or maybe something like this- the textured quad. Just a thought.
Some observations I've made of xXxMoNkEyMaNxXx's (God, that's so hard to type!) textured polygon shader from using it in my 3D project since the beginning: (And I thank him for making it for me)

If you "setMode" after the library has already been loaded, it stops working forever until you relaunch the game. You can't just reload the library or anything. It just stops working.

It's based on the width and height of the window. So you can't just draw to a smaller or larger canvas and have it work. I have not been able to figure out how to pass a custom width to the code. You can pass a custom height by replacing the love.graphics.getHeight() part in the code, but there's no way to pass a width and it is very constricting.

It is pretty slow when using a lot of textures. I think it's because for every separate instance of a textured polygon, it runs over the entire screen size. I've done performance tests and it can cause some pretty steep framerate drops if you have a lot of textures at once.

If those three problems could be fixed somehow, I'd use the library more often. But I've looked the code up and down and cannot come to a solution. If only Löve had this ability built in. Shame Mesh's don't work like we would love them to.
slime wrote:You can use a Mesh, you just need to do some trickery in a vertex shader, e.g. using a custom perspective projection matrix and storing the Z-component of the position of the mesh vertices as a texture coordinate or color component (and then making use of it in the vertex shader.)
If someone could create the code required to do this, they'd be heralded as the Hero of Canton. I'd build a statue of them in the town square out of mud. Especially if it didn't rely on the window size (Rather could rely on a custom target width and height if needed) and didn't stop working when setMode is used after it's been loaded. (Also the framerate thing, though not as important with LuaJIT.)
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: How to make a false floor in 3D?

Post by slime »

Jasoco wrote:If someone could create the code required to do this, they'd be heralded as the Hero of Canton. I'd build a statue of them in the town square out of mud. Especially if it didn't rely on the window size (Rather could rely on a custom target width and height if needed) and didn't stop working when setMode is used after it's been loaded. (Also the framerate thing, though not as important with LuaJIT.)
Someone already has created a small test using this technique (or at least a variant of it), but he hasn't posted it to the forums yet, and I don't think he's called Jayne. :)
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: How to make a false floor in 3D?

Post by alberto_lara »

slime wrote:
Jasoco wrote:If someone could create the code required to do this, they'd be heralded as the Hero of Canton. I'd build a statue of them in the town square out of mud. Especially if it didn't rely on the window size (Rather could rely on a custom target width and height if needed) and didn't stop working when setMode is used after it's been loaded. (Also the framerate thing, though not as important with LuaJIT.)
Someone already has created a small test using this technique (or at least a variant of it), but he hasn't posted it to the forums yet, and I don't think he's called Jayne. :)
I really would like to know where to find that :)
User avatar
Ref
Party member
Posts: 702
Joined: Wed May 02, 2012 11:05 pm

Re: How to make a false floor in 3D?

Post by Ref »

Jasoco made some interesting observations regarding xXxMoNkEyMaNxXx's shader.
1. I haven't experienced his problem with setMode. Just ran a test and everything kept running???
2. Speed hit is related to area over which the shader is operating - obviously. Simple solution is to use (caution, dirty word coming) a canvas. A canvas solves both the frame rate drop and control over operational area of the shader.

The use of a canvas for Jasoco's 3D animations probably would not be what he wants but should be OK for a periodically changing 3D background. It's all about appropriate (creative) use of a tool.
User avatar
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?

Post by Jasoco »

Ref wrote:Jasoco made some interesting observations regarding xXxMoNkEyMaNxXx's shader.
1. I haven't experienced his problem with setMode. Just ran a test and everything kept running???
2. Speed hit is related to area over which the shader is operating - obviously. Simple solution is to use (caution, dirty word coming) a canvas. A canvas solves both the frame rate drop and control over operational area of the shader.
1. You ran setMode after loading the library? Because if you only setMode before loading the library (require 'Perspective') then it works fine until you try to change the window mode again. Are you on 0.8.0 or 0.9.0? Because it has failed for me on both.

2. Not sure what you mean by this because the way I use it is for my 3D project where everything is going to be changing every frame. So caching imagery for later isn't going to help when the whole screen changes. Don't really see how a canvas would apply here.

I'd like to see someone figure out proper perspective warping using Mesh's though.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests