Game Development Community

Bumpy Atlas Terrain... here's my latest attempt...

by Ves · in Torque Game Engine Advanced · 09/03/2007 (10:46 pm) · 52 replies

Well it was a huge pain, and I had to bump some shaders to 3.0 to get this to work (though I really think that's a mistake and it probably will all work in 2.0 shaders). I extended the base atlas shader (the clipmap pass shader) to include the bumpmapping. I had to move the lightmapping from the blended image cache section to this clipmap section as well. This is gross and no where near as elegant as I would like it but I did get it to work.

I also had to modify the atlas vertex format as well, as I needed the tangent on a vertex basis. I actually calculated the Binomial in the shader like everyone suggests but I think that might be the source of some the funky artifacts I get. I didn't modify atlas output yet as I am just verifying if this will work right now. So for the interum there is a stutter on loading a clipmap section as it calculates the tangents for all of the verticies at that point (thanks to some barrowed and modified code from the tmesh section).

Anyway here are some screens...

This is a great example of why you SHOULDN'T bump map everything in sight
i5.photobucket.com/albums/y153/vesuvias/whenbumpmaps_gowrong.jpg

high specular but it does move with the sun and player position
i5.photobucket.com/albums/y153/vesuvias/highspec_bump.jpg

Way too exagerated a bump map but its a good example bump
i5.photobucket.com/albums/y153/vesuvias/bumpy2.jpg

I actually like this one... specular is too high but its snow :)
i5.photobucket.com/albums/y153/vesuvias/bumpy1.jpg

The shaders I am using were adapted from mr noolness in this thread www.garagegames.com/mg/forums/result.thread.php?qt=36211, I am just using the standard normal mapping shader but I am pretty sure I can get the relief mapping one to work.

I set everything up so that I could followup with some code that actually uses different bump maps based on the terrian opacity map. So that will be my next goal. I may end up rewriting how terrains are blended though. I need to think on this somemore. I would really rather the opacity and lightmap be the only textures that are runtime merged via the clipmapping functions. Shaders should take care of the individual blending and bumpmapping I think. I may take a step even further back and try to get that to work. when I clean this up and if no one else has done a better one I will post a resource on what I did. Till then, comments and suggestions are welcome.

Ves

**Edited to replace images with image links... to save page loads....
#21
09/09/2007 (10:25 am)
"I would love to see what map makers that actually have talent could do with this "

Are you kidding? You do better than you give your self credit for:)
#22
09/09/2007 (10:18 pm)
Yeah Ves, this stuff is looking great!
#23
09/09/2007 (11:19 pm)
Looks amazing
#24
09/10/2007 (8:10 am)
The fact that you seem to have specularity turned on makes the terrain look like its wrapped in plastic, kinda funny. ;) Excellent work though. I always knew that Atlas wasn't using all information that L3DT generated, so I'm glad to see you're going in that direction. Keep it up!
#25
09/10/2007 (6:09 pm)
The one concern I guess with going with the l3dt generated lightmaps is that the sun direction couldn't change. So depending on the style of game (most types would be fine, RPG might have some issues) it may or may not be better to use them (and I suppose you could also turn the sun/ambient filter all the way to ambient to disable the L3dt cast shadows nearly completely, though that would likely ruin the effect). Overall the screenshots look very cool.
#26
09/10/2007 (10:38 pm)
Still hacking away, I am investigating how much the T variable effects the specular. My T calculations were basically coming out (0,1,0) or (0,0,1) in tangent space this basically means either we got full specular or absolutly none at all. I am hand setting it to (0,1,0) everywhere for the moment until I figure out how to map it better to the terrian. It looks like by tweaking the T variable I maybe able to restrain how much specular is bleading through. If this is the case then I maybe able say vary the specular based on the terrian type (this is one of my goals). The way grass reflects light is vastly different from the way polished steel reflects it. Hmmm maybe T isn't the key in this case, maybe its much simplier. Associating a specular color to the blended texture would greatly constrain this I think. And overall be a better fit (and cheap shader processing wise). Hmmmmm..... Way too many cool things to try and way to little time.

I really wanted to put out a resource but I have made lots of unecessary changes throught the code (this happens when your researching stuff, this is a great way to learn stuff though BTW). I will need some more time to put togeather something that is worthy. Also I want to put something out that is fairly easy to get up and running (to avoid lots of how do I get this to work questions). However if you absoluty want to play with this now I can send the TGEA files I have changed, it will take some savvy but it shouldn't be too daunting.

I will try and put togeather a zip file tommorrow, drop me an email and I will send it to you. It will unfortuantly be a couple of days before I can help you with any issues but your welcome to look at whats there (I changed less than people might think). My only requirement is that you post a SS of whatever you get working :).

Thanks for the comments guys. I hope I can make a contribution soon, other than just screenshots.

@JC Smith - actually you can set the azimuth and direction of the sun when you generate a lightmap in L3DT. And given that there is a scripting plugin interface for it (and thier API even has python hooks I think) you could probably rig up a script to generate 24 lightmaps (one for each hour) all in one go. If you have a multi-core you can set that baby to render in the background while you play in the code :). You would need to write an interface in TGEA to load the lightmaps on the fly and change them out. As the sun changes. Hell you could even shader fade one lightmap change to another on the hour transitions (say over a 5 minutes period you lerp the first lightmap to the second, that way things just dont blink and your at the next light map). It wouldn't be exact, the shadows wouldn't "stretch" but they would fade to the next postion which is better than nothing.

@Mark D - My specular is turned up to high for now but a lot of the plasticyness could be removed with a decent DDs bumpmaps (thus my comment about my lack of artistic talent). I reduced the height of the road and sand textures in the bumpmap and that scaled down the effect quite a bit (more screenshots soon). It makes it look far better and its not so in your face as far as the specular. I'd like to figure out how to keep the height depth of the rock texture though and still lose a great deal of the specular. Reducing the spec power simply reduces the size of the specular "spot" (yeah thats the technical term :)). Plus that spec power is an exponenet operation so its expensive when you scale it to the higer levels.

If I am not to sleepy I might post another Screenie tonight... of what things look like now (I got specular to cast right over the terrain from a distance, and it looks awesome in motion).

Ves
#27
09/17/2007 (11:33 pm)
Ok well I finally posted a resource on this... I think it needs to be approved (I've never done this before so bare with me). I will post the link when it becomes available until then, here is another image ;-).

i5.photobucket.com/albums/y153/vesuvias/blended_multicolorspec.jpg

Ves
#28
09/18/2007 (5:18 am)
Hey Ves, the Zip file to your resource is missing :)
#29
09/18/2007 (5:27 am)
Ok I fixed that. but I had to remove all of the images from the file which is annoying. I am going to see if I can get photobucket to host most of them. I am not sure yet how I am going to get the atlas file up for people to download.

Ves
#30
09/18/2007 (5:33 am)
@Ves: send me the file and I'll host it on my server for you

email addy is on my profile

Great work by the way!
#31
09/27/2007 (2:03 am)
Hi, above picture looks absolutely great! looking forward to having ago at trying to implement it :)

Side question (not sure if this is directly todo with the resource), problems ive been having with blended is the texture is being pasted onto the surface at massive scale causing it to go very low resolution (atleast from FPS view) - can the scale of it be tweaked/modified so effectively its repeated more so and can be viewed closer up?

Regards!
#32
09/27/2007 (6:48 am)
PuG,

the scaling issue has to do with the fact that the texture scales are hard coded in the shader and do not take into account the actual size of the map. I believe the default is to multiply that texture coordinate by 128. This is probably something better suited for a passed in variable though as its going to vary from map to map and possibly from texture to texture. You can change this directly in the shader in the interum. The next bit of changes I make to this resource may take a route and will likely have that information configurable in the mission file. But for now when useing normal blended maps (form this resource or stock torque) you can just change the 128 value to whatever seems appropriate inside the blended shader(go higher if you want more detail).

Ves
#33
09/27/2007 (10:29 am)
Hi Ves, thanks for the information, so 128 is the scale of the texture then, so I should increase that accordingly to the tile resolution.

Regards
#34
09/27/2007 (2:51 pm)
Looks outstanding once again.
#35
10/02/2007 (6:04 am)
Hi Ves, right tried increasing the OUT.tex1, 2, 3, 4 multiplication for better resolution (512 & upto 1024) but keep finding the texture still stays blurred, though its tiling a much greater amount - any suggestions on what could be causing this? (at the current amount its being tiled it should be fairly good quality)

www.dark-forge.com/downloads/Torque_Atlas.jpg
(x 2048, extreme amount but you can see it tiling heavily but no improvement)

Regards!
#36
10/02/2007 (8:19 am)
What was your VirtualTexSize when you created the Blended terrain?
#37
10/02/2007 (11:59 am)
This is what ive got set:

32768
#38
10/02/2007 (11:59 pm)
Tried increasing the VirtualTexSize incrementally upto 1048576, & still no difference :( (same as above).
#39
10/03/2007 (12:44 am)
Tried increasing the VirtualTexSize incrementally upto 1048576, & still no difference :( (same as above).
#40
10/03/2007 (6:22 am)
@Pug: try entering the following definition into ...\client\prefs.cs:

$pref::Atlas::clipMapSize = 1024;


The clipMapSize defaults to 512 which seems to be pretty ok for 256x256 blended textrues. 1024 should be fine for 512x512, haven't tried higher values but I'd figure that 2048 would suffice for 1024x1024 textures.