forums | blogs | polls | tutorials | downloads | rules | help

Shiny sword in DS2? (how to use shaders)

Sharkull's picture

In the demo movie clip for DS2 (the long one narrated by Chris Taylor) I remember there being two special swords... one of which had a reflective appearance (shaders?). Having played the game now, I can't say I've seen anything "shiny" in the game other than water. :?

Has anyone seen a shiny sword (or any reflective surface other than water) in DS2?

LoneKnight's picture

No. Probably was an earlier version that our dumb friend Chris Taylor was playing on. Can't tell for sure, but for some reason or another, it must have been removed.

Strider978's picture

LoneKnight wrote:
dumb friend Chris Taylor

While they may not be registered on the board I would still appreciate if you do not demean GPG or its employees. I would have felt offense if you had spoken to me in that manner, and I again would appreciate it if we kept our feelings on the level of intelligence of GPG employees/founders to ourselves.

Looking at shaders and textures I do not see any indications of a shiny sword. Maybe they had planned more use of shaders in the past but realized it didn't fit the game's performance budget(just a guess).

Sharkull's picture

Wyvante wrote:
Maybe they had planned more use of shaders in the past but realized it didn't fit the game's performance budget(just a guess).

That's what I was thinking too... Stare

BTW, there is another reflective surface example... the roof nodes for Incantation Shrines.

I found this comment in glow.fx

/*************************************************************************************
**
**		Glow.fx
**
**		Glow Effect:
**		The glow effect is achived by rendering textype objects into a low resolution texture map. Then
**		that texture map is drawn into another texture blurred horizontally, then back again vertically.
**		Once all the in game 3d rendering is complete the blurred "glow" texture is drawn over the backbuffer.
**
**
**		Strengths:
**		- We could have glowing weapons ( or glowing weapon trails ) in a way that is more convincing. ( think tron, or starwars )
**		- We could animate the alpha channel to cause animated glowing effects.
**		- We could add a suttle glow to plate armor to make it look "shiny".
**		- We could add a glow to the sun, sunset light could blur/leak out just like a sunset does in real life.
**      - We could have water have little specs of light on them that glow, or on snow, as if the sun is causing it to happen.
**		- We could have a monster that is a bunch of glowy blobs... .. hmm so much we can do.
**
**		Weaknesses:
**		- a FPS hit, depeding upon video card. ( but our game is mostly cpu bound )
**		- Uses pixel shaders, which means you need a GeForce3 or greater to run this code.
**
**
**		Date:	08/22/03
**
*************************************************************************************/

I found this in example.fx which is what I have been wondering. Just in case anyone else wants to fool with it check out example.fx.

// Vertex and Pixel shaders can also be used.  These can be in either HLSL format
// (which is highly recommended) or in ASM format.

LoneKnight's picture

That's a good point. Maybe you just got unlucky Shark, and never found the weapon. I recommend you search with SE2 to find the sword?

firebat's picture

I think they removed that sword to keep the min specs down, the comments Wyv posted and the fact bodoby saw any of those swords make me think that...

Sharkull's picture

Could be LK... but if it uses example.fx I won't be able to see the effect because I get this when starting DS2Mod (logged with the log_all=true flag):

+00:00:01.276 - Effect compilation for world\global\effects\shaders\dot3.fx successful!
+00:00:01.316 - Effect compilation for world\global\effects\shaders\example.fx skipped due to lack of hardware support!
+00:00:01.385 - Effect compilation for world\global\effects\shaders\glow.fx successful!
+00:00:01.398 - Effect compilation for world\global\effects\shaders\heatshimmer.fx successful!
+00:00:01.430 - Effect compilation for world\global\effects\shaders\ice.fx successful!
+00:00:01.458 - Effect compilation for world\global\effects\shaders\shadowblur.fx successful!
+00:00:01.483 - Effect compilation for world\global\effects\shaders\specular.fx successful!
+00:00:03.566 - Effect compilation for world\global\effects\shaders\water.fx successful!
+00:00:03.600 - Effect compilation for world\global\effects\shaders\water2.fx successful!
+00:00:03.635 - Effect compilation for world\global\effects\shaders\water3.fx successful!
+00:00:03.663 - Effect compilation for world\global\effects\shaders\water3b.fx successful!
+00:00:03.690 - Effect compilation for world\global\effects\shaders\water4.fx successful!

Example.fx fails on me and mcarp as well. It seems to be the only document for me to learn how shaders work for ds2.

After much reading and testing on my own, there certainly is not any sword (or anyTHING) with a shiny surface that you made mention, Sharky, sorry brother.

If only I had a video card that supports shaders! I would test out shader technology asap.

Regards,

SvS

oi svs, I see it possible to have some very cool effects on textures with shaders! It can make this game look so awesome. The only problem is the system cost. I think in the long run this is something to look forward to (when we all have better computers)! I really do think this game can have great graphics. I only think the engine's design is what held back gpg. Being a continuous engine it requires a lot of cpu power. There is nothing stopping us but our pcs. Hmm, just imagine all the metal weapons/armor/ect having a nice shader...

on the FX6600GT(256), I get the same message in example.fx - "skipped to due lack of hardware support!"
I've turned everything up to maximum on the nVidia settings and also maxed out the shader setting in the game's options.. still no response..
There are reflections though, as you may (just!) be able to see on the blade from the screenie..

(left-click to enlarge)

..it's great fun charging around in the field though, Sharkull - what a great concept! Wink

firebat's picture

Wyvante wrote:
Example.fx fails on me and mcarp as well. It seems to be the only document for me to learn how shaders work for ds2.

same here, with a 7800GT which has shaders 3 support and all other fancy features...

example.fx is just an umm... example. its meant for reference purposes by the gpg staffers but it can also be read by modders to understand how shaders work and are coded in ds2.

example.fx was never meant to be compiled and used by the game. so i wudnt worry about it.

oi Lady

Sharkull's picture

Doh! Don't I feel silly for starting this thread. :oops: I was playing around with something in my_test_world yesterday, and I loaded up a base katana without any sfx attached to it... and it was SHINY! 8O

Then I took a closer look at the newbie "Rusty Dagger" that you start the game with... and guess what? No... It couldn't possibly be... YES! It had a reflective look too.
Crazy :tease: Insane :lightning:

Well... I guess it's not too bad. I'm not the only one that didn't notice this. :P

(Reading back in this thread, credit to Blondin for posting a pic of the dagger a few weeks ago... I guess I didn't look closely enough. :oops: I think I'll blame GPG's restrictive camera angles... Wink ).

Hah, I noticed a shiny sword yesterday when researching tracers for FX . Check out test_sword_01 . I didn't know the swords were reflective and had cool tracers on em. I guess we should play more ds2 /lol .

There's at least one more shiny sword in the game. If you look on the bottom shelf next to the door of the Blacksmith's in Kalrathia, there's a shiny Katana on it. You can't pick it up or buy it, but it looks good on the shelf.

I recently have tuned a 2h sword to look like a Morden sword (2h base template with morden sword model), but it has no shader effect on by default.

As you know maybe, these Morden swords are a big piece of metal and a(ny) shader effect would surely look great on that huge surface.

Now i'm absolutly not familar with that subject and would be happy for some hints.
Thus how to applying/enabling shaders on an item!?

I have searched all files out of logic.ds2res but i haven't found any refernece on these *.fx shader files mentioned in this thread... Sad

LoneKnight's picture

Hmm..makes sense that it was still in the game. Good luck, Sharky.

BTW, welcome back, KillerGremal.

Sharkull's picture

KG,
Wyvante is the one to talk about this... but there are fx files located here:
Logic.ds2res\world\global\effects\shaders

Looks engine related to me. Add the following to your item's texture gas file replacing with your texture's name to tell the engine to make it shiny. I havn't tried this but it should work. You will need to set up your texture's alpha channel properly. Check out b_w_swd_300.dds.

[t:tsd,n:b_w_swd_300]
{
  b hasalpha = false;
	layer1alphaarg1 = texture;
	layer1alphaarg2 = diffuse;
	layer1alphaop = arg1;
	layer1colorarg1 = texture;
	layer1colorarg2 = diffuse;
	layer1colorop = modulate;
  i layer1numframes = 1;
  f layer1secondsperframe = 0.0;
	layer1texture1 = b_w_swd_300;
  f layer1ushiftpersecond = 0.0;
  b layer1uwrap = true;
  f layer1vshiftpersecond = 0.0;
  b layer1vwrap = true;
	layer2alphaarg1 = texture;
	layer2alphaarg2 = current;
	layer2alphaop = arg1;
	layer2colorarg1 = texture;
	layer2colorarg2 = current;
	layer2colorop = blendcurrentalpha;
  i layer2numframes = 1;
  f layer2secondsperframe = 0.0;
	layer2texture1 = environment;
  f layer2ushiftpersecond = 0.0;
  b layer2uwrap = true;
  f layer2vshiftpersecond = 0.0;
  b layer2vwrap = true;
  i numlayers = 2;
  b timesyncanimation = false;
}
[t:tsd,n:b_w_swd_300-simple]
{
  b hasalpha = false;
	layer1texture1 = b_w_swd_300;
	layer1uwrap = true;
	layer1vwrap = true;
	numlayers = 1;
  i texturedetail = 0;
}

Thanks for the fast reply! Smile
I would appreciate that some guy at GPG would take this as example for good support!

As you see, it works!
However... - it turns the ugly and cruel Morden sword into a life-style platinum blade. Wink

Of course i have tried to exchange values like 'diffuse' with 'texture' and vise-versa, but either it keeps the old sword or i get the full-reflection version.
Is there maybe any way between?
I just would like to freshen up the dull look of the Morden sword with some light-intercations so that it doesn't appear so lifeless.
Well, is that possible at all with swords having a rather structured textrue?

Thanks again and in advance - there is nothing better how to spend a hot and lazy summer night like this. Wink

Sharkull's picture

Good stuff so far. Smile
The roof nodes for incantation shrines have shaders... but they only affect part of the texture. Here's the (I hope) applicable gas file code:

[t:tsd,n:b_t_xxx_cave_shrine-a]
{
  b hasalpha = false;
  b alphaformat = true;
	layer1alphaarg1 = texture;
	layer1alphaarg2 = diffuse;
	layer1alphaop = arg1;
	layer1colorarg1 = texture;
	layer1colorarg2 = diffuse;
	layer1colorop = modulate;
  i layer1numframes = 1;
  f layer1secondsperframe = 0.0;
	layer1texture1 = b_t_xxx_cave_shrine-a;
  f layer1ushiftpersecond = 0.0;
  b layer1uwrap = false;
  f layer1vshiftpersecond = 0.0;
  b layer1vwrap = true;
	layer2alphaarg1 = texture;
	layer2alphaarg2 = diffuse;
	layer2alphaop = arg2;
	layer2colorarg1 = texture;
	layer2colorarg2 = current;
	layer2colorop = blendcurrentalpha;
  i layer2numframes = 1;
  i texturedetail = 0;
  f layer2secondsperframe = 0.0;
	layer2texture1 = environment;
  f layer2ushiftpersecond = 0.0;
  b layer2uwrap = true;
  f layer2vshiftpersecond = 0.0;
  b layer2vwrap = true;
  i numlayers = 2;
  b timesyncanimation = false;
}

In case the texture has a special setup (with special layers... :?: ) you can find the image here:
logic.ds2res\art\bitmaps\terrain\generic\cave\b_t_xxx_cave_shrine-a.dds

Hope this helps.

Thanks, unfortunatly i wasn't able to check if in that case additional layers were used.
At least in terrain.ds2res\art\bitmaps\terrain\generic\cave\b_t_xxx_cave_shrine-a.gas there was no hint about.

Finally like this i have got a (full) platinum sword again... :?

I think you can get it more dull in the alpha channel. It looks to me that white is what made it shiny and black makes it not show up. I have not tried any of this, but that is how a lot of shader stuff works in games, and I can guess. This seems to be using the rendering engine but similar stuff. b_w_dag_301-a is a bit easier to see the alpha channel being used.

Alpha channel looks like this for b_w_dag_301-a . Items without the shiny effect have plain white. Sorry I was vague about the alpha channel. I should of realized you wouldn't catch that.

Code looks the same.

[t:tsd,n:b_w_dag_301-a]
{
  b hasalpha = false;
	layer1alphaarg1 = texture;
	layer1alphaarg2 = diffuse;
	layer1alphaop = arg1;
	layer1colorarg1 = texture;
	layer1colorarg2 = diffuse;
	layer1colorop = modulate;
  i layer1numframes = 1;
  f layer1secondsperframe = 0.0;
	layer1texture1 = b_w_dag_301-a;
  f layer1ushiftpersecond = 0.0;
  b layer1uwrap = true;
  f layer1vshiftpersecond = 0.0;
  b layer1vwrap = true;
	layer2alphaarg1 = texture;
	layer2alphaarg2 = current;
	layer2alphaop = arg1;
	layer2colorarg1 = texture;
	layer2colorarg2 = current;
	layer2colorop = blendcurrentalpha;
  i layer2numframes = 1;
  f layer2secondsperframe = 0.0;
	layer2texture1 = environment;
  f layer2ushiftpersecond = 0.0;
  b layer2uwrap = true;
  f layer2vshiftpersecond = 0.0;
  b layer2vwrap = true;
  i numlayers = 2;
  b timesyncanimation = false;
}
[t:tsd,n:b_w_dag_301-a-simple]
{
  b hasalpha = false;
	layer1texture1 = b_w_dag_301-a;
	layer1uwrap = true;
	layer1vwrap = true;
	numlayers = 1;
  i texturedetail = 0;
}

PS: Stuff with shaders has technique = (shader technique's name from a .fx file) in the gas file sharkull. I think gpg made this before adding in shaders as it seems to use the rendering engine. If I'm wrong about that blame gpg for not talking to our shader info request post /lol . You can probably say this is from the internal shading in the ds2 engine though. The mist for waterfalls uses the internal stuff to get its effect as well. I am pretty sure you do not need any shader model support for these effects.

Thanks for that hint, it have brought me on the right way! Wink

First i made a black/white dds image hoping that the default texture of the sword model would shine through at the bright places.

However, the result was a pure black/white sword. Sad

But i found the idea good (i mean, also some video rendering filters work with the brightness of a mask to let shine things through) so i have begun to tweak that code...

... and suddenly i got a 'shiny' version of a b/w sword, soon later a light-reflecting Morden sword: Smile

I can not say how this really works, however an specially tuned dds image is not required, the engine seems to replace the bright places by default - if you only find a way to tell it to the engine. Wink

	[aspect]
	{
		model = m_w_swd_evilsoldier-01;	
		[textures]
		{
			0 = b_w_swd_evilsoldier-shader;
		}
		tracer_texture = b_sfx_tra_generic-28-simple;
	}

[aspect] component of the tuned Morden sword.

///////////////////////////////////////////////////////////////////////////////////
// LIGHT-REFLECTING MORDEN SWORD FOR HOTFIX MOD - BY KILLERGREMAL/F3 - 20-JUN-2006
// EFFECT REALIZED BY HELP OF WYVANTE AND SHARKULL - FOR DETAILS TAKE A LOOK AT:
// WWW.SIEGETHEDAY.ORG / http://std.seijsing.se/forums/viewtopic.php?p=3539#3539
///////////////////////////////////////////////////////////////////////////////////

[t:tsd,n:b_w_swd_evilsoldier-shader]
{
  b hasalpha = false;
   layer1alphaarg1 = texture;
   layer1alphaarg2 = diffuse;
   layer1alphaop = arg1;
   layer1colorarg1 = texture;
   layer1colorarg2 = diffuse;
//   layer1colorop = modulate;
   layer1colorop = blendcurrentalpha;
  i layer1numframes = 1;
  f layer1secondsperframe = 0.0;
   layer1texture1 = environment;
  f layer1ushiftpersecond = 0.0;
  b layer1uwrap = true;
  f layer1vshiftpersecond = 0.0;
  b layer1vwrap = true;
   layer2alphaarg1 = texture;
   layer2alphaarg2 = current;
   layer2alphaop = arg1;
   layer2colorarg1 = texture;
   layer2colorarg2 = current;
//   layer2colorop = blendcurrentalpha;
   layer2colorop = modulate;
  i layer2numframes = 1;
  f layer2secondsperframe = 0.0;
   layer2texture1 = b_w_swd_evilsoldier-shader; // SAME AS: b_w_swd_evilsoldier-01.dds
  f layer2ushiftpersecond = 0.0;
  b layer2uwrap = true;
  f layer2vshiftpersecond = 0.0;
  b layer2vwrap = true;
  i numlayers = 2;
  b timesyncanimation = false;
}

// [t:tsd,n:b_w_swd_evilsoldier-lowshader]
// {
//   b hasalpha = false;
//	layer1texture1 = b_w_swd_evilsoldier-shader;
// 	layer1uwrap = true;
// 	layer1vwrap = true;
// 	numlayers = 1;
//   i texturedetail = 0;
// }


This is the content of the gas file called 'b_w_swd_evilsoldier-shader.gas' (as mentioned above in aspect:texture, file stored under: art\bitmaps\weapons\sword) .

So finally - since i'm considering modding as further variant of playing DS2 Wink - i'm glad to say it was a pleasant and succesfull game session with you! Laughing out loud

_______________
--- Edit: After cleaning up my mod i have discovered a possibly important thing:

aspect:texture:0=b_w_swd_evilsoldier-shader; seems to refer on two files at the same time:
- art\bitmaps\weapons\sword\b_w_swd_evilsoldier-shader.dds
- art\bitmaps\weapons\sword\b_w_swd_evilsoldier-shader.gas

So both files are reqired to get it working. Removing the dds file would lead to a black-yellow sword texture in the game.
Thus in the current case here b_w_swd_evilsoldier-shader.dds is just a copy of b_w_swd_evilsoldier-01.dds
.

Sharkull's picture

Great stuff! Can we look forward to a mod release with this weapon included? Laughing out loud

(PS. This thread has some great modding info. now... but in the Gen. Discussion forum. Stare I think I might split the topic and move the modding stuff... so it's easier to find).

Well, i initially have just seen a thread labeld with 'Shiny sword in DS2?' so i though just could post my request here.
I couldn't imagine that this thread would take the constructive way it has taken now... Smile

The 'shadered' Morden sword will be part of the next hotfix mod version, it will be coming Friday or Saturday i guess.
Of course that sword is no bug fix, it's just some discreet value-increasing feature (i hope at least).
You won't be able to buy that sword, you have to go and find Morden sword fighters for it, but only a few of them will drop the sword in the last moments of their forsaken life, the probability is generally about 1:8 and 1:12 for an enchantable and magic-less one.

This is not a lot but... rahter discreet than obtrusive - specially due to the nature of the hole mod.
If You like to save time an push Your chances a bit ;), of course the template has name, it will be: "#sd_1h_unq_evilsoldier_stats:var1/2/3/4"

That looks really sharp(western slang for good, pun intended) Smile . Wonder why gpg didn't do this for more of their swords. Are you going to add a tracer texture to the sword? I like items that are not so easy to find and monster specific as well .

Pages