[tutorial]how to import custom models into spark

borgkingborgking Join Date: 2009-11-24 Member: 69504Members
edited December 2009 in NS2 General Discussion
Hi, today I'm going to write about the model compiling process with the spark builder.
I wasn't able to import it with textures working yet, so if you find any way to do it, please help.
At first you need a modeling programm which is able to export into the Collada format (.dae).

<b>For XSI, 3Dsmax and Blender users:</b>
I noticed there is a problem with the export from XSI which makes spark tools crash, so I ported into blender, which is open source, via obj export.
There I simply imported the file, after deleting any other objects. Select in this tool is right click.
So finaly I select my model and export with export->collada 1.4 There I used Triangles/Only export selection/use UV image mat.
If you have entered your directory, filename and the .dae extention press export. Notice: to compile the file has to lay in a subdirectory of your mods modelsrc directory.
<a href="http://borgkinghome.bo.funpic.de/tutorials/spark_modelcompile/spark_export_dae.jpg" target="_blank">http://borgkinghome.bo.funpic.de/tutorials..._export_dae.jpg</a>

So when you have exported into the collada format, you have to write a small text data, similar to .qc files of the source engine.
Simply create a new textdocument in the dae's directory and rename it to <your model's name>.model_compile.
You can easily edit it with notepad or any other text editor.
Now you have to type following into this model_compile file:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><model>
        <geometry (your .dea's file name).dae />
</model><!--c2--></div><!--ec2-->
Save and build with the builder, and you have a game ready compiled version of your model in your spark ;)
I assume to get the textures working you have to add anything into this, since the viewer shows textures if you let it show the .dae.
So, Max, can you please enlighten us?

/e: Pipi: simply try to export to blender, the same way as with XSI...

Comments

  • PipiPipi Join Date: 2009-12-09 Member: 69550Members
    It crashes too when exporting DAE from 3Dsmax..
  • ArkArk Join Date: 2009-08-15 Member: 68489Members
    edited December 2009
    Thx for this, too bad we have to keep doing stuff by trail and error to figure this stuff out.

    I tried opening the .model file with notepad and changing the material line to match a .material file, but i think it corupts the file has it won't load in the viewer after being edited.
  • Draco_2kDraco_2k Evil Genius Join Date: 2009-12-09 Member: 69546Members
    Awesomesauce. Thanks for figuring this out!

    <!--quoteo(post=1744356:date=Dec 19 2009, 11:19 PM:name=Ark)--><div class='quotetop'>QUOTE (Ark @ Dec 19 2009, 11:19 PM) <a href="index.php?act=findpost&pid=1744356"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Thx for this, too bad we have to keep doing stuff by trail and error to figure this stuff out.<!--QuoteEnd--></div><!--QuoteEEnd-->
    Too bad? We're rushing ahead of developers with this: they said they'll release documentation in a while.
  • ArkArk Join Date: 2009-08-15 Member: 68489Members
    edited December 2009
    <!--quoteo(post=1744368:date=Dec 19 2009, 10:55 PM:name=Draco_2k)--><div class='quotetop'>QUOTE (Draco_2k @ Dec 19 2009, 10:55 PM) <a href="index.php?act=findpost&pid=1744368"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Awesomesauce. Thanks for figuring this out!


    Too bad? We're rushing ahead of developers with this: they said they'll release documentation in a while.<!--QuoteEnd--></div><!--QuoteEEnd-->

    Then whats the point of releasing stuff without proper documentation? A simple .pdf would have sufficed until they have time to proper document it.
  • Dauntl3ssDauntl3ss Join Date: 2002-11-08 Member: 7737Members
    They might have felt that the way importing worked wasn't living up to the standards we've come to expect from UWE, thus they wanted to wait until it was all working properly. Just a guess...
  • PipiPipi Join Date: 2009-12-09 Member: 69550Members
    You guys need to put yourself in the situation.

    They are an independant company whose producing their own tools.. and they're releasing their "work-in-progress" stuff along the way to people who have pre-bought the game.

    It's not like they're going to publish an update fully clean of things that doesn't yet work properly or completed artworks every week.

    I think everyone saw the tram repair arm model, yet not textured. Another example of their WIP is the builder, that is not yet fully functionnal but I can see how it will become a solid tool to work with.

    I think some of us here are a bit too demanding.. about their pre-order.

    ;)
  • Draco_2kDraco_2k Evil Genius Join Date: 2009-12-09 Member: 69546Members
    <!--quoteo(post=1744395:date=Dec 20 2009, 01:46 PM:name=Ark)--><div class='quotetop'>QUOTE (Ark @ Dec 20 2009, 01:46 PM) <a href="index.php?act=findpost&pid=1744395"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Then whats the point of releasing stuff without proper documentation?<!--QuoteEnd--></div><!--QuoteEEnd-->
    Because then we'd have to wait a lot longer. Most of Spark is self-explanatory anyway.
  • ArkArk Join Date: 2009-08-15 Member: 68489Members
    edited December 2009
    <!--quoteo(post=1744407:date=Dec 20 2009, 01:46 PM:name=Draco_2k)--><div class='quotetop'>QUOTE (Draco_2k @ Dec 20 2009, 01:46 PM) <a href="index.php?act=findpost&pid=1744407"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Because then we'd have to wait a lot longer. Most of Spark is self-explanatory anyway.<!--QuoteEnd--></div><!--QuoteEEnd-->

    The editor and viewer are easy to get into and understand, just wish the <i>other</i> tools add a little more documentation.

    Im not trying to be a ###### here, just think they should properly test stuff and have documentation ready, if not then hold the tools back til time permits.
  • steppin'razorsteppin'razor Join Date: 2008-09-18 Member: 65033Members, Constellation
    Your using pre alpha tools and expecting documentation and no bugs?

    If that's how you feel don't use them until the build is up to your standards.
  • Draco_2kDraco_2k Evil Genius Join Date: 2009-12-09 Member: 69546Members
    <!--quoteo(post=1744409:date=Dec 20 2009, 04:59 PM:name=Ark)--><div class='quotetop'>QUOTE (Ark @ Dec 20 2009, 04:59 PM) <a href="index.php?act=findpost&pid=1744409"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Im not trying to be a ###### here, just think they should properly test stuff and have documentation ready, if not then hold the tools back til time permits.<!--QuoteEnd--></div><!--QuoteEEnd-->
    Then there would be no Alpha.

    No one's forcing anyone to figure out the tools on their own, one could indeed wait until there's some documentation to go with them.
  • ArkArk Join Date: 2009-08-15 Member: 68489Members
    Still you don't release stuff weather it's alpha or not without some form of indication about how it works.
    I see it as a case of people pushing UW to get tools out without them being able to test them properly and UW are doing it to keep there customers happy.
  • Draco_2kDraco_2k Evil Genius Join Date: 2009-12-09 Member: 69546Members
    <!--quoteo(post=1744427:date=Dec 20 2009, 07:12 PM:name=Ark)--><div class='quotetop'>QUOTE (Ark @ Dec 20 2009, 07:12 PM) <a href="index.php?act=findpost&pid=1744427"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Still you don't release stuff weather it's alpha or not without some form of indication about how it works.
    I see it as a case of people pushing UW to get tools out without them being able to test them properly and UW are doing it to keep there customers happy.<!--QuoteEnd--></div><!--QuoteEEnd-->
    You don't release either Alphas or Betas at all.

    <a href="http://en.wikipedia.org/wiki/Software_release_life_cycle" target="_blank">http://en.wikipedia.org/wiki/Software_release_life_cycle</a>

    We're currently in pre-alpha. No one badgered UW to do this, they did the same sort of thing with NS1 to get the community up to speed so they could ship some user-made maps with the game. Plus feedback, of course.
  • BiglinesBiglines Join Date: 2003-12-07 Member: 24094Members, Constellation
    great to see blender being used for this ;)

    I would like to offer my services as a modeler if anyone needs custom props, I can't guarantee deadlines, but I can do fairly complex models for anyone requiring them, as long as I enjoy making them ;) (so not a hundred different lightsources, but advanced machinery or stuff like that should be cool, just draw some concepts and I'll see if I can offer my assistance)


    my question for UWE, will we be able to have animated models as props? would be cool to have those arms moving around instead of just having static maps. (plus it would be a cool gameplay element)
  • Draco_2kDraco_2k Evil Genius Join Date: 2009-12-09 Member: 69546Members
    <!--quoteo(post=1744446:date=Dec 20 2009, 10:02 PM:name=Biglines)--><div class='quotetop'>QUOTE (Biglines @ Dec 20 2009, 10:02 PM) <a href="index.php?act=findpost&pid=1744446"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->my question for UWE, will we be able to have animated models as props? would be cool to have those arms moving around instead of just having static maps. (plus it would be a cool gameplay element)<!--QuoteEnd--></div><!--QuoteEEnd-->
    Absolutely. It's already in the Alpha.
  • StappStapp Join Date: 2009-06-10 Member: 67775Members
    edited December 2009
    COLLADA files from MilkShape 3D work fine.

    <a href="http://img693.imageshack.us/i/ak47s.jpg/" target="_blank"><img src="http://img693.imageshack.us/img693/5055/ak47s.th.jpg" border="0" class="linked-image" /></a>
  • BlueOneBlueOne Join Date: 2002-11-05 Member: 7036Members
    Hey Stapp, can you tell how you managed to have it displayed with the textures ?

    I dunno what I'm doing wrong but each time I load my model in the viewer, it says:
    Couldn't open file "models/.material"
    Couldn't open file "notfound.material"

    And so my model is displayed without any textures...

    All my files are in:
    C:\Program Files\Natural Selection 2\ns2\models\mystuff
    pillar.dds
    pillar_spe.dds
    pillar.model
    pillar.material

    pillar.material content:
    <!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec--><material>
    <maps>
    <map type="texture" value="models/mystuff/pillar.dds" />
    <map type="specular" value="models/mystuff/pillar_spe.dds" />
    </maps>
    </material><!--QuoteEnd--></div><!--QuoteEEnd-->

    And the model_compiler content:
    <!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec--><model>
    <geometry pillar.dae />
    </model><!--QuoteEnd--></div><!--QuoteEEnd-->

    i'm using plugin colladamax 3.04c for 3DS...I think it works quite well since my model is displayed in the viewer...only the textures are missing and I really wonder why.

    Can you help ?

    Thank you
  • StardogStardog Join Date: 2004-10-25 Member: 32448Members
    What's the weird scale that NS2 is using? All my models are huge.
  • StappStapp Join Date: 2009-06-10 Member: 67775Members
    To build a model with textures, you need to add a <b>materials_path</b> tag to the model_compile file like so:

    <!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto--><model>
    <geometry "pillar.dae" />
    <b> <materials_path "models/mystuff" /></b>
    </model><!--fontc--></span><!--/fontc-->

    You can also scale model size:

    <!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto--><model>
    <geometry "pillar.dae" />
    <materials_path "models/mystuff" />
    <b> <scale 1.0 /></b>
    </model><!--fontc--></span><!--/fontc-->

    <b>scale</b> being any float value above 0.
  • borgkingborgking Join Date: 2009-11-24 Member: 69504Members
    edited December 2009
    Great!
    So you have finaly solved this :)
    Thank you for this!

    /e: doesnt't work somehow:

    <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><model>
    <geometry "fish01.dae" />
    <materials_path "models/darkwater/nature" />
    <scale 10.0 />
    </model><!--c2--></div><!--ec2-->
    and
    <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->Couldn't open file "models/.material"
    Couldn't open file "notfound.material"<!--c2--></div><!--ec2-->
  • BlueOneBlueOne Join Date: 2002-11-05 Member: 7036Members
    yea it's not working for me either :/

    When i open any UWE models with wordpad, i can find a line/path like:
    models/props/refinery/mining_computer_01.material

    however mine keep being stuck with this line:

    models/.material

    even when I add the material path to the model_compiler...it still remains the same (and if I edit it manually, the model doesnt work at all).
  • StappStapp Join Date: 2009-06-10 Member: 67775Members
    You said your model was untextured, right? That's probably the reason why it won't load your materials. You'll have to assign the material(s) to your model in 3dsmax before exporting.
  • borgkingborgking Join Date: 2009-11-24 Member: 69504Members
    It was, as I exported it from XSI, and it was when I exported from Blender.
    Also loaded the dae into the viewer and it shows the texture. Only when it's compiled the texture is missing :(
  • lillbrorsanlillbrorsan Join Date: 2003-08-21 Member: 20060Members, Constellation, Reinforced - Shadow
    I know this thread is a bit old but i am having the exact same problems, my model is textured in Maya then exported to .DAE, the compile file has the materials_path in it pointing at the right folder, the dds file has its own .material file but still my model comes up untextured in both the editor and viewer.
  • SgtBarlowSgtBarlow Level Designer Join Date: 2003-11-13 Member: 22749Members, NS2 Developer
    You have to alter the file path in the COLLODA file after export for the texture used to the actual location of the the texture.
    or
    Remove the path so its just my_texture.dds and place a copy of the textures .material file in along side the model.


    *Blender wont export Colloda if "Use Relitive Paths" is selected.



    Does anyone know how to get the physics mesh to work in blender cause i can run through my models :/ ?
Sign In or Register to comment.