OSP Shaders Barabas' shaders

Users who are viewing this thread

Mammoet

Master Knight
Hello!

I heavily edited the shaders for warband and I would like to share :smile:
Beware, this is only for modders, not adviseable to apply to any existing mod without tweaking it!
If you don't know what this is, it;'s probably not for you.

Most important new features:
-Colored specular maps
-Parallax shaders
-Better looking envmap shaders for swords (and other metals)

It might be that the speculars are a bit bright (like 10 times or so...). Easiest way to fix this is change the "SpecularCoef" in the module_postfx.py

Use at your own risk and enjoy! :mrgreen:

For more info and discussion see this thread

Moderator: New download link by Swyter

Gamefront download
 
Last edited by a moderator:
I updated them with some minor fixes. It's what I use at the moment so it should work. If there are any problems/issues you're free to post here and I'll take a look at it when I have the time =)
 
Wow, parallax is much easier than I thought at first. Thanks for clearing it up.

Oh. What's with the FXO renamed as FX in the distribution pack? :smile:

_______
Barabas, mate. I'm trying to implement derivative maps in SWC. Can you help me with that?
It just doesn't makes sense to me.

Code:
http://www.rorydriscoll.com/2012/01/11/derivative-maps/
http://mmikkelsen3d.blogspot.com/2011/07/derivative-maps.html
 
It's so you warband can read it from the module directory. It doesn't understand it if there are fxo's. Unless I have been misinformed ^^

Edit: lol, I only now see that you are asking about derivative maps. I'll take a look at what it is. =)

Edit2: Looks very interesting. I'll try it out after dinner. I don't quite get it completely yet, but it doesn't look too complicated.
 
Unfortunately my gpu died last weekend, so now everything looks like **** and I have to run Warband at 800x600 to get playable fps. Here I upped my shader settings and a bit my texture quality too. And I have blender in the background, so my fps is ****. Apart from that I'm pretty sure it could be a lot better =D. Anyway the first implementation attempt looks like this:
pic1.png
Code:
PS_OUTPUT ps_main_g(VS_OUTPUT_G In, uniform const int PcfMode)
{
	PS_OUTPUT Output;

	// float2 height_grad = 2*tex2D(NormalTextureSampler, In.Tex0).rg-1;
	float height = tex2D(NormalTextureSampler, In.Tex0).b;
	float3 position_dx  = ddx(In.Position);
	float3 position_dy  = ddy(In.Position);
	float  dBs     		= ddx(height);
	float  dBt 			= ddy(height);
	// float2 uv_dx 		= ddx(In.Tex0);
	// float2 uv_dy	 	= ddy(In.Tex0);

	// float  dBs   		= height_grad.x*uv_dx.x+ height_grad.x*uv_dx.y;
	// float  dBt 			= height_grad.y*uv_dy.x + height_grad.y*uv_dy.y;

	float3 surface_gradient
					    = dBs*cross(In.Normal, position_dy) +dBt*cross(In.Normal, position_dx);
	surface_gradient   /= abs(In.Normal * dot(position_dx, position_dy));
	float3 normal       = normalize(In.Normal - surface_gradient);


	float shade         = saturate(dot(vSunDir, -normal));

	if ((PcfMode != PCF_NONE))
	{
		shade          *= GetSunAmount(PcfMode, In.ShadowTexCoord);
	}

	float3 color        = In.Color + shade*In.SunLight;

	float4 diff_tex     = tex2D(MeshTextureSampler, In.Tex0);
	INPUT_TEX_GAMMA(diff_tex.rgb);

	Output.RGBColor.rgb = color*diff_tex;
	Output.RGBColor.a   = diff_tex.a*In.Color.a;
	// gamma correct
	OUTPUT_GAMMA(Output.RGBColor.rgb);

	return Output;
}

technique diffuse_gradient
{
	pass P0
	{
		VertexShader =  compile VS_X vs_main_g(PCF_NONE);
		PixelShader = compile PS_2_X ps_main_g(PCF_NONE);
	}
}
technique diffuse_gradient_SHDW
{
	pass P0
	{
		VertexShader =  compile VS_X vs_main_g(PCF_DEFAULT);
		PixelShader = compile PS_2_X ps_main_g(PCF_DEFAULT);
	}
}
technique diffuse_gradient_SHDWNVIDA
{
	pass P0
	{
		VertexShader =  compile VS_X vs_main_g(PCF_NVIDIA);
		PixelShader = compile PS_2_X ps_main_g(PCF_NVIDIA);
	}
}

DEFINE_LIGHTING_TECHNIQUE(diffuse_gradient, 0, 0, 0, 0, 0, 0, 0)

EDIT:
I updated the code with my latest version. The commented stuff is for the derivative maps.
The main problem is blockiness. And I'm not sure it works correctly actually. I also didn't get it to work with the derivative maps (which is actually the same as normalmaps with 2 components, just with the tangent space replaced by all this ddx stuff in the pixelshader.). I'm giving up for now. If anyone else manages to get better results let us know =)
 
LordMalacath said:
Link is dead.
Can somebody upload it elsewhere as a mirror?

I'm also blocked from Gamefront (Spain is on the disallowed list). Used a quick proxy for getting it anyway:
Code:
[URL=https://dl.dropbox.com/u/108770784/barabas_shaders.rar]https://dl.dropbox.com/u/108770784/barabas_shaders.rar[/URL]
 
Back
Top Bottom