Game Development Community

lighting and shadows, basic, advance, dynamic, static...�

by Lluis Andreu · in Torque 3D Professional · 11/02/2009 (4:00 pm) · 27 replies

Hi,

firstly let me let you know I´ve been searching info about lighting in Torque 3D for a while and I´ve got a little bit of a mess in my head in terms of terminology and concepts but I´ll try to be as much clear as I can in order to avoid asking a "tell me all you know about it" question.

I´ve got a scene which is a building where you can stay inside and outside. it has got different areas, elements, columns, structures but no walls that delimit any of those areas (so from the door you can visualize the whole building). At the same time it has got huge glass windows that let the sunlight get inside the building and light it a little bit (although you artificial lights as well).

I already built the whole building and added all the objects I needed and now I have to set up a proper lighting. My main issue is this project must be launched in a range of pc´s specs as wider as possible but at the same time we want to keep visual aspects like shadows, shaders, post FX...

The main concern we´ve got is the fact the use of dynamics shadows increases the amount of polys so it gets multiplied incredibly. Thinking about it we decided we don't really need the shadows to be "dynamic" as the scene is not going to be modified in any way once launched so the shadows can be considered "static" and here is where our doubts start.

I would need to know if there is any way to ask torque for pre-calculate the shadows in advance taking in consideration the lights that exist in the scene rather than calculate them in real time.

As I said, I�ve been taking a look at the forums and documentation about dynamic and static shadows, pure light, shadow map options in light settings... I need nothing too complicated. what a simple light does in advance lighting with cast shadows on is enough in terms of quality as soon as it doesn´t increase the polycount insanely.

Also I don´t really need you to write me a whole tutorial to how to do it from A to Z but I least I would need a bit of orientation or some key words I could need to find out what to do.

Many thanks for your help guys. really appreciated.

cheers!!
Page «Previous 1 2
#1
11/02/2009 (4:40 pm)
Lightmaps - it's the only way to get shadows without the expensive Advanced Lighting shadows, and the only way to get any sort of shadowing in Basic Lighting.

In Basic Lighting large meshes can only support 4 light sources, after that you'll find issues with the whole mesh blinking/turning black as it tries to work out which lights it should be using depending on the player/camera orientation. Lightmaps stop this.

If you'll forgive the spam - that's all done with lightmaps/tonemaps in Basic Lighting using pureLight.
#2
11/02/2009 (4:47 pm)
Static lighting/shadowing is known as "lightmap". It's a texture containing the light color/intensity for each point in your model's surface. T3D cannot generate those, you'll need an external application to generate both the lightmap and the UV map required for it to work (a process called "light baking" or "texture baking"). Pure Light is an external tool designed exactly for that, but there are many other ways to make lightmaps like 3DS Max, Maya, Blender, Gile[s], etc. Blender and Gile[s] are free, BTW, but I'm unsure about their ability to export Collada files.
#3
11/02/2009 (4:51 pm)
Blender does export Collada, though it can be a bit "iffy". I use it to get my Collada models into PureLight - though I've had "issues" getting the 2nd UV Channel to work as billed in a straight Blender DAE -> T3D export.

I've had a look at Gile[s] but never tried imports/exports.
#4
11/03/2009 (8:21 am)
hey guys!! many thanks for your answers!!

the use of shadow maps is basically what I had in mind at the very beginning. "pre-render" the shadows and forget about it, but what you explained to me involves new issues I need to ask you:

the way I build the scene is basically using tiled generic textures for almost everything and using multi-sub object materials so I wouldn't need to unwrap everything. That allows me to reduce considerably the amount of textures and those textures can be much smaller. On the other hand, the ground is a torque's terrain instead of being geometry. Also, the level has been built in torque instead of in Max so the can't bake the whole scene either.

I don't know if PureLight is the best solution or not, but if it is (although I can pay for it right know, is there any basic free version??) I have the level built in Torque only.

Then, my quick question would be if it is there any way to bake the lighting and the shadows in a scene when launching the mission (I don't know if Torque have such an option) and avoid them being dynamic.

For instance, I like the way it is done in the Burg Demo, but I assume that has been done using pure light; exporting the whole scene from the 3D software, pre-baking light maps and shadows in pure light and then exported to Torque. Am I right??

So, knowing these requirements about how I built my scene, have you got any advise could you give me to do this??

Again thanks a lot for your help and your time. Really appreciated.
#5
11/03/2009 (11:03 am)
The terrain in T3D can bake shadows (I believe there is a menu option for doing that). But you cannot have different static lighting for different objects without using a different lightmap for each one.

You could build your scene in a 3D software, without the terrain, bake the lighting and break the scene in multiple objects (if necessary), then place them in Torque.
#6
11/03/2009 (11:30 am)
@Manoel
Quote:terrain in T3D can bake shadows

Can it?
#7
11/03/2009 (11:01 pm)
@Steve - Yes... its old TGE tech that we retained. In a future version we'll probably expand it a bit to allow for higher resolution lightmaps (its currently only 256x256), but you'll never get the same quality as a PSSM.
#8
11/03/2009 (11:59 pm)
Ah, cool. Is there a menu option for using it? Just curious.
#9
11/04/2009 (4:14 am)
me too actually. I wouldn´t mind to give it a shot at least to check out how it looks like.

thnx!!
#10
11/04/2009 (4:22 am)
If your using Basic Lighting and a terrain... it will update it on mission start. If you want to force a rebuild its in the Lighting menu 'Full Relight'.
#11
11/04/2009 (5:22 am)
checked. that only would affect sun light wouldn´t it? I can´t do the same with point lights casting shadows.

on the other hand, is it possible to force dynamic shadows in basic light for static meshes in the same way it is done for the character??

#12
11/04/2009 (9:40 am)
Lluis, it should be possible with some source code changes, but I wouldn't recommend it, unless you keep the number of objects using such shadows low and avoid having too many of them together.

The basic lighting shadows use decals with dynamic textures. Having too much of those can cause quite an impact in performance. If you're developing a game that targets Basic Lighting as the main lighting method, the best way would be creating your custom shadow class.
#13
11/04/2009 (12:01 pm)
@Tom - oh yeah, I see. oooh ... I see about the x256 limit too ... urgh.
Anyhoo, curiousity satisfied.
#14
11/04/2009 (12:18 pm)
well, I don't really need the quality advance lighting gives but the one I get in basic lighting with some sort of acceptable shadows. So far I only could get a very poor shadow cast by the sun and only visible on the biggest objects (I assume because of the resolution the shadow have). Again, I don´t really very complex effects or shadows but at least something that maked everything to be less flat. I just need that a chair that is on the floor produces some sort of shadow on it, not even dynamically but pre-lighted during the mission´s loading.

Is that possible at all??
Is it possible to pre calculate all those shadows in advance for being used in basic lighting??
Is it possible to force dynamic shadows on certain objects?

Thanks a lot and sorry for being so insistent :)
#15
11/04/2009 (12:29 pm)
Technically ... you could export your heightmap and create an exteral mesh with a lightmap, set it to some sort translucent mul and overlay the terrain a few decimals above ------- for a hack job.
#16
11/04/2009 (12:45 pm)
so basically basic lighting is what it is, nothing more, nothing less :P

to be honest the options are a bit disappointing:

-basic lighting for an acceptable range of specs but poor looking
-advanced lighting for cool effects and lighting but at a huge cost
-forced to use pure light and, even worse, having to build the whole scene in max to pre bake the shadows and have a nice looking scene and run it in low-middle computers which also means multiply the hours of time considerably (set up uv, paint textures, one texture per model...).

Am I right?

On the other hand, I may be wrong on this supposition too but what´s the point on having an advance light which needs insane specs (always talking fron the thought game made with torque should be player in a wide range of specs) instead of improving the basic one with decent shadows, decent performance, etcetera
#17
11/04/2009 (1:53 pm)
Quote:
Am I right?

Yeah, I think that's about it.

Which is exactly like any game which has settings for quality vs performance.

My old 7series card could run Crysis (worst hackneyed dialogue EVAR) on low with good fps, medium looked nicer but was laggy and high was unplayable, and very high ... no chance.
#18
11/04/2009 (3:06 pm)
It's a tad ironic that not being able to build whole levels in max and bake lightmaps on them was a major reason for complaining against TGE and TGEA.

I find the requirement for AL's shadows have reduced a bit in 1.01 - In the betas any scene using PSSM was unplayable on my test 7900GS, but now I get 40fps in Deathball. With some tinkering, depending on your project (aka: if your game doesn't involve free-roaming in vast open-ended levels) you can reduce the precision of the AL buffers and get much bigger speed boosts. So much that one could use AL on a 9400M.

While an internal lightmap renderer would be nice, I can completely understand why it isn't there. An internal lightmapper would take a lot of work to write, and would look much worse than using external solutions (even free ones). Developers who can't use external lightmappers would never get good results from the internal lightmapper, and more experienced developers would shun the internal solution for an external one right away.

With some changes it should be possible to create a different BL shadow class for static object decal shadows, but one should be careful and not give in the easy temptation of giving every single object a shadow and completely run our of video memory.
#19
11/04/2009 (3:26 pm)
I for one welcome our new insect overlor - I mean the ability to build a whole level in a 3D package and get it imported (via PL) into T3D with the correct rotations and positioning-even if I did have to redo my entire first level after just finishing it.

Anyhoo, one great work pipeline for the rest of my world building.
#20
11/04/2009 (4:19 pm)
Well, I could use a tool that imported a collada file and breaked it into multiple TSStatics automatically somehow. Or being able to export the entire scene as a collada file to bake lightmaps for the entire thing elsewhere.
Page «Previous 1 2