Page 1 of 3

3D Polygon Rendering Engine!

Posted: Thu Dec 27, 2012 4:52 pm
by arundel
I've seen that this had been done countless times; on youtube I've seen some demo's and on the löve forums were some cool demo's too of applications able to render 3D stuff, but rarely was it possible to look in all directions and fly anywhere you want with those engines. Mine can. :3
I was planning on making 3D games with it, but I didn't want them to be untextured. And like I've read a lot, and all of ya probably know, textured polygons aren't supported (yes, you can make them, but they need to be preloaded in a canvas/whatever and can't be skewed according to perspective and depth. A real game needs perspective correct textures that change in real time, and unfortunately, that's not really what löve can do). I'm not gonna plot pixel by pixel textures. First of all, that would be affine textures, so not really usefull. Secondly, it's too memmory expensive.

Okay, so I got around 10 FPS with +3000 triangles. Z-indexing does work, but polygons that are "too large" and who's vertices aren't in your field of view will end up with vertices being rendered in the wrong spot on your screen. The engine can directly load models that were made in modelling software by providing polygon vertices. The polygons are collored according to the lighting matrix, which is a vector. I could give a lot of details, but it's all inside the code, which I'm not giving out at the moment.. It's unfinished (srsly, it's not the kind of excuse I'd like to use). Please don't be mad that I come here without giving a demo.
I need suggestions, or ideas of what I could do with this (possibly to improve it). Ask me for details about the engine and coding, I'll be happy to answer. :D

Video with demo:

[youtube]http://www.youtube.com/watch?v=kXWboA5JVYI[/youtube]

Example helicopter (3000+ polygons):
helicopter
helicopter
Love 3D renderer heli.png (39.62 KiB) Viewed 5561 times
Gas station or something (8900 polygons):
gas station
gas station
Love 3D renderer gas station.png (202.74 KiB) Viewed 5548 times
Yay. I'm not good at typing forum posts with scructure. But I do love coding :3

Re: 3D Polygon Rendering Engine!

Posted: Thu Dec 27, 2012 4:55 pm
by Roland_Yonaba
Oh my -.
That looks awesome...
Are you willing to post a *.love file, by any chance ?

Re: 3D Polygon Rendering Engine!

Posted: Thu Dec 27, 2012 9:43 pm
by Jasoco
Competition. Doesn't scare me.

Re: 3D Polygon Rendering Engine!

Posted: Thu Dec 27, 2012 10:41 pm
by 10$man
Wonderful work :)
I'm looking forward to testing this out!

Re: 3D Polygon Rendering Engine!

Posted: Fri Dec 28, 2012 9:03 am
by Roland_Yonaba
Jasoco wrote:Competition. Doesn't scare me.
Well, you should. :awesome:
Cause actually, I don't know what's going on, but it seems lots of people are diving into simulating 3D. Or 2.5D.

Re: 3D Polygon Rendering Engine!

Posted: Fri Dec 28, 2012 12:10 pm
by mickeyjm
That looks really awesome, but judging by the 3 fps hiding in the second image i dont think it will be able to become anything more than Proof of Concept :(

Re: 3D Polygon Rendering Engine!

Posted: Fri Dec 28, 2012 2:27 pm
by arundel
Jasoco wrote:Competition. Doesn't scare me.
The more people reading about 3D graphics and sharing their 3D projects, the easier it will become to improve one another's stuff (and your own) due to the the knowledge made available, and it may inspire some. :D
Btw, Jasoco, I like your 3d projects. It does inspire me. :3 But also when looking at other 3d renderers that folks over here have made and how they bypassed all kinds of limitations that the 2d framework had, it makes me think about alternatives in order to bypass those.
mickeyjm wrote:That looks really awesome, but judging by the 3 fps hiding in the second image i dont think it will be able to become anything more than Proof of Concept :(
It does show prove of concept and I know that it has been done before countless times. I was planning on making small games with it, but I think that the engine needs to be improved first (both mine and Löve itself).

Re: 3D Polygon Rendering Engine!

Posted: Fri Dec 28, 2012 4:02 pm
by Roland_Yonaba
That gas station....
Seriously, man, that is just...mindblowing :)

Out of the engine itself, how did you model those scenes, btw ? I mean, how you got coordinates for the set of triangles.

Re: 3D Polygon Rendering Engine!

Posted: Fri Dec 28, 2012 7:47 pm
by slime
arundel wrote:
Jasoco wrote:Competition. Doesn't scare me.
I was planning on making small games with it, but I think that the engine needs to be improved first (both mine and Löve itself).
LÖVE is intentionally designed to work specifically with 2D games. Making it work better with either a software/'non-native' 3D implementation or providing API functionality to make 'native' 3D rendering possible won't be improving LÖVE itself, unless the changes directly benefit LÖVE's API for 2D use cases.

Re: 3D Polygon Rendering Engine!

Posted: Fri Dec 28, 2012 8:45 pm
by arundel
@slime,
yeah, löve stays a 2d engine after all. I didn't mean that I needed support for 3d, because as you can see, that's already possible. You can call it pseudo 3d, or the hacky way to use a 2d engine, but it works and I like the outcome. It's more the built-in functions I really need in the future, like texture support with triangles and such (so not static images loaded in canvases, because you know, a scene can be static but the camera moves constantly and so each pixel in a texture needs to be updated according to camera orientation and vertex positions, etc.)

@Roland_Yonaba,
I convert the coordinates from a .3ds or simillar file to something like:
{{0,0,0},{0,0,0},{0,0,0}}
First subtable is a vertex coord, second one is a texture coord, third one too I think.
To scale the mesh, you just have to multiply each vertex's x,y or z by a scale factor. When you do that to all vertices, the vertices move away from the mesh's origin and it will scale up.
The mesh can have all kinds of properties like transparency, visibility, matrix orientation (position and rotation), color, polygons (obviously), staticity, mode, fill, texture (work in progress), etc.