ANN: OBJ model format support - Page 3

ANN: OBJ model format support

Share and discuss visual creations and creation practices like texturing, modelling and musing on the meaning of life.

Moderators: MR.D, Moderators

User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Re: ANN: OBJ model format support

Post by Guessmyname »

Sorry, I thought you were saying that Lua animation was the be-all and end-all. Misunderstanding, in other words.

Though IK would probably be useful on giant walkers... and as memory serves, hasn't zwzsg and someone-else-from-TaUniverse-whose-name-I-forget already pulled that off?
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: ANN: OBJ model format support

Post by zwzsg »

Yes, me and Zodius, wrote some IK walkscripts. But they were taylored to specific units.

Anyway, please stop talking about I.K. See this topic to see why you should quit mentionning IK ever again.



Instead:
Guessmyname wrote:Would it be that difficult to allow the use of a format with support for skeletal animations, whilst the script just uses bones instead of pieces? Ie the animation system (ie Turn, Move, Spin etc) would be exactly the same, but would allow for mesh deformation and proper animation of organic units. Still scripted animations rather than canned, but it would solve the worst of the issues with organic units. Would that be difficult?
now this would be a possible and very awesome step forward.
User avatar
Tribulex
A.N.T.S. Developer
Posts: 1894
Joined: 26 Sep 2009, 21:26

Re: ANN: OBJ model format support

Post by Tribulex »

zwzsg wrote:Yes, me and Zodius, wrote some IK walkscripts. But they were taylored to specific units.

Anyway, please stop talking about I.K. See this topic to see why you should quit mentionning IK ever again.
:)
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: ANN: OBJ model format support

Post by CarRepairer »

Maybe this should be split off to a new question in this forum but I cannot figure out these things in Blender despite looking long and hard on the web.

1) How do I move the origin of an object, but not the object itself?

2) How do I set up a hierarchy? For example, I have an object named A. I duplicate it and name the duplicate B. I want B to be a child of A. Kloot mentions setting up pieces as parents. How?

Thanks in advance.
User avatar
Hobo Joe
Posts: 1001
Joined: 02 Jan 2008, 21:55

Re: ANN: OBJ model format support

Post by Hobo Joe »

CarRepairer wrote:Maybe this should be split off to a new question in this forum but I cannot figure out these things in Blender despite looking long and hard on the web.

1) How do I move the origin of an object, but not the object itself?

2) How do I set up a hierarchy? For example, I have an object named A. I duplicate it and name the duplicate B. I want B to be a child of A. Kloot mentions setting up pieces as parents. How?

Thanks in advance.
1) Put the cursor where you want the object center, then go to object > transform > center cursor. If you want to be precise with the location, use the cursor snapping tools in the shift-s menu.

2) Select the object that will be the child, then shift-select the object that will be parent, then press ctrl-P.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: ANN: OBJ model format support

Post by FLOZi »

zwzsg wrote:
Guessmyname wrote:Would it be that difficult to allow the use of a format with support for skeletal animations, whilst the script just uses bones instead of pieces? Ie the animation system (ie Turn, Move, Spin etc) would be exactly the same, but would allow for mesh deformation and proper animation of organic units. Still scripted animations rather than canned, but it would solve the worst of the issues with organic units. Would that be difficult?
now this would be a possible and very awesome step forward.
Everyone seems to forget that Upspring can import BVH, which (if the BOS exporter were more robust) would give us everything you ask for, except mesh deformation - Not saying it would be a nice easy workflow, though (it'd be pretty horrendous i imagine)
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: ANN: OBJ model format support

Post by CarRepairer »

Hobo Joe wrote:
CarRepairer wrote:Maybe this should be split off to a new question in this forum but I cannot figure out these things in Blender despite looking long and hard on the web.

1) How do I move the origin of an object, but not the object itself?

2) How do I set up a hierarchy? For example, I have an object named A. I duplicate it and name the duplicate B. I want B to be a child of A. Kloot mentions setting up pieces as parents. How?

Thanks in advance.
1) Put the cursor where you want the object center, then go to object > transform > center cursor. If you want to be precise with the location, use the cursor snapping tools in the shift-s menu.

2) Select the object that will be the child, then shift-select the object that will be parent, then press ctrl-P.
Thank you very much!
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: ANN: OBJ model format support

Post by Forboding Angel »

I'm not sure how I feel about having to use blender here. It has one of the most unfriendly interfaces I've seen (keep in mind, I'm not exactly in love with the wings interface), However I guess there isn't much choice considering that wings doesn't support origins.

But still... :-/
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: ANN: OBJ model format support

Post by CarRepairer »

Forboding Angel wrote:I'm not sure how I feel about having to use blender here. It has one of the most unfriendly interfaces I've seen (keep in mind, I'm not exactly in love with the wings interface), However I guess there isn't much choice considering that wings doesn't support origins.

But still... :-/
I felt exactly the same way. But when Cremuss released some awesome models in Blender format I had absolutely no choice but to dive in.* It's finally starting to grow on me.

So long UpSpring, you can join Scriptor in the recycle bin!


*Just exporting was not an option, these models used multiple materials and textures.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: ANN: OBJ model format support

Post by Pressure Line »

Argh wrote:Can we have a variant of this that will input OBJ data and output a display list? Please?
fyi argh, this already exixts.
User avatar
Cremuss
Posts: 364
Joined: 28 Oct 2006, 21:38

Re: ANN: OBJ model format support

Post by Cremuss »

Hi.

I managed to import 1 piece only units into spring using obj's but if there is more than 1 pieces, spring crash :|

Spring crash log :
http://pastebin.com/z5i3dR1e

Obj.lua :
http://pastebin.com/1ENt5Hyd

Obj file contains both 'o abc' and "o def" lines.

ZIP : (contains textures 1&2, .obj and .obj.lua)
http://cremuss.free.fr/3d/2008/radarOBJtest.zip

Also, strange problem, it seems likes it works only with very simple name. I've this single piece geothermal station which works fine, but I first tried to put the only piece under "AdvGeoThermPWStation" name (in both .obj and .obj.lua files) and it didn't work. I then tried with very simple names like "abc" and it worked..

I checked the names 10 times and it wasn't an error between .obj and .obj.lua names :roll:

Also, after a crash spring said it should be a driver problem, but that appeared once in fifty crashs :shock:

[ebuild R ] x11-drivers/nvidia-drivers-195.36.24 USE="(multilib) -acpi -custom-cflags -gtk" 41,093 kB

spring 0.82.1, linux, nvidia 7600gt. I'm running the lowest settings possible (also tried the highest, but it didn't change anything :mrgreen: )

Any ideas ? :?
Thx
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: ANN: OBJ model format support

Post by CarRepairer »

I'm getting errors as well. I'm no expert pythonist but perhaps line 172 needs to be changed from

Code: Select all

log.Write("mid-pos distance of piece \"%s\": %.2f, {min, max}Y: %.2f, %.2f\n" % ((rr ** 0.5), minPieceY, maxPieceY))
to

Code: Select all

log.Write("mid-pos distance of piece \"%s\": %.2f, {min, max}Y: %.2f, %.2f\n" % (modelPieceName, (rr ** 0.5), minPieceY, maxPieceY))
Changing this made it so the lua now generates, but I still get this error:

Code: Select all

line 31, in Flush self.logFile.write(logBuff)
NameError: global name 'logBuff' is not defined
Exception NameError: "global name 'logBuff' is not defined" in <bound method SimpleLog.__del__ of <__main__.SimpleLog instance at 0x0400B080>> ignored
User avatar
Cremuss
Posts: 364
Joined: 28 Oct 2006, 21:38

Re: ANN: OBJ model format support

Post by Cremuss »

In fact I don't even use the blender exporter script. The .obj.lua are easy enough to be written by hand (at least basic ones)
I tried the script in blender 2.49, though, and I couldn't get it working (same errors than CarRepairer, it was complaining about mid pos distance blabla)

Anyway I'm using blender 2.5 now so I guess the script needs to be ported on 2.5, I didn't try though.

CarRepairer, did you try to write a basic .obj.lua by hand to see if importing a model is at least working ?
Spring crash instantly every time I click on the unitpic to build the unit (ingame)

Upspring don't work anymore with wine 1.2 so .obj is the only way for me...
I could try downgrading wine but importing units in spring on linux shouldn't be that much tricky... :/
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: ANN: OBJ model format support

Post by CarRepairer »

Cremuss wrote:The .obj.lua are easy enough to be written by hand
Nooooooooooo thank you.
Cremuss wrote:CarRepairer, did you try to write a basic .obj.lua by hand to see if importing a model is at least working ?
Actually I haven't even loaded up the RC Spring, I am just trying to learn some more blender and be ready when it's out. Sorry :(
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: ANN: OBJ model format support

Post by Kloot »

Thanks for spotting those typos in the exporter script, I've attached a new version at the top of this thread. As for getting it to work in Blender 2.5, the scripting API changes since 2.4 are probably going to mean a rewrite.
Cremuss wrote:Spring crash instantly every time I click on the unitpic to build the unit (ingame)
Sorry about that, there are some bugs left in the OBJ loading code. I'll fix them before the RC goes live.

edit: done ;)

Image
Attachments
uar_highpowerradar.png
(2.04 MiB) Downloaded 2 times
User avatar
Cremuss
Posts: 364
Joined: 28 Oct 2006, 21:38

Re: ANN: OBJ model format support

Post by Cremuss »

Thank you Kloot :-)

The new exporter scripts is working in blender, everything is good expect that radius, height, and midpos are all 0. Did I do something wrong or is your script not suppose to write them ?

Also, it seems that the script exports everything in the scene (in blender). It could be cool to export only selected objects :-)
Kloot wrote:Sorry about that, there are some bugs left in the OBJ loading code. I'll fix them before the RC goes live.
No problem, I'll wait for the next release (or at least the next fixes) 8)
CarRepairer wrote:Actually I haven't even loaded up the RC Spring, I am just trying to learn some more blender and be ready when it's out. Sorry
Hehe, goodluck with blender :mrgreen:
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: ANN: OBJ model format support

Post by Kloot »

Cremuss wrote: The new exporter scripts is working in blender, everything is good expect that radius, height, and midpos are all 0. Did I do something wrong or is your script not suppose to write them ?
No, those should definitely be filled in automatically. May I see the script's export log for uar_highpowerradar.obj? (it should just be called uar_highpowerradar.log and saved alongside the .lua metadata)
User avatar
Cremuss
Posts: 364
Joined: 28 Oct 2006, 21:38

Re: ANN: OBJ model format support

Post by Cremuss »

Code: Select all

[SpringOBJMetaDataScriptExporter] export log for model "uar_highpowerradar"

processed object "base" with offsets {0.00, 0.00, 0.00} (has parent: true)
processed object "cylinder" with offsets {0.00, 0.00, 0.00} (has parent: false)
processed object "turret" with offsets {0.00, 0.00, 0.00} (has parent: false)
processed object "radars" with offsets {0.00, 0.00, 0.00} (has parent: false)
model has 4 pieces (has root-piece: true)
model-piece "turret" is a child of "base" (parent has 1 children)
model-piece "radars" is a child of "base" (parent has 2 children)
model-piece "cylinder" is a child of "base" (parent has 3 children)
model mid-position: <0.00, 0.00, 0.00>
mid-pos distance of piece "turret": 0.00, {min, max}Y: 0.00, 0.00
mid-pos distance of piece "radars": 0.00, {min, max}Y: 0.00, 0.00
mid-pos distance of piece "cylinder": 0.00, {min, max}Y: 0.00, 0.00
mid-pos distance of piece "base": 0.00, {min, max}Y: 0.00, 0.00
My blender scene was made of 4 objects, with all their origins centered to 0,0,0.
One object called "base" with three childrens parented to it : "radars", "cylinder", "turret".
No scales, no rotations, no modifiers, nothing.
I can give you the blender file if you want.

.lua metadata
http://pastebin.com/WQ28dN3T
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: ANN: OBJ model format support

Post by Kloot »

Thanks.
Cremuss wrote:My blender scene was made of 4 objects, with all their origins centered to 0,0,0.
Do you mean all objects were at <0,0,0> in the same global space, but with offset vertices to prevent overlapping geometry? If so, that won't work; the script expects that each child object as a whole is translated with respect to its parent (for the calculation of radius and height, it doesn't actually look at vertex positions).
User avatar
Cremuss
Posts: 364
Joined: 28 Oct 2006, 21:38

Re: ANN: OBJ model format support

Post by Cremuss »

ah ok thanks. Height,radius and midpos works now.
Post Reply

Return to “Art & Modelling”