Malkior

Emitter changes with MDLEdit

Recommended Posts

Due to recent discussions, I have decided to start up a new pseudo-project thread to hopefully realize the capabilities of MDLEdit and finally create a mod I've been wanting for a long while.

 

In this particular project, I'd like to discover all that MDLEdit can do with Emitters.

 

My personal level of expertise is more or less novice level (I just now learned what nodes are in a 3d model file), so I may take a bit to pick up on some subjects.

 

 

So, to get the ball rolling, I want to change the spawn rate and possibly vary the dispersal of rain droplet effects in TSL. Additionally, I would like to change the size and if possible the number of sprites in smoke and fire. (Both of these would be for TSL for the time being.)

 

Firstly, which files will I need to crack open in order to do this? Is there a method or format I need to use? (Like converting them to binary for example)

Share this post


Link to post
Share on other sites

Firstly, which files will I need to crack open in order to do this? Is there a method or format I need to use? (Like converting them to binary for example)

 

You need to find the model files (.mdl and .mdx) for the effects, as well as the textures they use. You can get the texture names by opening the model file in MDLedit. Then you can either edit the values directly in MDLedit or decompile the model, then edit the parameters with a text file or with Kotormax if you want. Kotormax has some logic in place that prevents you from choosing nonsensical parameters, but then again, we know very little about how exactly the parameters work, so it would be great if we try out all possibilites.

 

Read the visual effects section of this pdf to get an introduction into emitters:

https://neverwintervault.org/project/nwn1/other/custom-content-guide-v30

 

Also, here are some tests I did with emitter flags:

Edited by bead-v

Share this post


Link to post
Share on other sites

I want to change the spawn rate and possibly vary the dispersal of rain droplet effects in TSL.

 

Rain is probably a shader, not a particle effect.

 

The rain does use particles, but I'm not sure if you can edit them. As far as I can tell, the weather system is generated from an emitter that follows the camera, a 10 meter cube or something like that. Presumably the game uses some sort of model for this, but you'd have to figure out what it is.

 

It's easy enough to create rain with the fountain emitter, though, and it's even possible to have rain (or snow or whatever) in the first game.

Share this post


Link to post
Share on other sites

Hrm, so it is. I always thought that, given it was set in the ARE, it was just a shader. But I can see the models for it, fx_Rain in the case of rain. Looks to be a simple fountain emitter covering a 6m x 6m area. Oddly, it's positioned at 4m under world zero, not sure what that is about.

 

I wonder how the placement/activation for it works? I can't see anything obvious. Hardcoded maybe? Scripted? You'd surely want to be able to toggle the effect off and on to account for indoor/under cover areas.

Share this post


Link to post
Share on other sites

I wonder how the placement/activation for it works? I can't see anything obvious. Hardcoded maybe? Scripted?

I'm guessing the game renders it and attaches it to the camera if the flags in the ARE are set... otherwise it doesn't. I don't recall any script functions that would turn it on or off, and I also don't recall needing any specific OnEnter script for it to work. I've known weather to work in 231, 301, 506, 601, and 605. So it would be hard coded if anything.

 

I know The Witcher has randomly-generated weather, and I believe this already supported by the engine and not anything they specifically cooked up for The Witcher. So whatever it is, it does seem to be something that can be triggered on and off... although I don't know if it works in KOTOR.

 

You'd surely want to be able to toggle the effect off and on to account for indoor/under cover areas.

Each room in the ARE has a flag to allow weather, though I don't know how this works. I remember assisting someone in editing this before without any luck - rain would show up everywhere or nowhere.

 

The game definitely doesn't have this problem for modules that are already set up for rain, however.

Share this post


Link to post
Share on other sites

It's me again. Long time, eh?

 

I finally have the rain model open in MDLEdit and ready for testing its settings, but I am unsure of how I would do so.

Do I inject the MDL into the Module file, or is the Override a better bet? Alternatively, is there a totally different far more efficient method for testing that I haven't thought of?

 

I am also planning to change the campfire, lightning, and explosion sprites if I can. ;)

 

Time is obviously much harder for me to come by these days, so I won't be able to reply and/or test this every single day of the week. (having to focus on work has been challenging to continue on what is essentially a hobby) However, I hope to eventually have something to show for all of this you've helped me with.

Share this post


Link to post
Share on other sites

You can put the compiled MDL (and MDX) in the Override.

You don't even have to restart the game to load an updated model if you replace it while the game is running. All you need to do is to reload a savegame.

Share this post


Link to post
Share on other sites

Alright. I have another question, if that's okay.

 

I'm not entirely versed in the MDLEdit interface. Do I change the Emitter settings by changing the Controller Data (Data 0:, Data 1:, Data 2:, etc..)

 

image.png 

, or do I change each individual parameter (Value count, Timekey Start, etc..)

 

image.png

 or are those supposed to be those values?

Share this post


Link to post
Share on other sites

Thanks so much for the help!

 

Here are some fruits of my labor.

 

image.png

image.png

image.png

 

 

image.png

 

image.png

 

image.png

image.png

image.png

 

Again thank you so much for the help without which none of this would have been possible. :cheers:

 

 

 

  • Like 2

Share this post


Link to post
Share on other sites
13 minutes ago, Malkior said:

Here are some fruits of my labor.

  Hide contents

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

 

Again thank you so much for the help without which none of this would have been possible. :cheers:

Awesome! It's reddish tone blends really well with the game; particularly with the HK scene. :cheers:

Edited by ebmar
  • Thanks 1

Share this post


Link to post
Share on other sites

If I may be so bold, I must ask for you guys' assistance yet again.

(Fun fact, "Guy" literally refers to Guy Fawkes and can be used for either sex; technically it just means "Peculiar people" which has been used with both good and bad connotations #themoreyouknow

:P )

Anyway, I've been trying with little to no success to edit the lightning effect so that the spokes are wider or at least differently arranged. Is there some model that I'm missing which controls how the Lightning spell effect looks?

Secondly, I really want to change how the grass behaves and/or how close-up the texture on the grass floor looks in-game. Is there a model or config file that would allow me to alter it?

 

Again, thank you so much for your help thusfar. :)

Share this post


Link to post
Share on other sites

Both your issues are texture-based.

I think there have been a couple of Force Lightning retextures. I'd track them down and have a look at what they did for pointers.

Grass varies depending on what module you are talking about. K1 Dantooine has like half a dozen grass textures as I recall.

Share this post


Link to post
Share on other sites
1 hour ago, DarthParametric said:

Both your issues are texture-based.

And to be noticed about these differences seems to be important, particularly with FX_Lightning:

  • K1 uses no TXI semantic and alpha channel to the texture
  • While TSL uses "blending additive" on its TXI, along with alpha along the black part of the texture

TSL also implying the same method to their FX_laser_xx which K1 are don't. 🤔

Edited by ebmar

Share this post


Link to post
Share on other sites

Update:

 

Okay, so I found out the reason I couldn't locate the lightning emitter... Turns out that "Omen Emitters" are just that; they control the lightning that comes out of your hands during the animation. Sorry about that, it seems the solution was right in front of me the whole time.. 😐

 

image.png image.png image.png image.png  

A tad sloppy, but it seems I'm not quite skilled with quaternions yet. (I'm using a calculator online to convert them to and from Euler coordinates)

Thanks Ebmar and Darth Parametric for the info on the lightning texture; I have since made my own version (Which is more or less the same as the one in these screenshots), but it's always good to see what others have been able to do.

 

The grass will be another issue entirely. I'm hoping there's some master MDL file hiding in the game assets (As it seems the animation had to come from *somewhere*) but it's also possible that the modelers just kept the slices of grassy area and incorporated them into the area MDL (Which would be next to impossible to find), so I'm going to focus on recreating the grass texture as I had previously albeit hopefully a bit cleaner than my first attempts. 

I guess in the meantime I will plug away at changing the textures, and if I find more models or anyone has any info on what they're called (Or how the heck to effectively use quaternions), that can be posted here. 

 

Again, thanks so much for the help, folks. :)

  • Like 1

Share this post


Link to post
Share on other sites
On 12/1/2018 at 11:10 PM, Malkior said:

Secondly, I really want to change how the grass behaves and/or how close-up the texture on the grass floor looks in-game. Is there a model or config file that would allow me to alter it?

There are two things at play here. The first is the grass texture file, which you can edit like any other texture, and that is determined by the module's ARE file as Grass_TexName. In addition to the texture name, the ARE file configures everything else about the grass. The two other settings of interest are the Grass_QuadSize and Grass_Density.

The quad size determines how big the grass is. The "quad" in question is essentially a single instance of the texture. Each blade of grass is a rectangular plane with the grass texture drawn on each side. So the quad size is just how big those rectangles are. Increasing the quad size can produce giant corn field-sized stalks of grass.

The density determines how spread out the grass is over a surface. It's something like how many quads per square meter, though I'm only guessing with the units. So a higher density means thicker grass, more rectangles closer together.

The game distributes the grass quads semi-randomly over any walkmesh that has the grass material on it. There are other settings in the ARE file for affecting that probability, but I'm not entirely sure how they work and I doubt it's worth messing with them.

Share this post


Link to post
Share on other sites

The grass plane textures are actually 4 textures in one. The probabilities determine the percentages of each quadrant that are spawned (upper left, lower left, upper right, lower right).

Dantooine_Grass_Plane_Diffuse.jpg          Dantooine_Grass_Plane_Alpha.jpg

You may find it easier to create the diffuse and alpha mask for each separately, then bring them together in a single image.

Share this post


Link to post
Share on other sites

Oh, that makes more sense than what I was thinking. And it's obvious considering what the textures look like, but it's been a while since I did look at them.

So you could get some interesting results by adjusting the probabilities too. Like in the example above, two of the tiles have some pink flowers, and I would guess they're given lower probabilities than the other two.

Share this post


Link to post
Share on other sites

I feel like a novice asking this, but do I have to inject the ARE file into the MOD file?

Also, I went a little ham with the rain effect and I was wondering, can you add another ambient sound effect (I want to add the sound of pouring rain to the background audio) in addition to the constant thunder to the ARE, or is there a better way to do that?

Share this post


Link to post
Share on other sites
2 hours ago, Malkior said:

do I have to inject the ARE file into the MOD file?

Yes. At least if you want to make a public release.

2 hours ago, Malkior said:

can you add another ambient sound effect

I may be mistaken, but I believe you can only specify a single ambient sound track.

However, similar to what @ebmar asked about in a recent thread, you could probably use scripting to get around this. In fact given your comment about thunder, you may be better switching them so that the rain is the default track and the thunder is one you script to play at various instances. You could also potentially harness the same scripting to play a room animation that adds some lightning VFX.

  • Like 1
  • Light Side Points 1

Share this post


Link to post
Share on other sites
On 12/17/2018 at 12:03 PM, DarthParametric said:

...given your comment about thunder, you may be better switching them so that the rain is the default track and the thunder is one you script to play at various instances.

As a friendly reminder and an addition to DP's awesome idea; SFX's wise- it is important also to export the audio to 22050 Hz's WAV [props to @JCarter426 for the insight!]. Either Mono or Stereo will work as long as they are using the aforementioned sample-rate. 🤔

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.