### Topic: Blender to .mod scripts are there any working?  (Read 32985 times) var addthis_config = {"data_track_clickback":true};

0 Members and 1 Guest are viewing this topic.

#### FoaS_XC

• Photorps, Sammiches, woot woot.
• Global Moderator
• Commander
• Posts: 4571
• Gender:
##### Re: Blender to .mod scripts are there any working?
« Reply #180 on: November 14, 2010, 11:31:56 am »
lol. anything I can help with?
Robinomicon
"When I was 5 years old, my mom always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down “happy.” They told me I didn’t understand the assignment and I told them they didn’t understand life."

#### Bonk

• Commodore
• Posts: 13298
• You don't have to live like a refugee.
##### Re: Blender to .mod scripts are there any working?
« Reply #181 on: November 14, 2010, 11:50:00 am »
It's complicated... not sure I even have any solid questions... my main problems at the moment are two things - the flags values, and some basic texturing concepts and how they relate to blender objects... ideally I'd have a modelling expert watching over my shoulder filling me in on all the modelling stuff that is second nature to them...

I need to figure out how to handle this kind of thing in python:
http://kinsey.no/blog/index.php/2009/11/17/storing-multiple-privilegessettings-in-a-single-integer/

That's how the material flags are stored:
Code: [Select]
 enum { kTexMapped      = 0x0001, // set if texture mapping kGouraud        = 0x0002, // set if gouraud (smooth) shading kFlat = 0x0004, // set if flat shading kWire           = 0x0008, // set if polygon should be wire frame kAdditive = 0x0010, // set if polygon should be blended kLuminance = 0x0020, // set if we have luminance texture maps };
So if it is texture mapped, Gourad shaded and has a luminance texture the integer value is 35.... but I need to figure out how to succinctly analyse this value in python... get all the possible combinations and then do the right thing to the material... see how it is kinda hard to wrap one's head around? My problem is I'm no expert in any one programming language. It gets confusing sometimes.

Then I need to pull the UV coords for each face out and in the get them in the right format for the blender object. I have already parsed the data from the file, I just need to get it into the right form... (then I can strip out all the redundant data and debug output...)

I need it sorted better in my head before I can put it to code.

Once that is done I'll need to figure out exactly how to implement the LODs in blender. It will be easy enough to loop through and pull out the other meshes once the first is all the way done, but then how to store, display and name in blender? what is the logical and appropriate mechanism that will be natural for the user to follow... I like natural and intuitive UI design whether actual display is involved or not.

and radioparadise is distracting the hell out of me, but I need it...

#### FoaS_XC

• Photorps, Sammiches, woot woot.
• Global Moderator
• Commander
• Posts: 4571
• Gender:
##### Re: Blender to .mod scripts are there any working?
« Reply #182 on: November 14, 2010, 11:52:39 am »
I'm not sure how to extract flags like that >.< I can't help you there, but I can give you some theory on UV Unwrapping.
Robinomicon
"When I was 5 years old, my mom always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down “happy.” They told me I didn’t understand the assignment and I told them they didn’t understand life."

#### Bonk

• Commodore
• Posts: 13298
• You don't have to live like a refugee.
##### Re: Blender to .mod scripts are there any working?
« Reply #183 on: November 14, 2010, 12:05:19 pm »
I'm OK on theory I think... it's just projecting the plane(s) on the surface face by face ... the numbers are all there...

What I'm not really familiar with is the texturing interfaces from the user side in blender... I expect this is also where marstone got a bit hung up...

Oh ... I know what would help ... an equivalent model in the sample pack in native .blend format... could you manage that somehow? (note to avoid naming objects in a way that might conflict with blender system objects... I'm a fan of and perhaps overuse prefixes on everything. - but I suppose I'll have to consider the user that wants to name their model file bpy.data.meshes.mod or something like that....  sanitize all input... hhmmm another place for a prefix!  )

#### FoaS_XC

• Photorps, Sammiches, woot woot.
• Global Moderator
• Commander
• Posts: 4571
• Gender:
##### Re: Blender to .mod scripts are there any working?
« Reply #184 on: November 14, 2010, 12:06:16 pm »
Erm - I don't have a copy of Blender handy - maybe kreeargh?
Robinomicon
"When I was 5 years old, my mom always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down “happy.” They told me I didn’t understand the assignment and I told them they didn’t understand life."

#### Bonk

• Commodore
• Posts: 13298
• You don't have to live like a refugee.
##### Re: Blender to .mod scripts are there any working?
« Reply #185 on: November 14, 2010, 12:10:09 pm »
Needs to be the 2.55 beta too... oh wait... I'm passing the buck a bit much here, I suppose I can import the control model from the .3ds version in blender and then save it in native format... but I'm leery of that 3ds import script... it looks too scary inside... not organised the way I would...

I'll just do that and see what I get for now, it should help. As does working it out in posts like this...

#### FoaS_XC

• Photorps, Sammiches, woot woot.
• Global Moderator
• Commander
• Posts: 4571
• Gender:
##### Re: Blender to .mod scripts are there any working?
« Reply #186 on: November 14, 2010, 12:11:37 pm »
Lol, alrighty then - the 3ds Version is the same as the Control: bare essentials + Materials. Can't add dummy points (hardpoints, etc) I dont think.
Robinomicon
"When I was 5 years old, my mom always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down “happy.” They told me I didn’t understand the assignment and I told them they didn’t understand life."

#### Bonk

• Commodore
• Posts: 13298
• You don't have to live like a refugee.
##### Re: Blender to .mod scripts are there any working?
« Reply #187 on: November 14, 2010, 12:16:36 pm »
Can't add dummy points (hardpoints, etc) I dont think.
Curious as to the explanation?

Here is the result of importing the 3ds control model into blender... hmmm.... I had hoped to see textures for an example to work toward....

#### FoaS_XC

• Photorps, Sammiches, woot woot.
• Global Moderator
• Commander
• Posts: 4571
• Gender:
##### Re: Blender to .mod scripts are there any working?
« Reply #188 on: November 14, 2010, 12:18:41 pm »
I don't think 3ds Supports dummy objects. I could be wrong, however. I was under the impression that it handles only geometry.

You might have to reassign the bitmap, it may be pointing to somewhere on my desktop >.< Furthermore, 3ds Format only supports a few characters in texture name assignments, so it probably nixed off the last few charcters of the texture name.
Robinomicon
"When I was 5 years old, my mom always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down “happy.” They told me I didn’t understand the assignment and I told them they didn’t understand life."

#### Bonk

• Commodore
• Posts: 13298
• You don't have to live like a refugee.
##### Re: Blender to .mod scripts are there any working?
« Reply #189 on: November 14, 2010, 12:21:02 pm »
I get nothing at all for materials or textures with the blender 2.55 .3ds import script... (perhaps the import for the new beta is not finished?) I guess I'll have to fire up blender 2.49 and see what I get...

#### FoaS_XC

• Photorps, Sammiches, woot woot.
• Global Moderator
• Commander
• Posts: 4571
• Gender:
##### Re: Blender to .mod scripts are there any working?
« Reply #190 on: November 14, 2010, 12:53:23 pm »
new 3ds file with shorter file names for the textures so they don't truncate.
Robinomicon
"When I was 5 years old, my mom always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down “happy.” They told me I didn’t understand the assignment and I told them they didn’t understand life."

#### Bonk

• Commodore
• Posts: 13298
• You don't have to live like a refugee.
##### Re: Blender to .mod scripts are there any working?
« Reply #191 on: November 14, 2010, 01:25:51 pm »
OK that did it... importing that file into blender 2.55 with its included 3ds import seems to work. (attached) Now I have a corresponding example to work toward. Perhaps that same model in .mod format as exported by max would be good too...

#### FoaS_XC

• Photorps, Sammiches, woot woot.
• Global Moderator
• Commander
• Posts: 4571
• Gender:
##### Re: Blender to .mod scripts are there any working?
« Reply #192 on: November 14, 2010, 03:17:28 pm »
Okay, Once more time. Here is the file with all the different color-depthed textures (which I dont think will matter in the MOD format, since all it does is point to a texture). There are also versions with the two different illumination-texture math that we talked about. The types of MOD and 3ds formats are documented in the Information.txt file, but I can also walk you through it on TS of course, if there is any ambiguity.

http://robinomicon.com/haven/bonk/ColorDepth%20and%20Illuminence%20Types.zip

Robinomicon
"When I was 5 years old, my mom always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down “happy.” They told me I didn’t understand the assignment and I told them they didn’t understand life."

#### Kreeargh

• Retired.
• Lt. Commander
• Posts: 1476
• Gender:
• Life is as is worth only what you learn from it!
##### Re: Blender to .mod scripts are there any working?
« Reply #193 on: November 14, 2010, 08:53:15 pm »
Erm - I don't have a copy of Blender handy - maybe kreeargh?
Yea what version i have 2.49 and 2.5. I havent checked in a while im not sure 2.5 went past beta yet.
Time for life!

#### FoaS_XC

• Photorps, Sammiches, woot woot.
• Global Moderator
• Commander
• Posts: 4571
• Gender:
##### Re: Blender to .mod scripts are there any working?
« Reply #194 on: November 14, 2010, 10:34:22 pm »
*giggle* you said "maxunits"  hehe hehe hehe ...

I just got that......
Robinomicon
"When I was 5 years old, my mom always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down “happy.” They told me I didn’t understand the assignment and I told them they didn’t understand life."

#### Bonk

• Commodore
• Posts: 13298
• You don't have to live like a refugee.
##### Re: Blender to .mod scripts are there any working?
« Reply #195 on: November 15, 2010, 02:57:07 pm »
I've got the materials flags sorted now, by unpacking the 4 byte int into a tuple, then converting to a binary string and with a little string massaging a gourad shaded material with a diffuse texture and a luminance texture looks like '100011'...

with each bit representing: 'kTexMapped,kGouraud,kFlat,kWire,kAdditive,kLuminance' (in reverse order)

As we discussed, it appears the 3dmax .mod exporter does not set the additive flag, I am most curious if the game engine will recognise it if set. (edit: I suspect it won't as there are structures for diffuse and luminace textures but not additive ones, but if a texture in the diffuse or luminance slot is also marked as additive - what will happen?)

I'm as far as adding materials, I've almost got it figured out.

It seems there are about 16 ways to skin the cat of texturing something and the .mod file format takes one approach (an old one), the architecture of the blender format is considerably more complicated...

The idea that comes to mind is material wrapped vs texture wrapped texturing. The .mod is something in-between.    As we discussed, the shading and other parameters are set by material in the .mod format but are set by texture in blender... I'm not 100% I've got it right, but I will by the time this is done.

Texturing is friggin complicated. This is not easy. I'm starting to get the hang of Python though. That's a good thing.
« Last Edit: November 15, 2010, 03:18:00 pm by Bonk »

#### FoaS_XC

• Photorps, Sammiches, woot woot.
• Global Moderator
• Commander
• Posts: 4571
• Gender:
##### Re: Blender to .mod scripts are there any working?
« Reply #196 on: November 15, 2010, 04:28:37 pm »
If the additive property is recognized by the engine, it won't need any sort of value indicated its strength, its a boolean property. Basically it means instead of display a model normally, it will take each of the model and add it to the pixel of the background.

Here's an example:

The teapot on the left is normally shaded, the teapot on the right has its additive flag turned on. No strength floats or anything, just "yes/no" flag.

Actually, now that I think about it - the engine has to support additive texturing in one form or another, because of how it does shields, phaserbeams, and what not.... In fact. I dare you to open the shield.mod and see if it has additive flags turned on.
Robinomicon
"When I was 5 years old, my mom always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down “happy.” They told me I didn’t understand the assignment and I told them they didn’t understand life."

#### marstone

• Because I can
• Commander
• Posts: 3014
• Gender:
• G.E.C.K. - The best kit to have
##### Re: Blender to .mod scripts are there any working?
« Reply #197 on: November 15, 2010, 05:19:26 pm »
yes textures are complicated (specially for us none graphics type people). One reason I stopped at that point.  I got abit lost, and the support guys got busy on other things so didn't get questions answered as needed to keep going.
The smell of printer ink in the morning,
Tis the smell of programming.

#### Bonk

• Commodore
• Posts: 13298
• You don't have to live like a refugee.
##### Re: Blender to .mod scripts are there any working?
« Reply #198 on: November 15, 2010, 05:43:54 pm »
Actually, now that I think about it - the engine has to support additive texturing in one form or another, because of how it does shields, phaserbeams, and what not.... In fact. I dare you to open the shield.mod and see if it has additive flags turned on.

You bastard... I was watching the lastest Episode of Canada's Worst Driver (funny stuff)... now I have to go look...

yes textures are complicated (specially for us none graphics type people). One reason I stopped at that point.  I got abit lost, and the support guys got busy on other things so didn't get questions answered as needed to keep going.

I had a great chat with Tus and FoaS on TS yesterday while I stewed it all over... I was wishing you were there too, but I was just kind of rambling all afternoon as I read through the blender and python docs and quizzed the guys on modelling stuff.

We are going to have to brush up on and fully comprehend all of it, plus some of the new stuff in the last ten years eventually...

Feel free to jump back in with it any time, I'm still at what you called the "spagetti code" stage with it. I have a bunch of useless stuff in there and some stuff still not worked out, in the right form...

What I'm grappling with in me head right now is meshes.uv_textures vs meshes.texture_slots and all the various combinations of such object trees in blender.

I may end up using bones as in milkshape... what object are hardpoints labelled from in max again?

#### FoaS_XC

• Photorps, Sammiches, woot woot.
• Global Moderator
• Commander
• Posts: 4571
• Gender:
##### Re: Blender to .mod scripts are there any working?
« Reply #199 on: November 15, 2010, 05:45:14 pm »
Been on teamspeak for about an hour while I play EVE, just in case you dropped in and needed help
Robinomicon
"When I was 5 years old, my mom always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down “happy.” They told me I didn’t understand the assignment and I told them they didn’t understand life."