Author Topic: Lightsaber material in D3  (Read 846 times)

0 Members and 1 Guest are viewing this topic.

bitterman

  • Sr. Member
  • ****
  • Posts: 262
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Re: Lightsaber material in D3
« Reply #15 on: April 08, 2017, 07:42:29 AM »
Can you remind few things for me:

1) how to create/export model (md5 or ase) with few separated materials (Blender's export);

2) can I add any particle emitter to this model (looks like these .prt into .def like smoke_wound etc are predefined in Code)?

Thanks.

argoon

  • Sr. Member
  • ****
  • Posts: 275
  • Karma: +21/-81
  • Doom Newbie
    • View Profile
Re: Lightsaber material in D3
« Reply #16 on: April 08, 2017, 10:02:21 AM »
Can you remind few things for me:

1) how to create/export model (md5 or ase) with few separated materials (Blender's export);

2) can I add any particle emitter to this model (looks like these .prt into .def like smoke_wound etc are predefined in Code)?

Thanks.

I already said this so i will just quote my self here:

1a)
Quote

First you need to have a working md5 exporter for blender.

Second you need to know how to correctly use that exporter, the one i use (the one graciously given by the arx team), needs the exported bones to be in a separated layer, layer 5 to be exact. That is so you can have a complex animating rig in one layer and only export the bones you need in another.

Third the root bone MOST be called origin, is a requirement and it is used as the root point of the animated model, as well has the "floor" for characters, so it should be put where it makes sense, like between the feet of a character. Btw i don't know if this is really necessary but i heard that you should animate the root bone as well when you want a model to move from a place to another ingame.

Four you need to make a .def file for the animated model, is a requirement, in this .def file you define, the md5 mesh and the md5 animations, this file is very important and very powerful, on it you can define, particle effects to particular sounds that come from particular bones or animation frames, plus other things.

Five a idle animation should always be defined, it can be a single frame.

six be careful with weight painting the mesh, sometimes you think you have all bones perfectly weighted but they are not.

About bone limitations, i'm no expert but this is what i recall, idtech 4 supports max 256 bones on a single character (the animation rig on blender or others can have more but it should be baked to 256 bones or less) and a vertex on the mesh can only be assigned to a single bone, but the bone can influence many vertex's (this is equal to many other engines), md5 only supports bone animation. 

Right now i don't have the link for the Arx exporter but i think it is posted somewhere on this forum.

1b) I personaly don't recommend ase, Blender supports lwo files natively, and idtech 4 has very nice support for static lwo, but blender lwo support is not on by default you need to turn the plugin on,  file -> user preferences -> import-export section.

Btw ase is a text based file (just like md5) and lwo is a binary file, so in principle it should be easier to work with ase but on Doom 3 ase is not very well implemented because you need to edit the material or texture link naming in the file after export by hand (even if you renamed the material on blender to the correct name path) to be able to open it on idtech 4, in the case of lwo just rename the material to the name of the material on the idtech4 .mtr file something like (textures/somefoulder/somename) and it just automagically works.

There's also a nice model viewer and converter called Noesis here, that can view and convert many file formats including both md3 (it seems idtech 4 still supports md3 just needs some scripting magic for it to work see the thread on Dark Mod forums, still a good format for vertex animation) and more importantly md5 files.

2) About particle attachment to bones, afaik it should work with any particle, provided you don't change the key name, in your example smoke_wound should still be called smoke_wound, only the .prt file name could be anything.
Btw i have still to try it my self but i don't see why it would be impossible to make a custom key/value particle for a existent monster, imo is just a case of making a particle, write a custom key name in the monster file "my_smoke" give it a custom particle name "my_particle.prt" (i think an .fx file also works) then make a script something like so:

pseudo code this was not tested:

Code: [Select]
entity Monster_ent;
entity emiter;
vector jointPos;
string effect;

Monster_ent = sys.getEntity("monster name");
effect = Monster_ent.getkey("my_smoke");
jointPos = Monster_ent.getJointPos(joint number); // never used this before i'm not sure how to get the joint number  :S

emiter = sys.spawn("func_emiter");
emiter.setSpawnArg("model", effect);
emiter.setSpawnArg("start_off", 1); // if you want it to be off at spawn time
emiter.bindToJoint(Monster_ent, "bone_name", 1);   // bindToJoint( entity master , string boneName , float rotateWithMaster )
emiter.setOrigin(jointPos); // don't know if this is needed

// if emiter is off
if (enemySomeAction)
{
    sys.trigger(emiter);
}


Hope this gets you on the right track.   
« Last Edit: April 08, 2017, 10:20:23 AM by argoon »

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 858
  • Karma: +42/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: Lightsaber material in D3
« Reply #17 on: April 08, 2017, 10:11:54 AM »
What blender are you using to export?  I still use 2.49b (I like it, no need to try to convert me to 2.7x.  :) ) & the XReal md5 exporter is the best one I've seen for 2.49b.
Exporters are here: http://idtechforums.fuzzylogicinc.com/index.php?topic=17.0
If there's more I don't have there, post in that thread & I'll add them to the main post.

bitterman

  • Sr. Member
  • ****
  • Posts: 262
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Re: Lightsaber material in D3
« Reply #18 on: April 08, 2017, 11:41:34 AM »
argoon thanks for detailed answer. I will exam it.

I also exported some models before. In fact the question is in "few separated material" (few material decls described in .mtr).

At now it possibly works only if I created two separated mesh with separated materials. Then I select both of them  and export as one model (it's .ase exactly to see in ascii). In this case I have two BITMAP fields and can set two materials in my .mtr. But perhaps this way is not correct.

The Happy Friar - it's 2.6 but I think the concept  (few materials) must be one for any version.
« Last Edit: April 08, 2017, 11:44:02 AM by bitterman »

argoon

  • Sr. Member
  • ****
  • Posts: 275
  • Karma: +21/-81
  • Doom Newbie
    • View Profile
Re: Lightsaber material in D3
« Reply #19 on: April 08, 2017, 02:13:01 PM »
No problem i'm glad to help.

I have done plenty of multi materials on a single model for idtech 4, using lwo of course, i didn't do anything special but just assign different materials to different parts of the model, just selected the faces i want to have a different material and assign a material id to it, if you don't know how to do that i can only recommend you to see some Blender tutorial about that subject.
I have done the same using Blender but just for md5 models, personally only used .ase once.   

bitterman

  • Sr. Member
  • ****
  • Posts: 262
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Re: Lightsaber material in D3
« Reply #20 on: April 09, 2017, 08:08:53 AM »
Perhaps there's no need to bind any emitter to the model.

It is possible to assign any face of this model as particle's emitter - make material for this and set 'deform particle2 myPrtName' in main stage.

See at 'emitter' plane on picture below.

In the game this plane will used to emit specified particles, not to draw it.

It can be used to create very interesting effects.

Not sure about how to test performance.





bitterman

  • Sr. Member
  • ****
  • Posts: 262
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Re: Lightsaber material in D3
« Reply #21 on: April 15, 2017, 12:17:46 PM »
How to make this (glowing trace when blade is moving)?

How it is realised (as base idea)?

Thanks.

argoon

  • Sr. Member
  • ****
  • Posts: 275
  • Karma: +21/-81
  • Doom Newbie
    • View Profile
Re: Lightsaber material in D3
« Reply #22 on: April 15, 2017, 03:20:44 PM »
How to make this (glowing trace when blade is moving)?

How it is realised (as base idea)?

Thanks.

There's a doom 3 mod that uses swords that has that effect i seam to remember seeing it or playing it.

But the general idea is, (don't think this is possible with simple script) for some interval of frames create two vertex's one at the tip of the sword other at the beginning of the sword blade, then using the next two vertex's create a polygonal face, merge many side by side to create a row of faces, representing the movement on space then just assign a material to this surface.

Perhaps the source code for the create line, create circle, etc can be helpful.     

bitterman

  • Sr. Member
  • ****
  • Posts: 262
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Re: Lightsaber material in D3
« Reply #23 on: April 16, 2017, 05:00:30 AM »
Thanks but looks like too complex for me.

I think about additional plane with fade out/scroll image.

*********** upd ******************

Perhaps this is the point:

Code: [Select]
/*
---------------------------------------------------------
void WP_SaberDamageTrace( gentity_t *ent, int saberNum, int bladeNum )

  Constantly trace from the old blade pos to new, down the saber beam and do damage

  FIXME: if the dot product of the old muzzle dir and the new muzzle dir is < 0.75, subdivide it and do multiple traces so we don't flatten out the arc!
---------------------------------------------------------
*/
#define MAX_SABER_SWING_INC 0.33f
void WP_SaberDamageTrace( gentity_t *ent, int saberNum, int bladeNum )
« Last Edit: April 17, 2017, 11:57:10 AM by bitterman »

bitterman

  • Sr. Member
  • ****
  • Posts: 262
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Re: Lightsaber material in D3
« Reply #24 on: April 19, 2017, 11:24:37 AM »
From left to right: particle's trace (anim gif), flickertable, flickertable + particles.
« Last Edit: April 19, 2017, 11:26:51 AM by bitterman »

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 858
  • Karma: +42/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: Lightsaber material in D3
« Reply #25 on: April 19, 2017, 12:24:57 PM »
Very nice looking.  How's it look moving faster?

argoon

  • Sr. Member
  • ****
  • Posts: 275
  • Karma: +21/-81
  • Doom Newbie
    • View Profile
Re: Lightsaber material in D3
« Reply #26 on: April 19, 2017, 12:58:03 PM »
Nice work!

Btw found the mod that i played with similar effect here.

http://www.moddb.com/mods/ruiner 

bitterman

  • Sr. Member
  • ****
  • Posts: 262
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Re: Lightsaber material in D3
« Reply #27 on: April 20, 2017, 09:40:53 AM »
Thanks, guys. I seen video about Ruiner before. Great work, indeed.

Quote
How's it look moving faster?

It's driven by func_pendulum. Don't know how make it moving faster  :-[
« Last Edit: April 20, 2017, 09:42:53 AM by bitterman »

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 858
  • Karma: +42/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: Lightsaber material in D3
« Reply #28 on: April 20, 2017, 12:35:34 PM »
use a func_mover instead.  func_pendulum is depreciated from previous id games, you can do everything with a func_mover AND have more options.  Just change the origin of the object (manually) to the rotation point in the editor.

bitterman

  • Sr. Member
  • ****
  • Posts: 262
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Re: Lightsaber material in D3
« Reply #29 on: April 23, 2017, 11:27:18 AM »
Test))
« Last Edit: April 23, 2017, 11:35:05 AM by bitterman »