Game Development Community

Modernization Kit Beta Thread 2

by ArmedGeek · in Torque Game Engine · 06/27/2007 (8:46 pm) · 344 replies

I think it is way past time to create a new thread for MK.

The original thread can be found here www.garagegames.com/mg/forums/result.thread.php?qt=58532

Modernization Kit website : tmk.superiorcode.com/
Username: torqueUser
Password: tMK60152
#221
01/02/2008 (6:27 pm)
Yes, there is a working version of this. Also its much better then the gamma & water upgrade. Just try it out and compare it to that upgrade (it supports refraction too). You will have to recompile the engine though.
#222
01/02/2008 (6:34 pm)
Here, why not just compare this snap shot (from CG Gamma & Water Upgrade): img89.imageshack.us/my.php?image=drl32nn.jpg

To this one (from Modernization Kit): www.davatech.com/AAFT.jpg
#223
01/03/2008 (4:08 am)
Wow, that looks amazing! I'll add this to my game as soon as possible, it's awesome!

Edit -> I figured this kind of thing would happen, the only error I understand (as of 6:38 in the morning) is the last one:
Error	1	error LNK2019: unresolved external symbol "void __cdecl MKInit(void)" (?MKInit@@YAXXZ) referenced in function "public: static void __cdecl Platform::onWindowCreated(void)" (?onWindowCreated@Platform@@SAXXZ)	main.obj	
Error	2	error LNK2019: unresolved external symbol "void __cdecl MKDestroy(void)" (?MKDestroy@@YAXXZ) referenced in function "void __cdecl shutdownLibraries(void)" (?shutdownLibraries@@YAXXZ)	main.obj	
Error	3	error LNK2019: unresolved external symbol "void __cdecl MKReset(void)" (?MKReset@@YAXXZ) referenced in function "public: virtual void __thiscall DemoGame::textureKill(void)" (?textureKill@DemoGame@@UAEXXZ)	main.obj	
Error	4	error LNK2019: unresolved external symbol "void __cdecl MKResurrect(void)" (?MKResurrect@@YAXXZ) referenced in function "public: virtual void __thiscall DemoGame::textureResurrect(void)" (?textureResurrect@DemoGame@@UAEXXZ)	main.obj	
Error	5	error LNK2019: unresolved external symbol "class _MKGFX * MKGFX" (?MKGFX@@3PAV_MKGFX@@A) referenced in function "public: virtual bool __thiscall fxFoliageReplicator::prepRenderImage(class SceneState *,unsigned int,unsigned int,bool)" (?prepRenderImage@fxFoliageReplicator@@UAE_NPAVSceneState@@II_N@Z)	fxFoliageReplicator.obj	
Error	6	fatal error LNK1120: 5 unresolved externals	../example/Stonehenge.exe


Edit2 -> I'm an idiot. Forgot to add the ModernizationKit to my project. Now I get these six errors
Error	1	fatal error C1083: Cannot open include file: 'cppunit/extensions/HelperMacros.h': No such file or directory	e:\Stonehenge The Game\Source\engine\ModernizationKit\UnitTests\mkGLSLTests.h	9	
Error	2	fatal error C1083: Cannot open include file: 'cppunit/extensions/HelperMacros.h': No such file or directory	e:\Stonehenge The Game\Source\engine\ModernizationKit\UnitTests\mkCgTests.h	9	
Error	3	fatal error C1083: Cannot open include file: 'cppunit/extensions/HelperMacros.h': No such file or directory	e:\Stonehenge The Game\Source\engine\ModernizationKit\UnitTests\mkATITTests.h	9	
Error	4	fatal error C1083: Cannot open include file: 'cppunit/extensions/HelperMacros.h': No such file or directory	e:\Stonehenge The Game\Source\engine\ModernizationKit\UnitTests\mkASMTests.h	9	
Error	5	fatal error C1083: Cannot open include file: 'cppunit/extensions/HelperMacros.h': No such file or directory	e:\Stonehenge The Game\Source\engine\ModernizationKit\UnitTests\mkVBOTests.h	9	
Error	6	fatal error C1083: Cannot open include file: 'cppunit/extensions/HelperMacros.h': No such file or directory	e:\Stonehenge The Game\Source\engine\ModernizationKit\UnitTests\mkGLSLTests.h	9
#224
01/04/2008 (2:04 pm)
Ok, I'm going to start a thread on my problem here.
#225
01/04/2008 (8:47 pm)
This is the same mistake I made my first time. You can not include the unit tests...

If you read a few posts above it should be easy to figure out...
#226
01/05/2008 (8:10 am)
Tried that. Didn't work.
#227
01/09/2008 (9:25 am)
I was wondering if anyone else has had a similar problem with the water reflections and fog. The screenshot is and overdone case of the problem, it normally shows up at the edge of the sight range. Is there possibly any changes I could make to the Shaders or other programming to fix this or limit the range the reflections render at.
Thanks in advance.

http://img252.imageshack.us/img252/4940/fogreflectproblemxk3.th.jpg
#228
01/09/2008 (12:44 pm)
Never had that problem before...
#229
01/09/2008 (7:35 pm)
Well i must say this is a fantastic resource. thanks a heap Alex.

At first i had some issues getting it to work ingame (no compile errors at all, save the references to the testing stuff, which i removed).

But once i read further down the threads and found the script items i missed and then turning on the water variables, it looks awesome. Good job.

Now, for the DTS issue. think i will go and try tackling that. But a backup will be first thing to do :)
#230
02/03/2008 (10:24 am)
I am having a problem here. On the computer I compiled this on it works completely fine. However, if I move it to another computer (no matter how good this other computer is) it laggs like crazy. The only way I can get it to run normally on another computer is to set it to 16 bit. 16 bit makes everything look bad though, the water is fine but all textures are low detail. It only works fine on 32 bit when its on the computer I compiled it on. I have tried deleting the prefs and the DSOs. I would really like to get this working on other computers on 32 bit, how would I do this? Has anybody else had this problem?
#231
02/28/2008 (12:02 am)
Well we finally got around to incorporating sections of the MK into our engine and I really have to thank you Alex for creating a very effective (if not well documented ;)) resource!

We however ran into some issues with the water on one of our machines that has an ATI X1600 mobile card in it. We tracked down the issue to be with the GLSL 'varying' identifier on shader variables, and by removing these and instead storing the necessary variables in unused Texture Coordinate variables (ie. like how you would in HLSL), it now works on the ATI card as well as on all of our other machines.

So for example in 'waterReflectOnlyVert.glsl', you would:

1) Delete these 2 lines:

varying vec4 HPosition;
varying vec3 HalfVec, EyeVec;


2) Tell 'HPosition' to instead be stored in the empty 'gl_TexCoord[3]':

//HPosition = gl_Position;
gl_TexCoord[3] = glPosition; //use empty texture coordinate to store the position for interpolation across the polygon instead of trusting 'varying'!


3) Tell 'EyeVec' and 'HalfVec' to also the empty 'gl_TexCoord[4]' and 'gl_TexCoord[5]' respectively:

//EyeVec = vec3(eyeVec);
gl_TexCoord[4].xyz = eyeVec; //use tex coord for interpolation again

//HalfVec = LightDirection + EyeVec;
//HalfVec = normalize(HalfVec);
vec3 halfVec = LightDirection + eyeVec;
gl_TexCoord[5].xyz = normalize(halfVec); // use empty tex coord for interpolation again-again!


Now you will need to replace all references to 'HPosition', 'EyeVec', and 'HalfVec' in your pixel shaders with the corresponding 'gl_TexCoord[]' channels, so in 'waterReflectOnlyPixlHigh.glsl':

1) Delete these 2 lines:

varying vec4 HPosition;
varying vec3 HalfVec, EyeVec;


2) Replace 'HPosition' usage with 'gl_TexCoord[3]':

//vec2 refCoord = HPosition.xy / HPosition.w;
vec3 refCoord = gl_TexCoord[3].xy / gl_TexCoord[3].w; //tex coords for interpolation to fix weird 'varying' issue!


3) Replace 'EyeVec' usage with 'gl_TexCoord[4]':

//half3 eyeVec = normalize(half3(EyeVec));
half3 eyeVec = normalize(half3(gl_TexCoord[4].xyz)); //tex coords for interpolation to fix weird 'varying' issue!


4) Replace 'HalfVec' usage with 'gl_TexCoord[5]':

//half3 halfVec = normalize(half3(HalfVec));
half3 halfVec = normalize(half3(gl_TexCoord[5].xyz)); //tex coords for interpolation to fix weird 'varying' issue!


With that as the most complex case, you should be able to sort out the changes in all of the other glsl shaders as well :)


So I guess all of this means that there is a bug in the drivers for the ATI X1600 card, and possibly other ATI X-series or mobility radeons in general...

And yes, I *do* have the latest ATI drivers installed on the card ;)
#232
02/28/2008 (8:07 am)
Nice! So by "the engine" are you saying a new version of Torque is going to be released? Great work, by the way!
#233
02/29/2008 (12:19 am)
Cory, its more like "our copy/version of the engine" :)
People make lots of changes to the engine to fit with their games.

The water code adds a lot to TGE, really looks good and this fix make it run better on more cards. All those that had disco water before should try these changes in the modkit.
#234
02/29/2008 (12:52 am)
Yeah... what Leslie said ;)
#235
02/29/2008 (3:40 pm)
After getting this implemented, toying with it for awhile... Well I start to wonder if we can't "easily" implement such features as:

* Splatting (I know there is better coverage of this...)
* Ambient Occlusion
* Or even SSAO...
* RTT Effects

Of course screen space effects work, because bloom is working out of the box. I haven't taken the time yet to delve into implementing new shaders or applying materials to new types of entities (such as particles or dts?)... Before I do that I want to get a somewhat "normalized" test scene together. What I mean is:

* Get a default scale standard pinned down, on the art asset side. IE, exporting from modeling package to Torque 1:1 scale. I have this down between Blender, MilkShape, Terragen, and World Machine. Just need to sweep up after myself and get it documented for quick reference.

* More normalizing- colors. Just some defaults for the demo scene/mission- basic character, random object such as a crate, and the ground, most likely a grid texture.

Easy stuff, but between reading docs and the forums here, I'm chugging along... at a medium pace. So now, between all that, I thought I'd ask if anyone else has tried implementing the above items, and how it went. Obviously though, now that I think of it, I'm sure we'd all have seen it by now if that were the case. Soooo...

Has anyone tried making new shaders at all, and adding them to the fine collection? That's my biggest worry, is if I'll run into trouble implementing simple vertex shaders, bashing heads with Torque engine code. You know, certain things not being defined yet, blah blah. The whole MK materials system seems simple enough... Though I wanted to get some input before I went down that chasm.

At any rate, I'll be sure to share goodies once I start making them. For starters I want to see if I can get shaders on the player/ai models. Or particles... We'll see. I was thinking a simple hemispherical lighting shader to start. Okay I'm done... sorry for the long one.

[edit]
Perhaps it's time for a new MK thread? Aptly title "Modernization Kit Part III"? I'd hate to see this start pittering out, and if I had more... well a few more things, I'd offer to take over if Alex still hadn't found anyone to do so... Has/did anyone else think about taking this project under their wing?
[/edit]
#236
03/05/2008 (10:57 am)
@Luke: would you mind describing what the water problem was you had with the ATI card. I've recently noticed an issue on my machine, which has ATI graphics, but I haven't tested on another system yet.

@Nathan: I've added a motion blur shader that killed my framerates, and I've experimented with making things glow--partial success. I used the DRL as a guide for adding these. Shading dts objects supposedly can be done with just a few lines of code but I haven't ventured down that road yet.
#237
03/06/2008 (12:05 am)
@Michael:

If I remember correctly, the water would just do weird flashing of colors for the reflection map instead of showing the proper reflection when there was no refraction, and with refraction enabled it would be all funky multicolored and stuff as you moved the camera. The problem is that no shader variable marked as "varying" would be interpolated correctly across the verts, so things like the UVs for the reflection would always be 1 and the normal map values would be random trash as the position and eye data would not be interpolated per-pixel properly.
#238
03/06/2008 (12:47 am)
I'm myself (I dare to think) more and more 'fluent' in TGE engine modification.

And I'd like, when I have time, try to implement the MK texturing to DTS objects.

I think that will 'finalize' the MK, and Alex said that should be very easy :

Quote:
I did a bit of research, and I am about 85% certain applying materials to DTS models would take about three lines of code. We'll call that an exercise left to the reader. The material system is remarkably flexible when you get into it.

Nicolas Buquet
www.buquet-net.com/cv/
#239
03/06/2008 (12:58 am)
Woo, first post in seven months. Maybe I'll start chiming in a bit more often.

@Luke: I'd say the problem is ATI's GL drivers suck and they can't write a GLSL compiler. I probably shouldn't be so hard on them, but it's not like that isn't common knowledge.

@Nathan: Technically speaking, you can do anything with the MK. At its core it's just a bunch of boilerplate GL code to deal with things so you don't have to. Above that... well, I guess there's the material system, which is really just a very fancy name for what amounts to a whole lotta shader filenames.

Also, no one has approached me about taking over MK development, nor have I approached anyone.

@Nicolas: I still stand by that. All you really need to do is feed the base texture name into the MaterialManager and bind the material it returns. I suppose you could do that in one line, but two lines is cleaner. The third line is to unbind the material (did I implement that? If not, unbind the shader).
#240
03/06/2008 (1:34 am)
I've stepped away from the rendering side of things for a bit to try and get a good input system working... As far as adding in joysticks and what not. So I need to go back to the rendering side and particularly, MK to get familiar with it again...

Is MK exposed in a way that I can use scripts to define what objects get what materials? I said that kind of backwards- what I mean to say is, can we define materials in objects scripts, like if DTS shaders were implemented. For example something like this in the starter.fps mod, crossbow.cs:

datablock Material(CrossbowMaterial)
{
    textureDiffuse = "...";
    textureNormal = "...";
    preload = true;
};


datablock ShapeBaseImageData(CrossbowImage)
{
    ...
    materialName = "CrossbowMaterial";
    ...
}

Like I said, I need to go back and re-affiliate myself with these things. My answer is probably already answered in documentation elsewhere. Still, if it were this easy that would be really nice. Oh, and while this is fresh in my mind, if anyone has the idea to make a shader editor in the engine... I would gladly do art for the GUI. That would be so awesome, and really add to the editor system.