Atlas.h & Fade
by PuG · in Torque Game Engine Advanced · 02/05/2008 (12:25 am) · 11 replies
Hi, im struggling with an Atlas.h file, and how the terrain is faded in the distance. Currently it appears to be dropping all accept the primary texture layer which leads to a horrible contrast if you have a reasonable view distance.
Its only become really noticeable when using a new exporter and comparing within the software before taking it over to Torque, so, anyhelp would be most appreciated.
Currently im struggling in the file with the following, and how they work:
#define mapCount
distAcc
mapCount
I can't seem to find a fixed variable which is setting a range to display all the textures before fading back to the primary short of the distAcc:
// Caculate fades. We never fade base level, so skip it.
float4 distAcc = 0;
for(int i=1; i
distAcc[i] = distance(mapInfo[i].xy, OUT.texCoord[i].xy);
BUT I can never seem to adjust it and be left with a reasonable result. Ive fiddled with the VertClip adjusting allot of bits, sometimes with better or worse results.
Ive also tried adjusting the FragOut pixClipmap, but as I see it what that does is fade on the transition rather the defining whether all layers are render?
Finally theirs the following:
// Do all the fade biasing in one go.
for(int i=0; i<4; i++)
OUT.fade[i] = (distAcc[i] * (2.0 * fadeConstant) - (fadeConstant - 1.0)) / 2.0;
Problem is I can make heads or tales of the sum.
To get something work more like I wanted I did the following:
#define mapCount 4
& In pixClipmap added:
OUT.col = tex2D(diffuseMap[1], IN.texCoord[1].xy);
Then commented out the whole for(int i=1; i
Stock Atlas.h file with the Sand showing through outside the render range:

Adjustment01:

Adjustment02:

Any suggestions? Does the Atlas.h file also define the quality of the fades, or what sets the resolutions of each clip?
Best Regards,
Its only become really noticeable when using a new exporter and comparing within the software before taking it over to Torque, so, anyhelp would be most appreciated.
Currently im struggling in the file with the following, and how they work:
#define mapCount
distAcc
mapCount
I can't seem to find a fixed variable which is setting a range to display all the textures before fading back to the primary short of the distAcc:
// Caculate fades. We never fade base level, so skip it.
float4 distAcc = 0;
for(int i=1; i
BUT I can never seem to adjust it and be left with a reasonable result. Ive fiddled with the VertClip adjusting allot of bits, sometimes with better or worse results.
Ive also tried adjusting the FragOut pixClipmap, but as I see it what that does is fade on the transition rather the defining whether all layers are render?
Finally theirs the following:
// Do all the fade biasing in one go.
for(int i=0; i<4; i++)
OUT.fade[i] = (distAcc[i] * (2.0 * fadeConstant) - (fadeConstant - 1.0)) / 2.0;
Problem is I can make heads or tales of the sum.
To get something work more like I wanted I did the following:
#define mapCount 4
& In pixClipmap added:
OUT.col = tex2D(diffuseMap[1], IN.texCoord[1].xy);
Then commented out the whole for(int i=1; i
Stock Atlas.h file with the Sand showing through outside the render range:

Adjustment01:

Adjustment02:

Any suggestions? Does the Atlas.h file also define the quality of the fades, or what sets the resolutions of each clip?
Best Regards,
#2
Regards,
02/05/2008 (11:54 pm)
Hi Bob, probably right in regards to it being hardcoded, but then why the atlas.h definitions? also doesn't Ves disable the ClipMap in his resource by bypassing it in Atlas.h?Regards,
#3
What confused me at first was that they wrote the shader in a .h file instead of an .HLSL like the other shaders, but it still works like them and compiles itself at run-time;)
02/06/2008 (10:08 am)
The code in the Atlas.h are just access the functions written in C++, using HLSL, kinda like having torque script for shaders, so really the usage of the clip-map is essentially just used from in the shader but everything about it is in C++(Hardcoded)...well basically from what i understand. Like I said the Fade stuff in the Atlas,h is just for Fading the detail texture,... so to ignore the clip-map, one just has to write your own PixClipmap out in the shader(in this case Atlas.h)...see what i mean? Does this help you? feel free to ask questions, as anything I can't answer i will ask one of my instructors:)What confused me at first was that they wrote the shader in a .h file instead of an .HLSL like the other shaders, but it still works like them and compiles itself at run-time;)
#4
Unfortunately im not good enough to write my own shader output, only tweak whats already their!
02/06/2008 (11:39 pm)
The detail texture is faded in its own HLSL file, from which you can adjust the range/contrast etc.Unfortunately im not good enough to write my own shader output, only tweak whats already their!
#5
As far as the terrain and the textures fading from the screen shots above: have you considered just culling it all out, like the way it is done in World of Warcraft, it the distance they have a fog set up that gives it a single color in the background, and just beyond that it is culled out all together, and this really saves on frame rates, especially in this engine here. And the best thing is, it will take no modification. I will post a screen shot of a canyon i made for a FPS contract i am currently working on.
02/07/2008 (5:49 am)
Im sure there is more controls that can be access in another HLSL, Ive always just disabled it as I have no use for it, so in my build the pass for a detail texture never happens I just don't think it looks good to have the same texture everywhere you look, to me it makes the screen look boring, perhaps this is just me:)As far as the terrain and the textures fading from the screen shots above: have you considered just culling it all out, like the way it is done in World of Warcraft, it the distance they have a fog set up that gives it a single color in the background, and just beyond that it is culled out all together, and this really saves on frame rates, especially in this engine here. And the best thing is, it will take no modification. I will post a screen shot of a canyon i made for a FPS contract i am currently working on.
#6
02/07/2008 (5:58 am)
Here it is, you can see the world being drawn in the left hand section....Illl make a vid of this if you want, unless you have somthing more specific in mind.
#7
As for the detail texture I think its a mistake people loosing it, it can give a great amount of detail whilst avoiding rather horrible overly tiled textures - but what should be done is for an adjustment so you can define a detail to match the texture tile, I think Dream Lords did this for their product?
I shouldn't have to be cutting down the overall visibility to be hiding something that should be rendered correctly in the first place :(
02/07/2008 (6:40 am)
Well it seems bizarre that who ever wrote the shader thought it was a good idea of dropping three of the four textures outside a certain range - its bound to leave a horrid cut and specially made worst if the primary contrasts against the rest - it wouldn't be too bad if you could easily increase the range its rendered, or have it match the mission visibility, but ive yet to find a variable to adjust the overall fading distance....As for the detail texture I think its a mistake people loosing it, it can give a great amount of detail whilst avoiding rather horrible overly tiled textures - but what should be done is for an adjustment so you can define a detail to match the texture tile, I think Dream Lords did this for their product?
I shouldn't have to be cutting down the overall visibility to be hiding something that should be rendered correctly in the first place :(
#8
02/07/2008 (7:13 am)
Makes sense that it does. if you ever add in water, you will see why it is targeted at a view range of 1500 - 2000 maximum.
#9
02/07/2008 (9:41 am)
Thats a 4000 meter view distance which I agree is excessive and beyond standard FPS's, but even if you cut to 1000 meters you still can see the fade for the most part - but its still a daft limit that doesn't seem easily adjustable from what I can find in either in source or shader?
#10
And I don't know what formula you use to convert units to meters and back.
as virtual units have no realworld size this most likely heavily differs from user to user.
I've never had any problems like "3 of 4 textures" missing at 1000 units view range. Only the "why the hell is it blured like in a DX7 game" problem :)
02/07/2008 (10:15 am)
Its within one of the Atlas2 source files in the chunk detail level handling.And I don't know what formula you use to convert units to meters and back.
as virtual units have no realworld size this most likely heavily differs from user to user.
I've never had any problems like "3 of 4 textures" missing at 1000 units view range. Only the "why the hell is it blured like in a DX7 game" problem :)
#11
02/18/2008 (12:34 am)
:) thanks, (sorry the forums have stopped sending notification emails!) - now just need some shader work done..
Torque Owner Bobby Leighton
Imagn' Games