Game Development Community

dev|Pro Game Development Curriculum

GFX Vertex Lighting in T2D

by Paul Jan · 05/29/2013 (8:08 pm) · 11 comments

So far so good:

img35.imageshack.us/img35/507/screenshot2013053010383.png
That's a debug build, so the single digit framerate isn't bad.

Also I've added mesh commands to sprites because really large sprites with only 4 vertices tend to look odd when per-vertex lighting occurs.

Still want to kick this around a bit to see what bugs I've missed.

GFX currently only works on iOS and will remain that way for the foreseeable future. Basically I can either dive into shaders and multitexturing that will improve the unborn iOS games that are swimming in my head, or I can learn OSX and Windows API for the other users that I'm not even sure exist.

github.com/pchan126/Torque2D/tree/feature/gfx-lighting

#1
05/29/2013 (10:13 pm)
Really impressed, great job.

Stuff like this just screams out to be made a tentpole feature of T2D (perhaps on the roadmap for version 4.0), but to be that it really needs to be multiplatform. Obviously it is your time and effort so if you only want to focus on iOS then that is your decision. I just hope someone can pick up your work and get it functioning on Windows and OSX, I'd really like to see this end up in the master branch someday. I think it could attract a lot of positive attention for the engine, not to mention allow us to make some nice looking games.
#2
05/29/2013 (11:07 pm)
As always, awesome work, Paul.

Quote:I can either dive into shaders and multitexturing that will improve the unborn iOS games that are swimming in my head, or I can learn OSX and Windows API for the other users that I'm not even sure exist.

iOS
I say dive deep into the iOS and realize your dream games!

Simply sharing this with the community is an amazing gift to all and will surely prove useful for when we get to tackle this issue as a group.

Plus, nothing keeps iOS fans from simply forking your branch and getting to work on their dream game as well : that's the whole point.

Ghost users
The best way to make other users notice T2D is by having actual games made with it.

Even with Out-of-the-box multitexturing and shader support, T2D, as simple as it is to pick up and work with, is still very programmer-centric.
#3
05/30/2013 (1:55 am)
A little bugstomping later:
img826.imageshack.us/img826/7350/screenshot2013053016482.png
I'm a bit surprised at how good things look without having to breaking everything down into meshes...
#4
05/30/2013 (10:31 am)
Paul Jan,
This looks really great!

am curious what your plan for textures is...
hope this makes it into the mit branch
really promising stuff!!!
#5
05/30/2013 (12:16 pm)
Looks great and the FPS increase is impressive, that still a debug build?
#6
05/30/2013 (5:29 pm)
Sorry, but that's be the release build.
Now that the initial coolness has worn off, I'm working on making the settings accessable to TS, and I'm finding a few things troubling:

For vertex lighting to be more than a vague hand-waving where you can't really tell how bright the lights are, objects do need to be meshed so the distance between vertices doesn't get really large.

I've reduced the lighting radius down to 0.5 units, and added a meshing function to all sprites, which is capped to prevent really large sprites from making too many vertices.

It also looks like I need to incorporate layering.

img254.imageshack.us/img254/9024/screenshot2013053107414.png
#7
05/31/2013 (7:35 am)
Phenomenal work Paul. It is my humble opinion that others rally behind his effort. The potential goes beyond just having lights. A solid GFX implementation would provide many other bonuses. We could easier add DirectX rendering, which would perform well on Windows, as well as create a path for Windows 8 Apps. The abstracted rendering layer makes going to other platforms easier. The door for multiple shaders would open up.

I really hope one or two more folks volunteer to give him a hand with getting this up and running on the other platforms. If I had any spare time, this is something I would happily lend a hand with. Unfortunately, my spare time is in the negative.
#8
06/03/2013 (12:25 am)
You sir just gave me an hard on... i have too much on my plate right now, but i will sure take a stab at some point to get this to Windows/DirectX. Do you have the whole CG in there already or do you use GLSL directly? I am personally biased toward HLSL, so it's probably a good thing you started with the GL implementation hehehe.
#9
06/03/2013 (10:25 am)
Right now its a fixed set of GLSL shaders and use of the GLKBaseEffect class for iOS. With OSX 10.9 just around the corner I'm thinking about making a new 10.8 build that uses GLKit for OSX.

Theres something hinkey about adding and destroying lights thats causing existing lights to be shut down - gotta track down that bug.

Also I'm trying to make the scroll gui more touch-friendly. The toy selection menu is a nightmare to try to use on the iPhone.

Just finished fixing up the OSX build. Not tested at as much as the iOS build, but it works and should make a good launching point for a windows build.
#10
06/05/2013 (2:11 pm)
Hi Paul, I saw you are working on cleaning up the cube map files. I'm having trouble finding info on how cube maps are used in 2D though. Is this the basis for omnidirectional shadows?
#11
06/05/2013 (5:57 pm)
The cube map files are just for completeness sake. I'm not sure what I'd do with them.