Page 1 of 1

Cast shadows in basic lighting

Posted: Fri Mar 30, 2018 9:51 am
by aunaseef
How can I make objects cast shadows in basic lighting like the soldier model does.
Also, Is there a tool to bake lights for Torque? I can't pay $500 for the tool on gg website.
It's been years since I used Torque 3D.

Re: Cast shadows in basic lighting

Posted: Fri Mar 30, 2018 11:03 am
by Duion
Well there is a reason it is called basic lighting, you will also need to convince the people working on Torque3D to not rip it out, since they are planning on removing it.

To your question, I noticed there is simple lightmap baking for terrains in Torque now, but not for objects. For the dynamic shadows the player casts, you may be able to add it to other dynamic objects as well in source code, since it seems to be there somewhere. However I would not recommend it, since the last time I tested the player shadows on basic lighting I noticed that the shadows are cast through static shapes, so in case of my buildingsite map, the shadows will leak through the ground and will give players position away, so that kind of shadow only works if you have just one layer of terrain with not much different levels elevations.

Don't buy the tool for $500 since it is not in development anymore, so no support for that. But you can easily bake lightmaps in blender, you add a second UV layer, bake the lighting and add it into the second UV layer as texture in blender using lightmap or whatever blend mode, then it will work.
However keep in mind, that you cannot do this with dynamic objects obviously as well as the Torque terrain, but if you do the whole scene in blender, you can bake everything there and just export it into the engine and it will look basically the same as you baked it. If you build everything as a single static mesh and bake it all into one texture, you will get extremely good performance in Torque, the last time I tested that I got around 600 FPS in Torque with a 5000 polygons level.

Re: Cast shadows in basic lighting

Posted: Fri Mar 30, 2018 11:30 am
by aunaseef
Thanks @
User avatar

I'll try building the whole scene in Blender. Advanced lighting doesn't perform well on my low end PC, But it looks really good. Is there any way to improve the performance?

Re: Cast shadows in basic lighting

Posted: Fri Mar 30, 2018 1:41 pm
by Duion
Well you should not develop for your computer, but for the targeted audience computers and if your development machine is not good enough for that, you should consider upgrading.

There are lots of ways to improve performance, it depends on your scene. The most basic metric is polygon count and drawcalls. You can display the metrics inside the game and then see what can be improved.

Re: Cast shadows in basic lighting

Posted: Fri Mar 30, 2018 3:04 pm
by aunaseef
I'm not going to make video games, Just trying to learn Torque 3D for now.
And I want to make something playable, Graphics doesn't matter.Just posted this question to find a way to at least get some shadows. I'm fine without that.

I tried importing lightmapped scene from blender, It looked nice but not suitable for outdoor scenes. I have to design the entire world inside Blender.

For performance, I just have to upgrade my PC.

Re: Cast shadows in basic lighting

Posted: Fri Mar 30, 2018 3:57 pm
by Duion
The advanced lighting plus postFX systems like SSAO are doing a good job at outdoor scenes, at the cost of performance of course, but this should not be an issue nowadays where people have good hardware.

I recently bought a Geforce 1050 for around 110 dollars and it can run my game maxed out at over 60 FPS, I think anyone can afford that, then your game will not only run smooth, but also run so at max settings.

Re: Cast shadows in basic lighting

Posted: Sun Apr 01, 2018 7:14 pm
by Happenstance
I believe Basic Lighting is setup to only render shadows from ShapeBase-derived objects (that'll be StaticShapes, Player, Item, etc.). You can change this in the engine but BL shadows should be used sparingly, ideally only for a few dynamic objects. Advanced Lighting is really the way to go if you're looking to have an entire scene rendered with realtime lights and shadows.

Re: Cast shadows in basic lighting

Posted: Thu Apr 05, 2018 8:35 am
by JeffR
As Happenstance said, the projected shadows that Basic Lighting does is basically a weird special snowflake thing that integrates into specific classes.

It doesn't help right this second, but one thing I've been working on is an overhaul of the RenderPipeline, which will let us standardize out a lot of stuff(and cutting out a lot of cruft should help performance some, too).

While what Duion mentioned is technically correct in that Basic Lighting in it's current iteration will be going away, I fully plan to have a Forward Render pipeline that will behave similarly, just, you know, without a lot of weird, old duplicated code complicating the crap out of everything, haha.

There's a few things in the future we're eyeballing that'll help lights performance too(Light Atlases for example), but it would also be possible to write a component that when attached to an entity, would do the classic projected shadows. Not as efficient, but you could be VERY selective about what it works on.

Leading on from that, how's the performance on your machine if you use the Advanced Lighting, but then disable all shadows? Is it a lot better? Or does it still hurt. It's pretty well known that deferred rendering hits low end and integrated chips hard due to the higher memory bandwidth requirements, but sometimes killing the shadows makes a large enough difference it doesn't matter so much.