Aller au contenu

Photo

(SOLVED) Can Custom Models Get Lightmapped?


  • Veuillez vous connecter pour répondre
29 réponses à ce sujet

#1
Talisander

Talisander
  • Members
  • 173 messages
  The title is a bit ambiguous.  Basically, I used Adinos' great DAtool program to extract and edit a texture file from the Human Castle tileset.  All I did was change the color of the roof tiles in the diffuse DDS file from grey-blue to a nice terracotta red.  I then saved a new model with the texture I had made.  It showed up fine in the toolset, but I had a little trouble getting the texture to show up in the game.  Finally I figured out I just had to put it in a different override directory -- I must have had it in a directory only the toolset looks in before.

   My question:  Ever since I started using the new model (which is using the custom texture I made) in the toolset, I get a lightmapper error which says "no lightmap atlus could be found for object" or something to that effect.  I'll edit this post with the exact wording next time I'm in the toolset.  The end result is that the roof creates no shadows -- not a complete deal breaker, but if I can fix it, I'd like to.

I've heard there are some limits on custom content.  My question is, is this one of them at this point?  Is there no way to tell the lightmapper to treat my new model, created by Adinos' DAtool, exactly the same as the model it's based off of?

I've been looking in the .mao file that DAtool created and there's a line about the lightmapper.  Is there any way to edit this line to get the lightmapper to treat it like the original model?

Thanks for reading all,

Alex

Modifié par Talisander, 23 mai 2010 - 01:16 .


#2
mikemike37

mikemike37
  • Members
  • 669 messages
for the toolset to know what to lightmap, it uses a meta file. This meta file is not copied by DATool. You need to find the meta data file for your original model and make the necessary adjustments.



Check the name of the original model, then in your toolset open up Program Files\\Dragon Age\\packages\\core\\data_tools\\arttools.erf



Find the met file for your model and extract someplace. Open in a text editor and change all the references to the original model's name with your new model. Save and place in your override folder. Restart toolset and (hopefully) it should work! not actually tried this though, so gd luck!
  • ladyofpayne aime ceci

#3
Talisander

Talisander
  • Members
  • 173 messages
Thanks a lot, mikemike! I was lost on where to find those references.

#4
mikemike37

mikemike37
  • Members
  • 669 messages
no problem - so did you get it working?

#5
Talisander

Talisander
  • Members
  • 173 messages
I just tried it. I'm not getting anything to work. I tried it a few different ways:

My retextured model is called fne_twrtop_02_0. In my packages/core/data I've got "fne_twrtop_02_0.mmh" and "fne_twrtop_02_0.phy".

1st thing I tried: keeping the extracted .met file named "fne_twrtop_01_0.met" and renaming all of the references to " fne_twrtop_01_0.* " within the file to " fne_twrtop_02_0.* "

Then, putting the .met file straight in packages/core/override

What's odd about this is that I don't actually have an fne_twrtop_02_0.msh -- Adinos' DAtool didn't create one, since all it does is reskin something, I'm assuming it just points to the same model mesh as the original model. But that's one of the files the .met wants to reference.

It didn't work. An error after each phase of lightmapping told me no "fne_twrtop_02_0.msh" exists.

So, tried again but without changing the .msh file name, so it is still looking at the old one. Also didn't work.

Finally, I tried changing the name of the .met file to "fne_twrtop_02_0.met" -- this also didn't work.

Hopefully I'm just not understanding what I was supposed to change. I still only half understand what points to what inside the .mao, .phy, and .mmh files.

I'm also confused as to whether I'll actually be able to use both models -- the original and the retextured one -- by overriding the .met file. Won't that change or mess up the way the original model works? I could always just override the .dds files of the original if I just want to have the retextured model working without the original, and the lightmapper won't give me any headaches that way.

Thanks a lot for your help, mikemike. Hope I'm not giving you a headache.


Alex

Modifié par Talisander, 23 mai 2010 - 04:37 .


#6
mikemike37

mikemike37
  • Members
  • 669 messages
not at all.

First thing that leaps out at me is you didn't say you had your .mao anywhere? I'm assuming you used a prop to copy? if not, then many changes need to be made both to the .mao and the model. If your .mao output from DATool included lines like this then you should be fine:

http://pastebin.com/M2rTUt7s

lines 3 and 8 (static.mat with a lightmap texture) tell you it is a prop and is ready to be lightmapped
line 5  has been modified by DATool, I need a new dds texture for each new texture i include, here only plc_ellrm_03d.dds. I can change more than just the diffuse, if I like.

Anyway, your issue about the .msh is that, yes, its using the same .msh as the original model if all you did was retexture. In this case, I was wrong to tell you to change ALL of the references. They may well need to have referred to the original model wherever its talking about the msh and to your new name when referring to the mmh.

However, theres a simple fix that will avoid confusion and getting them wrong (basically, make the msh with a new name!):
  • Open DATool
  • find the model, retexture
  • rescale with factor 2
  • save modified
  • Then rescale with factor 0.5
  • save modified

This way you will generate 4 files... the 3 you should have had before (im not sure why you didnt have a .mao - did you "save modified" after reskinning? as well as the msh you're missing, correctly renamed.

Your override folder should contain:
  • MAO (from DATool) - check this is using your diffuse, normals etc as desired
  • MMH (from DATool)
  • MSH (from DATool)
  • PHY (from DATool)
  • MET (extracted and modified using the steps from before)
  • DDS (one for each new texture assigned to your model in the mao)

Fingers crossed, we'll get it this time ;)

Modifié par mikemike37, 23 mai 2010 - 09:17 .


#7
Talisander

Talisander
  • Members
  • 173 messages
Hey mikemike, I actually do have an .mao. I don't know how I missed mentioning it... my apologies. It references the new diffuse textures I'm using, of course, which are also in my override folder.

I didn't know DAtool could output a new .msh as well, but that makes sense, since it can scale things as well (man, that's a great tool).

My question is, is there a way to make this work without duplicating a .msh file? I could be wrong, but I think .msh files take up a decent amount of space and I want to keep download size down as much as possible (this is part of a bigger mod). It seems like there should be a way to just hook the new .mmh and .mao to the same files that make the original model get lightmapped?


I'm going to go try what you just said, and I see what I end up with. Thanks for the help! Also, I just randomly linked to a lighting tutorial on your site through the wiki. The BG project looks amazing.

Alex

Modifié par Talisander, 23 mai 2010 - 09:35 .


#8
Talisander

Talisander
  • Members
  • 173 messages
Here's my .mao:



<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<!-- Exported by Material Editor --><!-- dc:source=file:///C:/BioWareDrive/DragonAge/SourceControl/ArtContent/Art/Levels/Tilesets/FNE_NobleEstate/FNE_Master.matproj --><MaterialObject Name="FNE_master2">

<Material Name="static.mat"></Material>

<DefaultSemantic Name="Default"></DefaultSemantic>

<Texture Name="mml_tLightmap" ResName="LM.dds" RequiresID="true"></Texture>

<Texture Name="mml_tDiffuse" ResName="fne_master2r2_d.dds"></Texture>

<Texture Name="mml_tNormalMap" ResName="fne_master2_n.dds"></Texture>

<Texture Name="mml_tSpecularMask" ResName="fne_master2_s.dds"></Texture>

<SoundType Name="mml_iSoundMaterialType" value="5"></SoundType>

</MaterialObject>

#9
-Semper-

-Semper-
  • Members
  • 2 256 messages
i've not tested this but won't it be enough to open datools, search the model, click save all to get the appropriated .mmh and .mao. now rename the .mmh and the .mao to something you like and drag'n drop the .mmh at the toolset. the .mmh file is just a kind of library which links the different files. within the toolset just replace the .mao name and link it to your custom file. now open the .mao with windows editor and relink the diffuse texture to your custom texture. now the important part:

all the level resources belongs to your my documents/bioware/dragon age/addins/your_module/core/data/custom_model_name folder. (this contains textures, mao, msh, mmh, phy. only the met is placed within the data_tools folder.)

the custom model name folder is not absolutely needed but it keeps the data folder organized ;)

now you could use a second model with different textures. the msh, phy, met, normal and specular is identical to bioware's model.

beware: this is not tested and will only work if the toolset uses the .mmh to bind in models but i guess that's the way it works^^

Modifié par -Semper-, 23 mai 2010 - 10:02 .

  • ladyofpayne aime ceci

#10
Talisander

Talisander
  • Members
  • 173 messages
By the way, I'm not sure whether this counts as a 'prop' or not, but the model I reskinned is a piece of a building... the roof of a tower in the human noble set.



Just to be sure, in the original instructions you want me to keep the .met file named the same as it always was before I extracted it, right? Don't rename it to match my new .mmh and .phy files.



Will the original model be lightmappable alongside the new one, with its .met being overridden?

#11
Talisander

Talisander
  • Members
  • 173 messages
Semper: I wasn't putting the files in addins/mymod/core/data because when lightmapping I have to do it from the single player mod. So I was worried the toolset wouldn't see these files when not looking at that module. Is this not the case?

#12
Talisander

Talisander
  • Members
  • 173 messages
Just noticed that the size of .msh files isn't very large after all. My bad. Please ignore that part of my post, mikemike :)

#13
-Semper-

-Semper-
  • Members
  • 2 256 messages
if your are posting and rendering your level your model files also needs to be placed at this location: my documents/bioware/dragon age/packages/core/data and data_tools. place your custom mmh and mao at the data folder.

the override folder is only for a quick and simple overriding of existing files which is not your goal ;)

you need no new msh, phy!

(edit: a new met is needed. just extract it out of arttools.erf and name it after your custom mmh)

Modifié par -Semper-, 23 mai 2010 - 12:20 .


#14
mikemike37

mikemike37
  • Members
  • 669 messages
*scratches head*... hmm, rethinking all of ive said, IF you havent got a new MSH (as I had originally thought) then, semper is correct, you don't need a new MET. Sorry to have led you on a wild goose chase :s at least you know what to do if you want to rescale something ^^

Anyway, we're now full circle... why isn't it receiving shadows...?

can you copy all the lines the toolset is throwing out as warnings? specifically im looking for things like: "missing lightmaps on certain parts" and "no meta data found" - or if none of these warnings then that in itself is interesting.

And perhaps a screenshot - is it CASTING shadows? is it RECEIVING shadows?

Modifié par mikemike37, 23 mai 2010 - 10:48 .


#15
Talisander

Talisander
  • Members
  • 173 messages
So I've just tried Semper's method, which I kind of like because it feels like it gives me more control than completely relying on DAtool to retexture the model, but it doesn't seem to be working with lightmaps either. Which is weird, because literally the only thing that I changed was the reference to the .mao in the .mmh. I even left the MMH_NAME within the .mmh exactly the same as the original! (It still shows up in the toolset as long as the .mmh file has its own name.)

I'm getting two errors going by this method:

W: 06:49:12 - Could not find meta data for fne_wall_rd_0

and

W: 06:53:55 - Model 'fne_wall_rd_0' is missing lightmaps on one or more parts.


Any ideas?

Modifié par Talisander, 23 mai 2010 - 11:03 .


#16
Talisander

Talisander
  • Members
  • 173 messages
I'm thinking I should just render the lightmaps and then go through and change the roof models I want to be a different color after the lightmaps have been done, then post to local (without rendering lightmaps.)

A pretty simple workaround, though it means doing that every time you edit the leve and want to redo lightmaps...

Would be awesome to understand what's going wrong here, though.

Modifié par Talisander, 23 mai 2010 - 11:09 .


#17
mikemike37

mikemike37
  • Members
  • 669 messages
the missing lightmaps is because the static model says it uses a lightmap but hasnt got one... thats kind of to be expected given the other problem... no meta data.

I'm afraid im starting to lose track of what files youve got and where the changes have been made. :s

semper?

EDIT: or you could zip up the files and I'll take a look.

Modifié par mikemike37, 23 mai 2010 - 11:13 .


#18
Talisander

Talisander
  • Members
  • 173 messages
No problem.  I knew I'd get that headache going eventually :P

Just to summarize, right now I've deleted every file I had before and done the following:

I've used "save all" in DAtool on the unedited model, and then renamed the model's original .mmh file, as well as its .mao file. Then, I edited the newly named .mmh, changing only the .mao file reference. I then changed the .mao file to link to my edited .dds texture. So the only files I've got are

A new .mmh -- almost exactly the same as the original model's, but pointing to:
A new .mao -- almost exactly the same as the original model's, but pointing to:
My edited diffuse .dds texture.

I then put them all in packages/core/data, as well as addins/mymod/core/data



This gets the new model to show up in the toolset, but lightmapping has the error I've listed above.

Modifié par Talisander, 23 mai 2010 - 11:24 .


#19
mikemike37

mikemike37
  • Members
  • 669 messages
okay that sounds good except you need to give the new mmh a new name otherwise it will conflict with what youve got already. Its filename IS NOT its name. Seems to be called MMH_NAME in the mmh file.

other than that, I'm not sure whether the met is linked to the msh or the mmh. If you're still getting no meta data found, it may be that every mmh needs a met. I would hope this is not the case - it would make more sense for a met to be linked to the msh (for doing the sort of thing youre trying to do, have two mmh's point at one msh), however the met does contain dependency information regarding the .mao, which you have changed. so I don't know.

anyway, try renaming it as above.

EDIT: oh did you also change the name WITHING the mao file? that also needs doing, I don't think you listed it.

Modifié par mikemike37, 23 mai 2010 - 11:33 .


#20
-Semper-

-Semper-
  • Members
  • 2 256 messages
sry, i'm confused right now. i have to fire up my pc to look into those files and their different links :D
we'll get this done, don't worry. normally it aint that difficult^^

Modifié par -Semper-, 23 mai 2010 - 11:33 .


#21
Talisander

Talisander
  • Members
  • 173 messages
lol, thanks guys :) This is pretty great getting all this help, above all because I'm starting to understand some of these file types I really didn't get before.

I tried changing MMH_NAME to match the new .mmh filename, and still get the same errors. Does seem a lot more logical to change that, though.

Modifié par Talisander, 23 mai 2010 - 11:52 .


#22
mikemike37

mikemike37
  • Members
  • 669 messages
you change the "materialObject name=" in your mao too? that wont affect the meta data though... 

It looks like youll have to copy that meta data after all. be sure to check you get the name right and only change the bits you need to (it mostly talks about the msh, so you won't need to change those references since you're still using the existing msh. or revert to plan A and just make a new everything. thats the only direction i know how to take, sorry!

Modifié par mikemike37, 23 mai 2010 - 12:08 .


#23
Talisander

Talisander
  • Members
  • 173 messages
Ok, I've created a project and uploaded my .mmh, .mao, .dds, and .lvl file in a zip so you can try rendering the lightmap yourselves.

The level is just a test space for building houses out of models which weren't intended to be used that way -- enjoy the chaos :)


Here's the project.

Modifié par Talisander, 23 mai 2010 - 12:10 .


#24
-Semper-

-Semper-
  • Members
  • 2 256 messages
k, it worked. there's still one little issue i can't solve right now. but seems this doesn't matter within the toolset. you have to test it ingame ;)

needed steps:

- start datool, choose the model you want to retexture and save all to a location you like
- grab the mmh and mao and rename it to something that suites
- drag and drop (dnd) the mmh at the opened toolset and change the referenced mmh name within top_level_struct to the mmh name your custom file is called
- change the referenced mao name within mmh_children node 5 to your custom mao file
- dnd the arttools.erf (dragon age install folder/packages/core/data_tools at the toolset and extract the appropriate .met file of the model
- close the toolset
- rename the .met file the exact name your custom mmh is called
- open the mao
- change the linked diffuse texture to your texture
- place the mmh, mao and texture files into the "my documents/bioware/dragon age/addins/your_module/core/data" and "my documents/bioware/dragon age/packages/core/data" folder
- place the met file into the "my documents/bioware/dragon age/addins/your_module/core/data_tools" and "my documents/bioware/dragon age/packages/core/data_tools" folder
- restart the toolset

now there's the little issue: if you render your lightmap the lightmapper will cry about not finding the appropriate mesh, but displays the right mesh... seems like the toolset uses the linked mesh within the mmh but still searches for a mesh file called the same way your mmh is named. the lightmap renders without problems. not tested ingame if all works - try it plz ;)

Modifié par -Semper-, 23 mai 2010 - 12:21 .

  • ladyofpayne aime ceci

#25
Talisander

Talisander
  • Members
  • 173 messages
Oh my god, you're awesome Semper :) Those are great, really painstakingly detailed instructions! (Perfect for the wiki!) Wow, will try that right now. Sorry for not responding sooner, was in the shower.



I'm trying this now, and will tell you how it works in game.