Author Topic: Shader and Graphical effects Discussion  (Read 47626 times)

CheeseOnToast

  • Guest
Re: Shader and Graphical effects Discussion
« Reply #60 on: March 26, 2008, 08:48:07 pm »
Thanks a lot, I'll be testing this as soon as possible. My experience with object-space normal maps and animated objects hasn't been very good though. I think that the arms and legs in particular will suffer badly from it, but at least shields, heads etc might look all right.

Hopefully they'll at least add the option for proper tangent-space maps in version 1.0.

Offline mtarini

  • Administrator
  • *****
  • Posts: 1495
  • TLD dev team
    • View Profile
    • (home)
Re: Shader and Graphical effects Discussion
« Reply #61 on: March 26, 2008, 09:14:33 pm »
I think that the arms and legs in particular will suffer badly from it, but at least shields, heads etc might look all right.

Hum, they shouldn't. If they do, there is something wrong (well possible, this stuff is hardly tested).

The shader you want is (or, should be) technique mtarini_Bump_Rig // #126 (again, from my complete list)
(assuming you are not using shininess and stuff: if you are, there are other combinations)

CheeseOnToast

  • Guest
Re: Shader and Graphical effects Discussion
« Reply #62 on: March 29, 2008, 06:35:45 am »
Sorry if I'm being a bit thick here, but do I need to append the shader code you just posted AND the one with the list of techniques to the mb.fx file? And do I just stick it on the end, or does it have to sit inside of one of the existing brackets? And I only need to use the "RIG" shaders on torso/armour sections, or on all parts of a character model? Just trying to save myself some frustration later on :D

Offline mtarini

  • Administrator
  • *****
  • Posts: 1495
  • TLD dev team
    • View Profile
    • (home)
Re: Shader and Graphical effects Discussion
« Reply #63 on: March 29, 2008, 08:25:48 am »
You need to append the core part, (core_mtarini_shaders.ver.0.01.txt) to the mb.fx file, and then only the few shaders you want to use from the list
(you can also put all of the list in, but the game will be very slow to load it because every "technique" shader will pre-complied, even if it is never used by any shader or material).

After that, make a brf file with the corresponding shader (last tab), and use that shader from the material for all affected objects.

But, I just checked something: the normal-map + rigging combination is not currently implemented right in that "core" file (it's only half implemented). Sorry about that. I wonder if that is my last version after all. If I cannot find any more recent version, it shouldn't be difficult to fix anyway, and I could do so soon. But, from what I see, the current version will not work correctly (objects will animate but the normal-map will be relighted as if always was in the neutral pose).

Still, if you can get to the point where your normal maps are ready and used, even if lighting looks wrong for now, then it should work when I fix the shader.

EDIT: I made a quick attempt on-the-fly to fix the problem (with rigging+normalmap), but I don't have time to test it right now, or even to see if it compiles at all. If you feel lucky, its here: core.mtarini.shaders.ver.0.02. (It's the "core" file, to be used instead of the 0.01 one above.) Also, I should optimize it later.



Let me point out another thing about normal-maps + rigging:

- the normal map (in object space) must refer to the object in its neutral pose (i.e. open arms, etc).

- the normals in the normal map of the left half of the object will be automatically inverted in the x component. This is done so that you can use a single normal-map for both sides of a symmetric  object (x = -x simmetry). E.g. the same normal map for the left and the right arm. Hope you see what I mean.

« Last Edit: March 29, 2008, 09:06:35 am by mtarini »

CheeseOnToast

  • Guest
Re: Shader and Graphical effects Discussion
« Reply #64 on: March 29, 2008, 08:35:55 am »
Yup, understood. Will it do this automatically even if the model has no mirrored/overlapped UVs? I'm planning on quite a lot of aysmmetry in the models, so I won't really require the mirrored x component in the normal map.

Offline mtarini

  • Administrator
  • *****
  • Posts: 1495
  • TLD dev team
    • View Profile
    • (home)
Re: Shader and Graphical effects Discussion
« Reply #65 on: March 29, 2008, 09:13:30 am »
Yes, it will. Unfortunately, this means that your normal map will need to be flipped in the X if they are on the left part of the object, even if it is used only there.

If you want to disable this, e.g. for a test, it is sufficient to comment a single line in the shader (by "to comment" I mean to turn a line of code into a comment that will be ignored, by adding a double '/', i.e. a //, at the beginning of the line. Sorry that I'm being so pedantic, just making sure).

The line in question is identified by the text "(mode 2: smooth)" (inside a comment). Look for that line, comment it all, and the "flip X on left parts" will be gone.


PS: mind my edit two posts above.
« Last Edit: March 29, 2008, 09:15:35 am by mtarini »

demize2010

  • Guest
Re: Shader and Graphical effects Discussion
« Reply #66 on: April 04, 2008, 07:46:20 am »
Hey man :)


Cheese has asked me to get these shaders into UDL but I'm having some problems...

If I dropp in the list of techniques the game refuses to launch, claiming that it can't compile the fx file.

The techniques are added after the new shader at the bottom of the text file. If I remove the techniques and keep the shader it all works fine.

I'm guessing that I'm going wrong somewhere, any ideas?


Offline mtarini

  • Administrator
  • *****
  • Posts: 1495
  • TLD dev team
    • View Profile
    • (home)
Re: Shader and Graphical effects Discussion
« Reply #67 on: April 07, 2008, 04:57:11 pm »
Hey man :)

Cheese has asked me to get these shaders into UDL but I'm having some problems...

If I dropp in the list of techniques the game refuses to launch, claiming that it can't compile the fx file.


What version of M&B are you using, and which version of the shader?
If you PM me a clean mb.fx file that does NOT work I could be able to tell.

The techniques are added after the new shader at the bottom of the text file. If I remove the techniques and keep the shader it all works fine.

without the techniques using them the shaders are never actually compiled at all so that's expected.

Scrat

  • Guest
Re: Shader and Graphical effects Discussion
« Reply #68 on: April 12, 2008, 08:40:27 am »
I'm having the same problem demize2010 is having. Anyway I have this small question I'm looking for a shader that is using normal maps from a second texture and the shiny stuff (specular I think) from the first alpha channel (for armors etc) is that something that can be done?

Madawg

  • Guest
Re: Shader and Graphical effects Discussion
« Reply #69 on: January 26, 2009, 05:08:44 pm »
I'm sorry for necroposting but can anyone repost the "core.mtarini.shaders.ver.0.02" file, please?
I came to M&B pretty recently (only a few months ago) and now I'd like to experiment with the normal mapping as well. But I can't find the file.
I've tried the repository not to bother you all for no reason but I couldn't find it. And after a search, it seems this is the only topic where this file is mentionned.
So, again, please excuse me and thanks in advance.