Just a short addition to the things that I already mentioned in this thread about the workflow, because I won't find time to give you a step by step explanation within the next two weeks:

Beside the model which shall have a second uv-map for the shadowing you need the second version of the model with a mapping of its skin where every polygon has its own place of the map!

Then you need two scripts. One for getting the mesh-file of the model's second version and producing and ingame-editing of the lightmap, and saving the lightmap as a png-file. And a second script for including the already shadowed model in a game.

Assign the needed script in WED, you can't use them both at once!





#1 Script(note, you have to check the model's polygon flag and flag8 in the properties:

It is the light.wdl of ventilator's lightmapper, there is only one small addition in the function 'lightallentities':


function lightallentities()//light the entities and save them as pngs
{
tempentity = ent_next(0);
while(tempentity != 0)
{
if(tempentity.flag8)
{
tempmaterial = tempentity.material;
l_light(tempentity, tempmaterial.skin1);
str_for_entfile(tempstring, tempentity);
str_trunc(tempstring, 4);
str_cat(tempstring, "_lm.png");
bmap_save(tempmaterial.skin1,tempstring);
wait(2);
}
tempentity = ent_next(tempentity);
}
}








-----------------------------------------------------------------
#2 Script is this:

var video_mode = 8;

plugindir = ".";
dllfunction ent_exportmesh(entity, filename);
dllfunction ent_importmesh(entity, filename);
dllfunction ent_loadseconduvset(entity1, entity2);

material* tempmaterial;
entity* tempentity;
entity* tempentity2;
string tempstring;

//----------------------------------------------------------------------------- mtl_lightmap

material mtl_lightmap
{

effect=
"
texture mtlSkin1;
texture entSkin1;

technique t0
{
pass p0
{
Texture[0]=<mtlSkin1>;
Texture[1]=<entSkin1>;

// mix light map with dynamic lighting
TexCoordIndex[0] = 1;
ColorArg1[0] = Texture;
ColorOp[0] = AddSigned;
ColorArg2[0] = Diffuse;

// apply lighting to texture
TexCoordIndex[1] = 0;
ColorArg1[1] = Texture;
ColorOp[1] = Modulate2x;
ColorArg2[1] = Current;
}
}
";
}



//----------------------------------------------------------------------------- main
function file_exists(filename)
{
var filehandle;
filehandle = file_open_read(filename);
if(filehandle)
{
file_close(filehandle);
return(1);
}
else
{
return(0);
}
}

string tempstring1;
string tempstring2;
material* tempmaterial;

function applylightmaps()
{
you = ent_next(0);
while(you != 0)
{
str_for_entfile(tempstring1, you);
str_trunc(tempstring1, 4);
str_cpy(tempstring2, tempstring1);
str_cat(tempstring1, "_lm.mdl");
str_cat(tempstring2, "_lm.png");

if(file_exists(tempstring1) && file_exists(tempstring2))
{
you.material = mtl_create(); // they should be removed again when changing the level
tempmaterial = you.material;
tempmaterial.effect = mtl_lightmap.effect;
tempmaterial.skin1 = bmap_create(tempstring2); // they should be removed again when changing the level
tempentity = ent_create(tempstring1, nullvector, 0);
ent_loadseconduvset(you, tempentity);
ent_remove(tempentity);
}
you = ent_next(you);
}
}

function main()
{
wait(3);
level_load("example.wmb");
wait(1);

vec_set(sky_color, vector(250, 175, 75));

vec_set(sun_angle, vector(160, -35, 0));
sun_light = 20;

vec_set(camera.x, vector(300, 0, 200));
camera.pan = 180;

applylightmaps();
}




-----------------------------------------------------------------------
Again, thanks to ventilator, who helped me to complete these scripts!

(The shadowmap is saved as png, because it is the only format that the directx function saves without a mistake, if you want to save it as tga or bmp, you can change that in the script, but after saving in that formats, you have to open them each in a grafic tool and save them again, to get the correct results!)