Game Development Community

dev|Pro Game Development Curriculum

TGE normal mapping

by Koushik · 06/16/2008 (6:22 am) · 47 comments

Download Code File

After being asked about this by a lot of people, I've released this code to the community, when I initially thought I'd polish it and make it part of my larger framework, and release the whole thing once it looks stunning... but that might take a while, and I think it best to satisfy hungry GGers...

You can find a manual outlining the exact procedure (along with some introduction on how to setup scripts and stuff) over Here

The corresponding shaders are attached with this resource. If you find any bugs, or have any suggestions, feel free to email me.

It is most likely that some of the parameters would need some tweaking based on your level lighting and textures. If you need any assistance with these, post a screen and I'd be able to help out.

Thanks to Jon and Ari of BrokeAss Games for trying this out first and giving me some feedback initially.

Cheers!

Koushik
Page«First 1 2 3 Next»
#41
10/27/2008 (8:09 am)
Again, let me answer the previous posts in order

@Daniel
Coloured lights are possible. Inn fact, some of the shots I posted in my .plans earlier were taken using interior lights, of some shade of yellow. The light you are referring to, inside the DIF, near the red-glowy fire also shows up on red when you use the entire shader. The explanation for why you are seeing only white light is as follows:
When you setup the shader to use only one light, i.e gl_LightSource[0], it defaults to using the sun-light in the level. This is a (theoretically) infinitely far light and causes your shadows and stuff. When you add lights into the mission editor, they are appended to that array by the lightManager inside TGE. This means that we will now have any lights with whatever colour you define them to be. Hope that makes sense.

@Richard
Are you sure you added the lines in the correct position? It works fine for me (no crashes at all)

@Charlie
The entire material system is handled by the clients. The server doesnt know if any of the clients is using shaders or not. An easier way to look at it would be as follows. If you worked with stock TGE, the server will send a list of asset files (DTS shapes and corresponding textures) to the clients to render. With this addition, the rendering is done using the shader instead of the standard fixed function pipeline (if that capability is available of course, otherwise it falls back to stock TGE behaviour) So you got that right, you need to define the materials before rendering the stuff onto the screen. In the stock MK, this is done in the common/materials.cs file as this folder is loaded before your actual game folder (starter.fps for instance)

Hope that helps

And yeah, btw, for anyone wondering, I had promised to release another shader pack (if you've followed by plans you'll know), unfortunately, I submitted a resource twice and it didnt show up on the myAccount page. So I guess it got lost to the web world (I've lost quite a few .plans that way too). So I guess I'll resubmit it today or tomorrow.
#42
11/11/2008 (10:11 pm)
Thanks to Koushik for this snippet of code.

If your having a problem with the F11 editor crashing Torque replace the following around line 335 in tsMesh.cc right under "TSMesh::render: rendering of non-indexed meshes no longer supported");

S32 registeredMaterial = draw.matIndex;
registeredMaterial&= TSDrawPrimitive::MaterialMask;
const char *name = materials->getMaterialName(registeredMaterial);
if(name)
Material *shaderMaterial= MaterialManager->findMaterialByMapToTexture(name);

with this

S32 registeredMaterial = draw.matIndex;
	  registeredMaterial &= TSDrawPrimitive::MaterialMask;

	  Material *shaderMaterial=0;

	  if(materials->getMaterialCount())
	  {
		const char *name = materials->getMaterialName(registeredMaterial);
	    shaderMaterial = MaterialManager->findMaterialByMapToTexture(name);
	  }
#43
11/20/2008 (12:07 pm)
im trying to learn how to mess with some of this stuff, and ive got it compiling, but i dont have any resources to test this with. i see other people have tried this with the starter.fps and gotten it working fine, but am I missing player model that has the different texture maps, or is there somewhere to download it?
#44
11/21/2008 (3:18 am)
I used CrazyBump to generate normal, spec maps for the default TGE character. Another fantastic program is xNormal. You can test the default samples that come with that, though you might need to convert the models to DTS format.

If you have a hi-res mesh, xNormal also helps in generating tangent-space normal maps for use with this resource.

And for everyone, I've released the TGE shader pack, you can find it here What's more - it includes 3 additional shaders - fur rendering, toon shading and a skin shader. Let me know what you think about it!
#45
01/20/2009 (9:22 am)
ive noticed that if a light is deleted or is removed it is not updated in the shader and still shows..im not a shader programmer and i have no clue how to fix it so i thought i would tell you about it

also how hard would it be to migrate this shader over to the interiors?
#46
03/12/2009 (6:38 am)
Any fix for the transparency (sorting) issue with dts objects?

If you can solve the issue within the material...ie setting up the blending correctly. Could I get an example of how I need to set the material up? Just basically for trees/bushes and such. They look bad, then if you have the alphaLOD resource implemented, it looks really bad.

Appreciate any help.

#47
01/20/2010 (2:00 pm)
My player looks all weird silver shiny..
nakednerd.clan-net.dk/Capture.PNGAny known issues like this? if necessary i can upload any of my code
Page«First 1 2 3 Next»