Page 1 of 2

Lightmapping in Torque3D

Posted: Mon Sep 28, 2015 8:03 pm
by saindd
Although the realtime lighting in T3D looks OK, it really shows some age compared to other open-source rendering engines like Ogre and Panda. This could be "easily" fixed by introducing lightmapping, instead of refactoring the engine into supporting a modern approach like PBR and realtime GI (as seen in Tesseract).

Right now, i'm lightmapping my scenes in Blender. This has the disadvantage that i have to build all the scenes in Blender and export everything as a single mesh. And i can't use terrains. Is there any plans of adding a lightmapping solution to T3D? Maybe using an open-source offline rendering solution like:

https://github.com/tunabrain/tungsten
http://www.mitsuba-renderer.org/

Re: Lightmapping in Torque3D

Posted: Mon Sep 28, 2015 11:00 pm
by Azaezel
For what it's worth, I'll simply note two things in case someone with the time wants to hop on the notion:
1) Those .ml files spit out by basic lighting represent an extremely old version of lightmapping, so that might be a point to drill into.
2) Head already supports lightmapping usage, (UV2) just not generation. (As does PBR. so not an either/or situation.)

Re: Lightmapping in Torque3D

Posted: Tue Sep 29, 2015 4:46 am
by saindd

Re: Lightmapping in Torque3D

Posted: Tue Sep 29, 2015 5:15 am
by Azaezel
https://github.com/GarageGames/Torque3D ... n.cpp#L228 for the material entry
https://github.com/GarageGames/Torque3D ... o.cpp#L157 for flipping on the render target it draws to then blends in. (off by default in head)

Re: Lightmapping in Torque3D

Posted: Tue Sep 29, 2015 5:37 am
by saindd
Each individual material has a lightmap entry? That seems odd.

Re: Lightmapping in Torque3D

Posted: Tue Sep 29, 2015 5:52 am
by Azaezel
Extremely. But that is apparently what http://www.garagegames.com/products/purelight plugs into, so a bit hesitant to do much beyond ensuring that the sample @
User avatar
Steve_Yorkshire
was kind enough to throw my way to make sure that end didn't break, what with all the other little things on the present personal plate.

Re: Lightmapping in Torque3D

Posted: Tue May 17, 2016 1:38 am
by saindd
No ideas on how to plugin Blender lightmapping into this? Would be really useful to understand how Torque handles lightmaps from external tools.

Re: Lightmapping in Torque3D

Posted: Fri May 20, 2016 9:33 pm
by ThomasPittman
You should be able to put the lightmaps that you generate yourself from Blender into the same material lightmap slots. There's no support currently for generating UV2's or baking lightmaps directly inside of Torque3D. We had planned once on integrating pureLIGHT directly into the Torque3D editor but those talks fell apart years ago.

I don't remember all the details of how the Torque3D lightmapping works, its been many years since I last looked at it. There were flags to indicate which lights were included in the lightmaps to avoid double-lighting meshes. I don't know if much has changed since then.

I did experiment once with changing the way Torque3D internally stores its lightmaps. It wasn't too hard to make them assignable per mesh and point them at a part of a larger lightmap atlas instead of a separate texture like it currently requires. I believe I still have the code for doing that kicking around on my computer, though that would have been for a version of Torque3D many years old by now.

Re: Lightmapping in Torque3D

Posted: Sat May 21, 2016 12:53 am
by Duion
So Torque had internal lightmapping support once?

Re: Lightmapping in Torque3D

Posted: Sat May 21, 2016 5:44 am
by Azaezel
@
User avatar
ThomasPittman


Not breaking purelight was one of the self-set priorities this end when doin the work thusfar (I wasn't about to be the one to tell folks they blew 500 bucks on nothing with no alternate), so hasn't been much change there. The render target in the backend's been bumped up a from a floating 2nd to a (once we get pbr in) fixed 3rd, and cubemaps assigned to mats on the pbr end multiply into em, but the secondary UV lookup, represented in lightmap ect ect are all still there. Even kept around the hooks for the basic lighting partial lightmapping generators (though don't believe those .ml *results* have been hooked up for quite a while now). By all means, knock yourself out,