How to use .blend files directly in spring
Moderators: MR.D, Moderators
How to use .blend files directly in spring
Anarchid says here (http://springrts.com/phpbb/viewtopic.ph ... 00#p532469) that he is able to use blender .blend files directly in spring using assimp to import.
Would any one be able to help we work out how to do this?
I have tried playing with things for a few hours now but I have no idea how to make it work, or how to use assimp
http://assimp.sourceforge.net/index.html
Could some one point me in the right direction then I should be able to work things out for my self.
There does not seem to be a tutorial on this anywhere as it seems to be newly discovered.
Would any one be able to help we work out how to do this?
I have tried playing with things for a few hours now but I have no idea how to make it work, or how to use assimp
http://assimp.sourceforge.net/index.html
Could some one point me in the right direction then I should be able to work things out for my self.
There does not seem to be a tutorial on this anywhere as it seems to be newly discovered.
Re: How to use .blend files directly in spring
Considering my mutant jellyfish example is (or at least seems to be) the only successful use of blender to assemble a complete unit, i guess i'll have to volunteer.
1) make your model in blender.
2) Have a root piece and every other piece to be children of this piece if you don't want to make a metafile.
3) Be sure to apply rotation and scale to every piece before saving. Assimp doesn't parse .blend object transformations, only meshes.
4) Put model.blend in objects3d folder.
5) make a unit, and specify your new model.blend as unit's model.
6) when animating, consider that, unlike with s3o models, every piece starts aligned to global coordinates. Some trigonometry might be required to properly animate non-global-aligned pieces (say if you have a spider that has six legs that are spread at 60 degrees each).
You have to scale your model to be pretty huge in blender to get it to have decent size in game. Alternatively, you can resort to using metafile (as i mentioned above) and specify model scales appropriately. A metafile is a short lua script that returns a table with some settings; it works by being placed in objects3d folder with name = <yourmodelname>.blend.lua.
It is probably best to either start constructing your model piece-by-piece so you can get the hang of involved rituals, or just hack away at my mutant octopus jellyfish model as an example. You get a bonus treat with first method, because assimp allows reloading models on the fly.
You can get texture1 to work simply by dropping appropriate <model>.png or something into unittextures. If you want both tex1 and tex2, you will have to use metafile anyway, as far as i know.
1) make your model in blender.
2) Have a root piece and every other piece to be children of this piece if you don't want to make a metafile.
3) Be sure to apply rotation and scale to every piece before saving. Assimp doesn't parse .blend object transformations, only meshes.
4) Put model.blend in objects3d folder.
5) make a unit, and specify your new model.blend as unit's model.
6) when animating, consider that, unlike with s3o models, every piece starts aligned to global coordinates. Some trigonometry might be required to properly animate non-global-aligned pieces (say if you have a spider that has six legs that are spread at 60 degrees each).
You have to scale your model to be pretty huge in blender to get it to have decent size in game. Alternatively, you can resort to using metafile (as i mentioned above) and specify model scales appropriately. A metafile is a short lua script that returns a table with some settings; it works by being placed in objects3d folder with name = <yourmodelname>.blend.lua.
It is probably best to either start constructing your model piece-by-piece so you can get the hang of involved rituals, or just hack away at my mutant octopus jellyfish model as an example. You get a bonus treat with first method, because assimp allows reloading models on the fly.
You can get texture1 to work simply by dropping appropriate <model>.png or something into unittextures. If you want both tex1 and tex2, you will have to use metafile anyway, as far as i know.
Re: How to use .blend files directly in spring
UPD: i noticed i didn't post the actual files anywhere on this forum, so here they are: https://dl.dropbox.com/u/19320633/jellyfish.7z
Re: How to use .blend files directly in spring
Hi, Thanks for your help.
I have tried to get this to work with out any success so far.
Do you have to do anything with assimp?
I think I have followed all the instructions but no joy.
All the files seem to be in the right place and named correctly.
I have uploaded my test mod perhaps some one can see what I am doing wrong?
(I am just trying to get a unit in game at this point so the model are tex are just place holders.)
@anarchid thanks for the model. I already had it off your other posts and have been trying to play with it for weeks, but have not been able to figure out much from it. It is quite complex for my noob level of understanding.
I have tried to get this to work with out any success so far.
Do you have to do anything with assimp?
I think I have followed all the instructions but no joy.
All the files seem to be in the right place and named correctly.
I have uploaded my test mod perhaps some one can see what I am doing wrong?
(I am just trying to get a unit in game at this point so the model are tex are just place holders.)
@anarchid thanks for the model. I already had it off your other posts and have been trying to play with it for weeks, but have not been able to figure out much from it. It is quite complex for my noob level of understanding.
- Attachments
-
- emptymod.sdd.zip
- (4.23 MiB) Downloaded 34 times
Re: How to use .blend files directly in spring
Does your mod load into engine?
If so: can you spawn your riflestrider unit like this?
Additionally, you should consult your infolog.txt and search it for any mentions of 'riflestrider'.
If it actually spawns: what exactly doesn't work for you?
(also it seems my archive has vanilla zk buoy in it instead of modified jellyfish thingy. oops)
If so: can you spawn your riflestrider unit like this?
Code: Select all
/cheat
/give riflestrider
If it actually spawns: what exactly doesn't work for you?
(also it seems my archive has vanilla zk buoy in it instead of modified jellyfish thingy. oops)
Re: How to use .blend files directly in spring
his riflestrider spawns but is invisible.
this thread is about .obj files but maybe the parts about metafiles are helpful:
http://springrts.com/phpbb/viewtopic.php?f=9&t=22635
this thread is about .obj files but maybe the parts about metafiles are helpful:
http://springrts.com/phpbb/viewtopic.php?f=9&t=22635
Re: How to use .blend files directly in spring
I strongly suspect it might actually just be very very small, or underground. Happened to me while i was experimenting to get to the jellyfish phase.
Re: How to use .blend files directly in spring
hm if you press alt+v you can see hitsphere thing.
the sphere from "riflestrider" is larger than the one from the (very small) "cube" unit, so not sure if riflestrider is that small?
If it was underground it would be visible by using /wiremap command.
Could also be that the visible pieces are very offset from the unitcenter.
I do not have blender installed so can not test atm..
the sphere from "riflestrider" is larger than the one from the (very small) "cube" unit, so not sure if riflestrider is that small?
If it was underground it would be visible by using /wiremap command.
Could also be that the visible pieces are very offset from the unitcenter.
I do not have blender installed so can not test atm..
Re: How to use .blend files directly in spring
Ahh, so i got home and took a glance at your model. Here's your problem:
The entire file does not seem to contain even a single face. There are vertices, there are edges, but no faces, and that means no polygons, which means nothing gets rendered.
Here's a somewhat fixed version (note how it's misaligned and halfway buried into invisible ground, and has wrong normals on the hull piece) that, while still broken, should get you started
Ingame, it looks like this:

The entire file does not seem to contain even a single face. There are vertices, there are edges, but no faces, and that means no polygons, which means nothing gets rendered.
Here's a somewhat fixed version (note how it's misaligned and halfway buried into invisible ground, and has wrong normals on the hull piece) that, while still broken, should get you started

Ingame, it looks like this:

Re: How to use .blend files directly in spring
Thanks all.
I will look into this after work today.
I'll have to go and look at some more blender tutorials to find out why there were no faces on my model.
Thanks again for all the help.
I will look into this after work today.
I'll have to go and look at some more blender tutorials to find out why there were no faces on my model.
Thanks again for all the help.
Re: How to use .blend files directly in spring
You just need to add them by selecting some edges in mesh editing mode, and pressing F.I'll have to go and look at some more blender tutorials to find out why there were no faces on my model.
Most of your model, i facialized by simply Ctrl+A, F
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: How to use .blend files directly in spring
Attaching these files here so they don't get lost over time.Anarchid wrote:UPD: i noticed i didn't post the actual files anywhere on this forum, so here they are: https://dl.dropbox.com/u/19320633/jellyfish.7z
Re: How to use .blend files directly in spring
Hey all. Thanks
Ok so I have got the unit in game now.
I put faces on the unit and redid the normals so that is all working.
found this thread here that said to export as collada and that works and it appears in game.
http://springrts.com/phpbb/viewtopic.php?f=9&t=28053
I have not tried texturing it yet. and I am having problems scaling the unit to be larger. In blender I can't seem to find anyway of selecting everything and scaling it up that will have the same effect in game.
If I scale the root axes I cannot apply scale to them and if select the parent object (the pelvis) and scale it (then apply scale to every thing), it scales in blender but not in spring.
If I group all object apart from the root then scale the group only the parent (pelvis) scales in game.
I think I may have to remove all parent relationships then scale every thing individually then apply the parent relationships. This seems quite slow though, I would have though there would be a way of applying scale the the whole object in one command.
Ok so I have got the unit in game now.
I put faces on the unit and redid the normals so that is all working.
found this thread here that said to export as collada and that works and it appears in game.
http://springrts.com/phpbb/viewtopic.php?f=9&t=28053
I have not tried texturing it yet. and I am having problems scaling the unit to be larger. In blender I can't seem to find anyway of selecting everything and scaling it up that will have the same effect in game.
If I scale the root axes I cannot apply scale to them and if select the parent object (the pelvis) and scale it (then apply scale to every thing), it scales in blender but not in spring.
If I group all object apart from the root then scale the group only the parent (pelvis) scales in game.
I think I may have to remove all parent relationships then scale every thing individually then apply the parent relationships. This seems quite slow though, I would have though there would be a way of applying scale the the whole object in one command.
- Attachments
-
- emptymod.sdd.zip
- (4.61 MiB) Downloaded 40 times
Re: How to use .blend files directly in spring
As far as i can remember, i did this like this:
Though i had to scale it like REAL BIG to have any appreciable effect.
A better way might be using the metadata to specify model scales (see radius and height parameters)
Code: Select all
a (select all)
ctrl+a (apply)
rotation and scale
A better way might be using the metadata to specify model scales (see radius and height parameters)
Last edited by Anarchid on 17 Jan 2013, 13:35, edited 1 time in total.
Re: How to use .blend files directly in spring
Ok I may try the meta file idea.
Is there any where that explains how to write one. Or what the syntax is?
Is there any where that explains how to write one. Or what the syntax is?
Re: How to use .blend files directly in spring
You can try this for reference. Feel free to ignore the 'pieces' table, what is really useful are these:
Note that i don't really know if it will actually scale the unit ingame - so far i had no real issue with scaling units in blender (except that they had to be really humongous)
Code: Select all
radius = 25.594400,
height = 84.369293,
midpos = {-0.002754, 25.748957, 2.639958},
tex1 = "core_commander_1.dds",
tex2 = "core_commander_2.dds",