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

Offline Merlkir

  • Administrator
  • *****
  • Posts: 5742
    • View Profile
    • My DeviantArt online Gallery
Re: Shader and Graphical effects Discussion
« Reply #15 on: October 25, 2007, 08:04:19 am »
Merlkir:

Balrog? Exciting! Of course, all kind of gameplay issues come to mind... like, the player should be death as soon as he gets within 2 meters of the thing, and it won't die no matter what you throw at him, neither will it stop. It should be making multiple victims per blow (something we can't really do, I think). What can take a Balrog down? (short of an insanely hi-level "Moria the roguelike game" character, Gandalf - any color, or a blue screen crash of the game?)

Technically, it would be fun to try to render it. However, both for it and the flaming sword, I would feel more confident about the result if we had a "time" variable accessible from the shaders. We will in the future, or so it seems, but we sure don't now.


:D we'll PM Armagan unconscious if he doesn't put it in an update soon :D
The Balrog wouldn't really be a killable "mob". He might be a leader in Moria or I've had some ideas about a quest for the good players to find something in Moria for the dwarves faction, so he might be there as a "boss", but you wouldn't be able to kill him, only run away ;)
Here's my gallery: http://merlkir.deviantart.com/

I'm now painting and drawing commissions. I'll paint portraits, pets, girlfriends, favourite characters..you name it. Send me a PM if interested ;)

Offline mtarini

  • Administrator
  • *****
  • Posts: 1495
  • TLD dev team
    • View Profile
    • (home)
Re: Shader and Graphical effects Discussion
« Reply #16 on: October 25, 2007, 10:05:40 am »
I love the balorg in the moria = minotaour in maze idea. Heaps of problem to solve to get there, but that's challenging.

YOSHI: lovely shark. I am dieing to start experimenting with it BUT I won't be able until next week (if I'm wise, which I wasn't much lately).
Before I go, a last minute thought: it seems too penalizing to have to replicate the texture, one copy for each side, as I discussed in my previous post.

Left/right symmetry is so common in typical models that it might be worth to account for that in the shader.
I will see what effect we get if I make the shader so that the X component of the normal from the map is inverted for all X<0 parts of the mesh.
Will work only for symmetrical objects, but will save half the texture for these objects. I'm afraid that we might experience artifacts along the symmetry plane (due to variuous reasons). We will see.

This just to tell you: don't bother to re-parametrize (remake the UV mapping)  the thing before I try it out and see if that works.



Yoshiboy

  • Guest
Re: Shader and Graphical effects Discussion
« Reply #17 on: October 26, 2007, 04:14:30 am »
Ok. This is good news. From the limited experience with model space normal maps I thought they were faster to render but wouldn't react with the light changes. Now the issue for me will be generating them. The one I posted below is from Zbrush's normal map tools - I don't know a way of using Crazybump or adobe to generate them but I'll look around on the internet, there might well be a program which can convert it or I might be able to play around with Zbrush and adobe to get the desired effect.

The issue you outlined for reflected normal being incorrect is actually true for tangent space normal maps too. If you think about it to get the UVs to line up you have to flip one piece horizontally. Which inverts the bump for the tangent space normal maps too. For things like this shark (and other game models), most of the time it isn't that noticeable. You only shouldn't really do it with character models where it can be much more significant. We'll see how that goes, but if you are writing the shader to compensate for it that is brilliant!
Quote
Are you saying that they work in some form already?

As for the tangent space normal maps, are armagan's green normal maps not tangent space? I know they ignore the blue channel, and I don't how how the shader works for them, but if you look at the tangent space normal maps we have, the blue channel is nearly all white anyway, fill it white and the difference in effect is minimal as far as input from the texture (again I don't know how he renders them)

Offline mtarini

  • Administrator
  • *****
  • Posts: 1495
  • TLD dev team
    • View Profile
    • (home)
Re: Shader and Graphical effects Discussion
« Reply #18 on: October 27, 2007, 04:13:00 pm »
I don't know a way of using Crazybump or adobe to generate them but I'll look around on the internet, there might well be a program which can convert it or I might be able to play around with Zbrush and adobe to get the desired effect.

good. If you don't find anything, tell me. I might write an ad hoc tool that does just that.

The issue you outlined for reflected normal being incorrect is actually true for tangent space normal maps too. If you think about it to get the UVs to line up you have to flip one piece horizontally. Which inverts the bump for the tangent space normal maps too.

Not that it is important, but, for the sake of the argument: not so. The tangent space can be automatically defined to compensate for the error you mention (see the tech note). Anyway, I will try to correct the normal map automatically in the shader (flipping the required component for the half of the mesh that reuses the normalmap). I expect the error, if left there, to be visible, because a engraving would look like an embossing.

(tech note: to render a tangent space normal map, one needs to have a tangent space defined at each vertex and interpolated across triangles. Tangent spaces are defined by three vectors, which are called normal, tangent and binormal. The "normal" is just a common normal, orthogonal to the surface. The other two are parallel to the surface instead and, just like normals, are usually computed per face and averaged at vertices. They are computed per face by computing the inverse of the affine mapping defined by the u,v coordinates. Sounds difficult but it is not. When you compute them for a "flipped" face, like those from the "other" side, you just invert one of them and you get the correct result even tough the normal map is actually flipped, as you noticed. The problem with M&B is that these two extra vectors, the "binormal" and the "tangent" ones, are not computed, or at least they are not sent as vertex attributes as far as I can tell. Shaders alone cannot help it because that data must be computed globally for the mesh (it is like the normals: I can just use what the shader is sent, I cannot compute a normal in the shader in the general case). On the contrary, model space normal map don't use any of that, and even ignore the normal: the acutal normal is substituted with whatever is read form the normal map for each pixel -- and twisted rotated according to current viewpoint, skeleton animation, etc.)


As for the tangent space normal maps, are armagan's green normal maps not tangent space?

What is this green normal map thing? I do I activate it? Which model is using it and which shaders activates it?
I see poeple talking about it but did not find anything in the game or in the models myself.
« Last Edit: October 27, 2007, 04:16:20 pm by mtarini »

Offline Ursca

  • Deus Vult Dev
  • *****
  • Posts: 128
    • View Profile
Re: Shader and Graphical effects Discussion
« Reply #19 on: October 27, 2007, 04:17:55 pm »
Both native normal map shaders use them, bump_static and bump_interior.
Have a look at 'stone_wall_2_height' or any of the textures with 'height' at the end.
« Last Edit: October 27, 2007, 04:19:49 pm by Ursca »

Offline mtarini

  • Administrator
  • *****
  • Posts: 1495
  • TLD dev team
    • View Profile
    • (home)
Re: Shader and Graphical effects Discussion
« Reply #20 on: October 27, 2007, 04:29:53 pm »
Thanks. I'll give a look next week.

Offline Merlkir

  • Administrator
  • *****
  • Posts: 5742
    • View Profile
    • My DeviantArt online Gallery
Re: Shader and Graphical effects Discussion
« Reply #21 on: November 05, 2007, 01:38:57 am »
Another thought of shader use. It was brought up in a TW thread (Broken Realm):
- could we use the vertext waving shader for ship sails? It'd be nice to have the sails wave a bit :)
(ship combat in TLD...aaaahh.... :))
Here's my gallery: http://merlkir.deviantart.com/

I'm now painting and drawing commissions. I'll paint portraits, pets, girlfriends, favourite characters..you name it. Send me a PM if interested ;)

Offline Ron Losey

  • Master
  • *****
  • Posts: 4418
    • View Profile
Re: Shader and Graphical effects Discussion
« Reply #22 on: November 05, 2007, 01:47:09 am »
Another thought of shader use. It was brought up in a TW thread (Broken Realm):
- could we use the vertext waving shader for ship sails? It'd be nice to have the sails wave a bit :)
(ship combat in TLD...aaaahh.... :))

Ship combat in all the major mods ... possibly very soon, since it looks like "Pirates of Calradia" ship combat code is about to appear in mods everywhere.

bryce

  • Guest
Re: Shader and Graphical effects Discussion
« Reply #23 on: November 07, 2007, 04:05:38 pm »
Ok, here is a question - does the performance become worse the more detailed the normal map is?

Offline Ron Losey

  • Master
  • *****
  • Posts: 4418
    • View Profile
Re: Shader and Graphical effects Discussion
« Reply #24 on: November 07, 2007, 05:56:30 pm »
Ok, here is a question - does the performance become worse the more detailed the normal map is?

The resolution of texture maps (Normal map, RGB, whatever) will somewhat effect performance ... yes.  Pretty much anything that increases the size of the texture files is going to show.  How much would depend on your exact specs - some equipment can handle more of that sort of thing than others. 

bryce

  • Guest
Re: Shader and Graphical effects Discussion
« Reply #25 on: November 08, 2007, 01:26:18 am »
Ok, here is a question - does the performance become worse the more detailed the normal map is?

The resolution of texture maps (Normal map, RGB, whatever) will somewhat effect performance ... yes.  Pretty much anything that increases the size of the texture files is going to show.  How much would depend on your exact specs - some equipment can handle more of that sort of thing than others. 


So if the size changes the performance hit increases. That makes sense. But, if I have one normal map that is very detailed and one that is not, of the same resolution, does it matter? I am guessing not, but wanted to make sure....

Offline Merlkir

  • Administrator
  • *****
  • Posts: 5742
    • View Profile
    • My DeviantArt online Gallery
Re: Shader and Graphical effects Discussion
« Reply #26 on: November 08, 2007, 01:52:25 am »
they will be the same in the matter of performance, because the amount of bits they represent as a bitmap is the same. IMHO.
« Last Edit: November 08, 2007, 04:30:09 am by Merlkir »
Here's my gallery: http://merlkir.deviantart.com/

I'm now painting and drawing commissions. I'll paint portraits, pets, girlfriends, favourite characters..you name it. Send me a PM if interested ;)

Offline Ron Losey

  • Master
  • *****
  • Posts: 4418
    • View Profile
Re: Shader and Graphical effects Discussion
« Reply #27 on: November 08, 2007, 02:04:05 am »
Ok, here is a question - does the performance become worse the more detailed the normal map is?

The resolution of texture maps (Normal map, RGB, whatever) will somewhat effect performance ... yes.  Pretty much anything that increases the size of the texture files is going to show.  How much would depend on your exact specs - some equipment can handle more of that sort of thing than others. 


So if the size changes the performance hit increases. That makes sense. But, if I have one normal map that is very detailed and one that is not, of the same resolution, does it matter? I am guessing not, but wanted to make sure....

.dds is a compressed format.  More detailed maps can't be compressed as much, and therefore will be larger files (unless you're willing to take the hit to image quality to compress them more - but then it wouldn't be a more detailed map any more).  It's not "resolution" that's killing you, it's the physical size of the texture file in memory.  Changing resolution is the fastest way to change this, but not the only factor ... something extremely complex and hard to compress will also increase the final file size.  Not compressing a file as much as you could - that would also leave it larger than necessary.

Now, how much difference it makes ... depends on how much of this stuff you're in.  If you are talking about something with hundreds of texture files, all of rather large sizes, then it's probably time to be cutting a few corners.  If one DDS file covers several of your items, you get a break.

(Mesoamerica Mod has almost all of the textures for the entire mod on one big DDS file ... the file size is huge, but there's only one of them, and it runs very smooth.)

And, of course, some software does a better job of compressing stuff and/or preserving image quality than others.  True in the basic colors, and true in alpha channel or normal map.

Just a matter of total bytes of data that has to be held in memory.  Just check the file sizes to see how much difference you're talking about.

Offline Merlkir

  • Administrator
  • *****
  • Posts: 5742
    • View Profile
    • My DeviantArt online Gallery
Re: Shader and Graphical effects Discussion
« Reply #28 on: November 08, 2007, 02:11:49 am »
dds is not always compressed, but yeah, the main idea is right. If you have a blank/black dds, normal texture of the same size will probably have more kB...
Here's my gallery: http://merlkir.deviantart.com/

I'm now painting and drawing commissions. I'll paint portraits, pets, girlfriends, favourite characters..you name it. Send me a PM if interested ;)

bryce

  • Guest
Re: Shader and Graphical effects Discussion
« Reply #29 on: November 08, 2007, 03:29:55 am »
The memory size should not matter. It's the transformations that cause performance bottlenecks.

I am prettys ure the answer is 'no' - that whatever the transformation is it's still a transformation, but I could not find the EXACT details of what the hardware does....

The resolution would make it slower because it's doing more operations.