Love3D

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.
DMAshura
Prole
Posts: 1
Joined: Fri Nov 30, 2012 7:21 am

Re: Love3D

Post by DMAshura »

I'm getting pretty good frame rates in general, but I've got a different question ... what's the best way for me to decide which objects are in front of others and still have it draw at a decent framerate? I noticed in my demo if I put polygon drawing and ring drawing in the same for loop, it's slow, but if I do rings separately it's much faster ... but this won't help me if later on I want some polys to be drawn in front of rings.

Anyway, you can move around using left, right, up, down, w, and s. Though ... weird things happen when you move forward enough...
Attachments
sonic3d.love
(5.33 KiB) Downloaded 117 times
User avatar
substitute541
Party member
Posts: 484
Joined: Fri Aug 24, 2012 9:04 am
Location: Southern Leyte, Visayas, Philippines
Contact:

Re: Love3D

Post by substitute541 »

DMAshura wrote:I'm getting pretty good frame rates in general, but I've got a different question ... what's the best way for me to decide which objects are in front of others and still have it draw at a decent framerate? I noticed in my demo if I put polygon drawing and ring drawing in the same for loop, it's slow, but if I do rings separately it's much faster ... but this won't help me if later on I want some polys to be drawn in front of rings.

Anyway, you can move around using left, right, up, down, w, and s. Though ... weird things happen when you move forward enough...

It's best to post here. I am assuming that DM is using my lib. The poly thing is easy, just change the zsorttriangle functions to use with other polys (add more z positions to the getAvg function; it supports an infinite amount of arguments).
Currently designing themes for WordPress.

Sometimes lurks around the forum.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Love3D

Post by Jasoco »

As someone who has also been experimenting with 3D a lot, it's best to use table.sort to sort all objects by their distance from the "camera". This includes all triangles as well as sprites.

And in your Sonic prototype I notice you need to also make it not show objects that are behind the camera. Otherwise you get that weird "objects on the ceiling moving away" look.
User avatar
Codex
Party member
Posts: 106
Joined: Tue Mar 06, 2012 6:49 am

Re: Love3D

Post by Codex »

900 FPS on the last demo. I might dabble in 3D in a year or two, so I'm looking forward to seeing what you can come up with in the meantime!
User avatar
substitute541
Party member
Posts: 484
Joined: Fri Aug 24, 2012 9:04 am
Location: Southern Leyte, Visayas, Philippines
Contact:

Re: Love3D

Post by substitute541 »

Jasoco wrote: And in your Sonic prototype I notice you need to also make it not show objects that are behind the camera. Otherwise you get that weird "objects on the ceiling moving away" look.
That is the effect of the calculation I made :

Code: Select all

scale = fl/(fl + z)
So for z = -fl, the scale becomes infinite, then for z < -fl, it inverts.
Currently designing themes for WordPress.

Sometimes lurks around the forum.
User avatar
Darky
Citizen
Posts: 66
Joined: Sat Jun 02, 2012 1:41 pm
Contact:

Re: Love3D

Post by Darky »

more sonic 3d stuff plz ! :D
http://darky-ben.fr/Xut my webcomic (french)
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], zingo and 1 guest