Page 1 of 2

"Cubes"

Posted: Fri Jan 04, 2013 3:04 pm
by Nixola
Hi, since there are many people interested in it I decided to start playing with 3d. Yesterday I coded "What?", today I'm trying to code a cube visualizator. It takes some cubes (two cubes, now) and renders them. I managed to create a program that is able to take some list of 8 points each and turn each of them into a cube, and the camera is able to move on the X, Y and Z axises (? plural of "axis") and turn right and left by 90° (ALMOST buglessly), I'd make turning up an down possible but I'd have to hardcode 12 directions and I don't want to do that, 4 are enough. The problem is, I don't know how to make the camera able to turn if not by 90°... Could someone please help me about this? I tried googling it, but I didn't find anything particulary related...

Re: "Cubes"

Posted: Fri Jan 04, 2013 3:09 pm
by mickeyjm
Look interesting so far. btw the plural of axis is axes. Im not sure what you mean by turning by not 90°but if you look at my demo i uploade (at the same time you did LOL) I have a rotateable camera if tha is what you mean.

I know what you mean about google though, when I was looking for tutorials on 3 google was obsessed with 3ds max and maya and blener and all the other 3d animation programs :x

Re: "Cubes"

Posted: Fri Jan 04, 2013 5:55 pm
by 10$man
Hello!
First of all, good work!

Ok, so when I first started trying to learn how 3d projection worked, I used some websites. I can't find them now, but these ones seem to be good too:
http://www.netmagazine.com/tutorials/bu ... -3d-engine
http://soft.vub.ac.be/~tvcutsem/teachin ... /les7.html
http://www.cubic.org/docs/3dclip.htm

Sure, none of them are relative to Lua, but the idea is the same. Good Luck :)

Re: "Cubes"

Posted: Sun Jan 06, 2013 2:35 pm
by Ubermann
I got this when trying to run it:

Code: Select all

main.lua:6: attempt to call field '_openConsole' (a nil value)

Traceback

main.lua:6: in main chunk
[C]: in function 'require'
[C]: in function 'xpcall'

I'm running Ubuntu Linux 12.

(? plural of "axis")
Axes. Like axes. Like several items whose singular form is axe. Like the tool you use to kill trees.

Re: "Cubes"

Posted: Sun Jan 06, 2013 2:39 pm
by Nixola
That function is windows only, it's to run the terminal without having a conf.lua (lazyness... it's an evil beast). I'll change the .love in a moment

P.S: thanks for the 'axis' plural ^^

Re: "Cubes"

Posted: Sun Jan 06, 2013 3:22 pm
by Ubermann
Nixola wrote:That function is windows only, it's to run the terminal without having a conf.lua (lazyness... it's an evil beast). I'll change the .love in a moment
I edited the code and removed that line.

It works fine. I only would say that using key repeat will be better for moving everything.

Also edited it to make screen 1024.768 instead 800x600

[E] doesn't work for me, or at least I can't see anything to change when pressing it.


And, after pressing [q] several times I got this:
v9o5N.png
v9o5N.png (237.25 KiB) Viewed 277 times

And got this after playing a bit with it:
dYSTJ.png
dYSTJ.png (241.08 KiB) Viewed 277 times

Sorry for the big screens. I'm lazy to edit them now :P

Re: "Cubes"

Posted: Sun Jan 06, 2013 3:28 pm
by Nixola
Well, since you edited the code I can't know what line caused the error... I pressed it like 100 times and I didn't get any error though
I don't know why E doesn't work, with the same .love file it works as expected here

About the strange "artifact", it happens when you're inside a cube, I have to code the part that prevents invisible points' rendering

Re: "Cubes"

Posted: Fri Jan 11, 2013 4:57 pm
by xXxMoNkEyMaNxXx
Nice job, this gives me an idea of putting a render mode for each surface on my Brick objects in my 3D Rendering Engine :D
Also, how do you get that console open, and what does it do? It seems like a debugging tool, which would be useful.

Re: "Cubes"

Posted: Fri Jan 11, 2013 5:45 pm
by Nixola
You can open it by setting t.console true in love.conf, you can then print values there by calling print(...)

Re: "Cubes"

Posted: Sat Jan 12, 2013 6:34 am
by substitute541
I thought you already knew the plural of axis. Didn't I said that before in my own 3D engine? Oh and, nice work with that :3 .