3 registered members (AndrewAMD, VoroneTZ, dpn),
1,346
guests, and 10
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: [Plugin] Import von 2. UVMap / Import of 2nd U
[Re: William]
#119615
05/02/07 10:36
05/02/07 10:36
|
Joined: Apr 2005
Posts: 4,506 Germany
fogman
Expert
|
Expert
Joined: Apr 2005
Posts: 4,506
Germany
|
I hope IŽll have some time today to play around with it. IŽll give you feedback than.
no science involved
|
|
|
Re: [Plugin] Import von 2. UVMap / Import of 2nd U
[Re: ventilator]
#119617
05/02/07 20:55
05/02/07 20:55
|
Joined: Nov 2003
Posts: 1,659 San Francisco
JetpackMonkey
Serious User
|
Serious User
Joined: Nov 2003
Posts: 1,659
San Francisco
|
I get a crash in ent_loacseconduvset(e3, e4), each mesh has 1870 faces.. any ideas? Code:
var video_mode = 8;
plugindir = "."; dllfunction ent_exportmesh(entity, filename); dllfunction ent_importmesh(entity, filename); dllfunction ent_loadseconduvset(entity1, entity2);
//----------------------------------------------------------------------------- mtl_lightmap bmap bmap_lightmap = "lightmap.dds"; bmap bmap_plantlightmap = "tower_lightmap.dds";
material mtl_lightmap { skin1 = bmap_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; } } "; }
material mtl_plantlightmap { skin1 = bmap_plantlightmap; 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 entity* e1; entity* e2;
entity* e3; entity* e4;
function main() { wait(3); level_load("empty.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;
// // example 1 // // load model with texture uv-set e1 = ent_create("landscape.mdl", nullvector, 0); e1.material = mtl_lightmap; // load model with light map uv-set e2 = ent_create("landscape_lm.mdl", nullvector, 0); // generate and assign a new mesh with both uv-sets ent_loadseconduvset(e1, e2); ent_remove(e2); // save mesh with both uv-sets for faster reuse ent_exportmesh(e1, "landscape_lm.mesh"); //////////////////////// e3 = ent_create("plant.mdl", nullvector, 0); e3.material = mtl_plantlightmap; // load model with light map uv-set e4 = ent_create("plant_lm.mdl", nullvector, 0); // generate and assign a new mesh with both uv-sets ent_loadseconduvset(e3, e4); ent_remove(e4); // save mesh with both uv-sets for faster reuse ent_exportmesh(e3, "plant_lm.mesh");
|
|
|
Re: [Plugin] Import von 2. UVMap / Import of 2nd U
[Re: ventilator]
#119619
05/03/07 04:50
05/03/07 04:50
|
Joined: Aug 2001
Posts: 2,320 Alberta, Canada
William
Expert
|
Expert
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
|
No crashes here, as I still haven't tried my own models. Currently having trouble getting my 2 models out of max. For example, I've got 2 mapping channels, the first one with the normal UV, the second with another UV. But max2mdl seems to only export models with map channel #1. Perhaps I'm doing something wrong, as I'm very new when it comes to baking levels. If someones got a solution for it, please post(I think earlier it looked like Mabyenew had no problem exporting with this?). Edit: Got the mesh exports working! Turns out to export as a different map channel, you have to UVW Mapping modifier, and select your map channel there. This is very simple and quick. Anyways, i'm getting the same error as Jetpackmonkey when I try to combine my 2 meshes thru script. Basically a problem with the "loadseconduvset", then after that error, there is one with the "ent_importmesh". After running, the model has it's normal tiling textures, but with a bunch of it's faces shaded black here and there. Code:
str_for_entfile(tempstring,my); //str_cpy(aemo2, tempstring);
if(str_cmp(tempstring,"YY_MAINCLIFF.MDL") == 1) {
// // example 1 // // // load model with texture uv-set
// // load model with light map uv-set e2 = ent_create("l_maincliff.mdl", nullvector, 0); // // // generate and assign a new mesh with both uv-sets ent_loadseconduvset(my, e2); ent_remove(e2); // // // save mesh with both uv-sets for faster reuse /// ent_exportmesh(e1, "landscape_lm.mesh"); // // // //ent_remove(my);
// ent_importmesh(my, "l_maincliff.mesh"); }
Last edited by William; 05/03/07 05:53.
|
|
|
Re: [Plugin] Import von 2. UVMap / Import of 2nd U
[Re: William]
#119620
05/03/07 12:23
05/03/07 12:23
|
Joined: May 2002
Posts: 7,441
ventilator
Senior Expert
|
Senior Expert
Joined: May 2002
Posts: 7,441
|
how does the error message exactly look like? are you sure you don't mix up my beta popups with crashes? i stupidly used the error() function for popups but if it is no error it says "(this is no error message!)" at the bottom. there probably is something wrong though if you get black triangles and i would have to investigate that with your models.
|
|
|
Re: [Plugin] Import von 2. UVMap / Import of 2nd U
[Re: fogman]
#119623
05/03/07 16:25
05/03/07 16:25
|
Joined: May 2002
Posts: 7,441
ventilator
Senior Expert
|
Senior Expert
Joined: May 2002
Posts: 7,441
|
hm... i did some tests with messing up the second model (moved some vertices around so that the correct triangles won't be found on the second model) and the algorithm seems to be quite forgiving. i didn't get any crashes. just the light map was wrong then on those triangles. jetpack_monkey's test model worked for me and william's model seemed to work too but he forgot to send me the light map so i couldn't check if it displays correctly. he had overlapping areas in the light map uvs though which probably won't give good results. jetpack_monkey's test model:
|
|
|
Re: [Plugin] Import von 2. UVMap / Import of 2nd U
[Re: ventilator]
#119624
05/04/07 00:47
05/04/07 00:47
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
This only works with 6.6* [private-beta] right?
I can't wait to work with it, although I probably won't be able to since I don't have any way for generating the lightmaps...
xXxGuitar511 - Programmer
|
|
|
|