Jump to content

Possible to recolorize fen fires?


Lindor

Recommended Posts

Sometimes surfaces aren't applied in itemtype.txt. I assume in these cases they're directly applied in the .GR2 model file. Is it possible to untie them and apply my own surfaces if I don't have access to 3ds max? Just editing the images is not an option because I want to keep the original and create a duplicate but with another surface. I'm not fearing hex editing if required, but I'm fearing too heavy reverse engineering (which I know is the hard part). I'd rather know what to look for.:gogo:

Edited by Lindor
Link to comment

Each GR2 file has materials assigned to it that are named after the corresponding surface entries. 

To accomplish your goal you need only make a new surface entry, name it whatever you like, and list out the textures that compose it.

Next, you edit the itemtype in question (or create a new itemtype if you want the original one intact), and then assign your new surface entry to the model.  To demonstrate this we will look at an example:

      name         = "models/npc/wildanimals/bear/v_baer-v1@crystal.GR2", -- the base model
      surface0     = { mgr.surfGetID ("baer-v1_v"), mgr.surfGetID ("baer-v1-crystal-v2_v") }, -- the first listed surface entry ("baer-v1_v") is the one the model expects to find based on its materials. The second entry in this line ("baer-v1-crystal-v2_v") is the new one that overrides the base surface.
      surface1     = { mgr.surfGetID ("crystal_z"), mgr.surfGetID ("crystal-v2_z") }, -- the same process repeats as before, for as many surface entries as the original model expects.

 

If you can't figure out which surface entries the base model expects, you can quickly view the mesh's assigned materials with Granny Viewer. 

  • Appreciation 1
Link to comment
  • 1 month later...

@Flix@dimitrius154

Coming back to this topic, I want multiple Fen Fires aka Will-o-wisps with different colors. Despite me having access to a full pak directory scan I couldn't find any textures for it and also the itemtype in question, 11016, has no surfaces tied to it. So can you help me? Does the will-o-wisp model even have any surfaces? If yes, can you give me the file name and directory, please?

Sorry for the ping, I wanted to increase my chances for a quick answer because I want to be finished with this by the end of the weekend and my mod still has a lot of other things needing my attention. So this part of the project will be moved into the future if there is no solution this weekend.

EDIT: oh wait, I see you already answered that with the granny viewer thing. I've overseen/forgotten that. Gonna try that out and thx again!

Edited by Lindor
Link to comment
52 minutes ago, Lindor said:

Gonna try that out and thx again!

Uhm...

On 10/5/2020 at 8:39 AM, Lindor said:

(...)

in grannyviewer but for any Sacred2 .gr2 files it says it failed the crc check.  I know how a crc check works and my guess is that the Sacred2 .gr2 files are somehow compressed or encrypted so that the generator polynomial is altered.

(...)

EDIT:

I found a xentax thread where somebody explained where the crc is in a .gr2 file: https://forum.xentax.com/viewtopic.php?t=7705

Now for the inquisitors model the first couple of bytes look like this:

  Reveal hidden contents

29 DE 6C C0 BA A4 53 2B 25 F5 B7 A5 F6 66 E2 EE

C8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00

07 00 00 00 B0 3C 03 00 70 BB 08 7C

Now if the thread's correct 70 BB 08 7C is the crc. I took the standard ethernet generator polynomial (100000100110000010001110110110111) and tried to work our the remainder in hexadecimal. I got f1ca586. So I altered the file  the following:

  Reveal hidden contents

29 DE 6C C0 BA A4 53 2B 25 F5 B7 A5 F6 66 E2 EE

C8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00

07 00 00 00 B0 3C 03 00 0F 1C A5 86

And tried to open the altered file with grannyviewer. Didn't work. Now either I miscalculated, the information on the thread was wrong or GrannyViewer uses a different generator polynomial. Therefore may I ask wether somebody knows the crcs grannyviewer accepts and tell me? I really need some help here.:sweating:

Happened again. Willowisp model fails crc check. Na way to view in granny viewer. Same for any other model in graphics12/models/npc/monsters I tried so far.

Link to comment
2 hours ago, Lindor said:

Does the will-o-wisp model even have any surfaces?

It's a dummy model.  Fen Fires are pure FX as far as I can tell, no mesh, surfaces or textures to speak of. I tried desperately to change them to red for D2F and never succeeded.

I believe the only way to change the color would be to track down the correct blue color file in either hq\fx\gradients or perhaps one of the generic colors in hq\fx\symbols.

Alternative theory:  fx_wispblips.particle and fx_wispstar.particle might help but I suspect they would alter some of the tiny particles but not the main "body" of the wisp.  I have not tested these yet because back in the day I didn't know about those scripts.  So maybe changing the hex color values in those scripts would help.  Let me know if so and I'll finally have my Heart of the Wolverine for D2F.

 

  • Thanks! 1
Link to comment
13 hours ago, Flix said:

It's a dummy model.  Fen Fires are pure FX as far as I can tell, no mesh, surfaces or textures to speak of. I tried desperately to change them to red for D2F and never succeeded.

I believe the only way to change the color would be to track down the correct blue color file in either hq\fx\gradients or perhaps one of the generic colors in hq\fx\symbols.

Alternative theory:  fx_wispblips.particle and fx_wispstar.particle might help but I suspect they would alter some of the tiny particles but not the main "body" of the wisp.  I have not tested these yet because back in the day I didn't know about those scripts.  So maybe changing the hex color values in those scripts would help.  Let me know if so and I'll finally have my Heart of the Wolverine for D2F.

 

Yeah sure I will keep you informed but the whole point was to have multiple differently colorized fen fires at the same time. Seems like that's not so easily done, so this part is sadly gonna procrastinated for now. The best hope I have rn is if it really depends on the particle scripts and when I ever learn how to manipulate the dlls, maybe I can make it accept new particle scripts. Like the same thing itemtype.txt does for model surfaces I want for particle scripts. But that is smth for future me to worry about.

Thx for the info. Just one more thing: How did you bypass the crc check issue? I have a suspicion that there's some sort of encryption going on with ~90% of vanilla models which is why the crc check fails. Pesmontis must've been able to crack that encryption for his grnreader, so is it possible to decrypt the models without exporting them as smd/fbx/ms? Or am I touching legality issues here?

Link to comment
1 hour ago, Lindor said:

Just one more thing: How did you bypass the crc check issue?

Just to be clear, are we talking about an error with Granny Viewer? I've never had such a problem when opening any Sacred 2 files.  It's an indispensable tool for viewing surfaces and animations so I can see why you'd be frustrated.  I use version 2.8.45.0 that I'm fairly certain I grabbed from here.

Link to comment
58 minutes ago, Flix said:

Just to be clear, are we talking about an error with Granny Viewer? I've never had such a problem when opening any Sacred 2 files.  It's an indispensable tool for viewing surfaces and animations so I can see why you'd be frustrated.  I use version 2.8.45.0 that I'm fairly certain I grabbed from here.

Yep, granny viewer. 2.2.0.4 for me, that was the issue. It works with your version of granny viewer. I don't know how many times I've said it: Thx again!

Btwi'm not the only one who had that issue:

On 3/20/2019 at 6:08 PM, Sethi22 said:

"CRC check failed" thing.

Seems like both Sacred 1 and 2 have that issue. Sethi22, now you know :)

Edited by Lindor
Link to comment
13 hours ago, Flix said:

I sort of came up with a workaround, but it requires a model with an FX attached like we discussed earlier.  This creature was originally a will-o-wisp but I replaced it with a modified floating skull.  The skull had a fireball casting FX tied to it (courtesy Dmitriy).  I then made all the textures transparent and set the surface flags to "masked."  This turned everything invisible except the FX.

The result isn't quite the same as a red will-o-wisp, but an improvement on my Heart of Wolverine.

2Gr6VQw.jpg

Interesting and very creative! As you said, not quite the same as having a true recolorized fen fire, but the benefit is that it can exist parallel to the normal fen fires which is what I'm looking for. Only wish it was a little bit more transparent.

Congratz on the success!

Link to comment

@FlixSometimes when I speak too much English I forget that I'm German lol:lol:

Willowisps/Fen Fires are "Irrlichter" in German.

There exists fx_irrlicht.particle and fx_irrlicht2.particle. If Fen Fires are recolorizable, then there I'd bet!

Edited by Lindor
  • Haha 1
Link to comment

All the German I know, I learned from the Sacred 2 files.  :3lmao:

There is an hq\fx\irrlicht.jpg file but it doesn't seem to do anything - tried recoloring/replacing a while back, no result.

So, I hope those scripts work!

  • Like! 1
Link to comment

I've had a new idea: Since I'm tossing with shaders in surface.txt atm and found out that it's possible to script your own shaders, I thought about messing with the pak/shader files. You can open them with Notepad++, looks like they're scripted in C, not a language I can speak so I want to learn at least the basics. Most probably it's possible to edit some FX which were previously thought to be uneditable.

There also exist two instances of irrlicht.shader and irrlicht2.shader, two in conole/fx and two in unified/fx. It may be worth a look, maybe it offers additional functionality over the particle scripts.

Link to comment

@Flix I've successfully created two surfaces in surface.txt using irrlicht.shader (torso) and irrlicht2.shader (shoulders):

EvZoMcx.jpeg

I gave it SURFACE_FLAG_TRANSPARENT, maybe that's why it's only visible from a specific angle. For texture0Name-texture2Name I used fx/blue.tga. The shader looks like this:

IRRLICHT = {
  diffusePnt    = "null.shader",
  diffusePntShd = "null.shader",
  z             = "null.shader",
  shadowmap     = "null.shader",
  cubeshadowmap = "null.shader",
  ambDiff       = "fx/irrlicht.shader",
}

Same for irrlicht2.shader.

I want to experiment more, maybe it even accepts texture3Name, also I wonder why there are no particles visible, maybe they're coming from different FX. But generally speaking, this shader thing I'm playing around with seems to open lots and lots of new possibilities. It might be possible to recreate Fen Fires and even recololorize them in the future, if only I could work with models. Well, maybe I'm able to abuse a pumpkin model for it. But first the particle issue.

  • Like! 1
Link to comment
  • 1 month later...

@Flix irrlicht.shader and irrlicht2.shader don't seem to have any effect on fen fires.

Or in general anywhere in the game. You can even erase those files without seeing any ingame effect (yet). They're in the folder for spell FX anyway and not for object FX (not saying that the devs sorted everything correctly, but it's a hint.) Also I've tested for any kind of FX_IRRLICHT spell FX now multiple times, I don't think it exists.

Also those shaders seem to be all kinds of broken, e.g. the shaders expect 5 (!) diferent textures: texture0-2 and texture4-5, but it doesn't expect a texture3 somehow. Their alpha channel gets multiplied by param.x, and param is a set of up to four optional hardcoded shader parameters, e.g. for the fur param.x is hardcoded-linked to the amount of layers of the volume map to give the amount of shells per hair. That might explain why one shader is invisibe from one side and the other one completely.

All in all those two shaders (and probably their two particle script counterparts as well) seem to be leftovers to me.

I couldn't find any other shader yet which might be influencing the fen fires' visuals. So it has become a guessing game again.

Link to comment

Seems like there's all kinds of untapped potential with modifying shaders.  :thumbsup:

Probably the particle files are used for the little sparkles.  Pretty sure I was able to change those colors at one point.  But as for the "body" of the Fen Fires, I just can't say for sure.  The dummy model used probably has an FX attached, but I can't see what it might be with just granny viewer. I'd need to import it into 3DSMax and it's been many moons since I had that installed on my system.

  • Like! 1
Link to comment
17 hours ago, Flix said:

Seems like there's all kinds of untapped potential with modifying shaders.  :thumbsup:

Oh yeah, you definitely should read about my latest two discoveries, Layered Shaders and Skyboxing!

17 hours ago, Flix said:

The dummy model used probably has an FX attached, but I can't see what it might be with just granny viewer. I'd need to import it into 3DSMax and it's been many moons since I had that installed on my system.

If you managed to figure it out like that, that'd be amazing!

Link to comment
  • 3 weeks later...

@Flix just from the visuals it might be FX_GEN_UNSICHTBAR, maybe try toying with that.

EDIT: Forget it. I found it! It's definitely FX_IRRLICHT:

5w2JAIQ.jpeg

I have no idea why it didn't work when I recolorized the shader (or even deleted it), but it's definitely FX_IRRLICHT!

 

Now if only it would be possible to decipher how shader.ini works so maybe it would be possible to figure out which textures are tied to the shader. Well, need to ask the lord of code himself: @dimitrius154

Edited by Lindor
Link to comment
  • The title was changed to Possible to recolorize fen fires?
1 hour ago, Lindor said:

Well, need to ask the lord of code himself

Reminds me of a quote from a certain movie: "Vanity.... is definitely my favourite sin.":lol: So, looks like, the one texture of interest is the "fx/irrlicht.jpg", located in graphics01.zip.

  • Thanks! 1
Link to comment
17 hours ago, dimitrius154 said:

Reminds me of a quote from a certain movie: "Vanity.... is definitely my favourite sin.":lol: So, looks like, the one texture of interest is the "fx/irrlicht.jpg", located in graphics01.zip.

Excellent! Now one question remains: How to have multiple differently colorized fen fires in the same game at the same time? You can't swap the texture since there's no surface.txt entry?

Link to comment
3 hours ago, Lindor said:

How to have multiple differently colorized fen fires in the same game at the same time? You can't swap the texture since there's no surface.txt entry?

Fen fire model file is used as an anchor for the "fx_irrlicht" VFX. The texture in question is addressed by a common s2render.dll procedure during rendering. That means, that, even with some extra procedure branching allowing for random texture selection, the end result would be fen fires changing their color every few moments.

  • Thanks! 1
Link to comment

Ah well, if the texture addressing is neither part of the model nor part of the shader, then there's nothing I can do anyway. But if even you can't do it from inside S2render.dll, then it's impossible. Guess I'm gonna go with Flix' workaround then, but for that I'd need to be able to export .gr2 models which I can't do.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...
Please Sign In or Sign Up