Game Development Community

Problems with Blended Terrain

by Jay Verba · in Torque Game Engine Advanced · 02/13/2008 (9:11 pm) · 10 replies

OK. This might seem a like laundry list but I really need some solutions for these problems. First, let me start off by saying that I have been able to get Unique terrain into game working just fine with no problems. However, we are going to have the need for shadows on terrain. So, I began to explore blended terrains. I got everything to compile just find, I added the atlas terrain to my mission and launched the game. From there everything went find until I got to lighting the mission. It would just hang of lighting the Atlas terrain. So, what I did was change the LightMapDimension to 0, and voila the game loaded fine. But once in the game my texture maps and lightmap were not aligned properly at all. In fact, they looked a bit small to begin with. I am having great trouble figuring the problem out. We are all new here to Atlas terrain so any insight would help. Thanks so much for your time.

#1
02/14/2008 (5:47 am)
Did it crash or did it just sit there for a long time? As of 1.03 it calculates terrain lighting on load and that can take a LONG time if you have a big terrain. I wound up writing some code (it's in the forums here someplace) that would load a precreated lightmap so it wouldn't happen again.
#2
02/14/2008 (6:10 am)
The code i fuddled with"8 Textures for Atlas Working" is the thread, but it takes an external png for a light-map, and it loads pretty quick. As a side note I will be baking the shadows from trees, and other things on my maps into the light map, well for all statics anyway:) Try my resource I think its easier to use then the scripting of the blended into one atlas file;)
#3
02/14/2008 (7:42 am)
Thanks Bobby I will take a look into that. If I do bake the lightmap in will it still support dynamic shadows for Interiors and TSShapes?
#4
02/14/2008 (8:00 am)
@Bobby I am not seeing where in the thread it mentions how to fix this problem. I have seen this resource and it is great, great work. IF you can point me in the right direction that would be great. Thanks a bunch.
#5
02/14/2008 (9:09 am)
I thought you just wanted shadows on the terrain,as i can only get in some static ones, nd honestly baking them into the terrain lightmap isnt a great way to do it, but it does work. As far as dynamic shadows I I thought they only worked with DTS shapes?, which is probably why people are trying so hard to integrate the famous "Ben Garney opcode" " Poly Soup collision" for TGEA, this way you can have dynamic shadows like the ork has from everything. I can't get my interiors to cast shadows on anything other than themselves, not that it could not be done by a shader.

The best thing you could do where you have decided to use TGEA for an engine to build your game, is to get the hang of shaders, it is a language called HLSL, and it is kind of like C++ if you are familiar with it, or anything like C. Get Rendermonkey, it has a lot of shadow code in there. It is one of my next steps to get shadows all working they way I , and other like yourself want them, but I'm still working on other stuff, and doing my Calculus homework from college so you can Imagine that it doesn't leave me much time, but I do promise that as I go through my development list that I will post a lot, and any code that will help everyone out, and shadows should be started soon, possible the next month or two. Hope some of this info helps :)

Oh and by the way...I would wait until the new TGEA update comes out before trying to implement too many homespun fixes and what not, as it might cause a problem with what they release, which I hope is SOON! ;)
#6
02/14/2008 (11:53 am)
Yea, I hope that release is so. There are a few of us here that are quite familiar with shaders. The problem is always finding the man power to throw at them. Anyways, do you have any insight as to why the blended terrain hangs on lighting. It sticks on that AtlasDefferedObject:: setStreaming line. Also, when I did set my lightmapdimension to 0 it loaded but my textures were completely misaligned. Thanks for all your help so far, its been rather helpful. Thanks.
#7
02/14/2008 (9:32 pm)
Hmmm, Im not sure...Ill try to look into it. I know I get error when using my MOD..something about light-maps, but I thought that it was because I hadn't bothered to remove the displaying of those errors. Like it tells me that external light maps only work with blended terrains....as a work around go into one of the HLSL shader files and put an extra texture slot in, you can use my Atlas.h for a reference as well as the source code for my MOD, and you can see how i added in the external light-map, and you can pretty much just leave out everything else but that..just remember that all external maps need to be rotated 90 DEG clockwise;)

But as to why the blended function isn't working right I would get into the debugger, I think there is a way to see exactly what it is doing as I have heard others in the forum using a debugging setup to diagnose problems such as that, but I have not reached that in development phase of my project, and they haven't taught it in school, but i do take MMO design and systems Arch in about 6 months perhaps they will cover these things in some detail, and as I pick up more about this industries secrets i promise not to keep ya in the dark:)
#8
03/09/2008 (3:08 am)
@Bobby a bit up...

A little bit curious of what you say about polysoup and shadows.
Is this really something that will work!?
I mean...I assume you are thinking of people who build their entire levels with DTS's...but I can't imagine the engine handling that kind of amount of dynamic shadows?! Or am I way out here...?

I hope that some future update or resource would give us the ability to bake some shadows into our DTS's (I read somewhere of people trying to get an additional UV-channel to bake some lightmaps into...but then it still requires this to be done outside the engine. Or some heavy modification to the lightning system...).
#9
03/09/2008 (9:47 pm)
Not the entire level, just the buildings and what not, and with proper LOD on everything, it should be ok...lok at games like world of warcraft, you can see the culling of objects as you move around...ya know seeing them appear and disappear;)
#10
03/10/2008 (12:54 am)
Yeah...you're probably right.
One problem though....is that polysoup (at least not in the resource my programmer implemented) does not support Static Shape - just TSstatic's...and these do not cast dynamic shadows...right?

Anyway, I think that (since our buildnings/structures are not beeing destructable) a solution for baking shadows into the terrain is a more efficient way, performance wise.

Though we have to figure out a way to calculate shadows from the "polysoup" mesh rather than a collision mesh (as it's done now) since polysoup does not like having collision meshes interfere with the polysoup collision...