B Info Shader Shader Stuff- HLSL instruction limits

Currently Viewing (Users: 0, Guests: 1)

_Sebastian_

Punkbuster 2.0
Baron
NWWBVC
Best answers
0
...seems perfectionism is still worth it^^

You guys might think that all these effects would result in a performance hit, but this isn't the case.
Due to the fact that the Warband shaders are horrible written(also PostFX shaders), I decided to rewrite everything from scratch.
In the end the shader files size has been halved and the performance has been increased aswell.
 

Airbar

Squire
M&BWBNWVCWF&S
Best answers
0
Nevermind that. I was being dumb and actually forgot to tell the compiler what shader version to compile.
 

Arsakes

Sergeant
WB
Best answers
0
Hi,

lets assume I've used set_shader_param_float.
Is there any way I can tell that my uniform is defined?
I mean someting like
Code:
#ifdef <paramname>

Second question:
what string can be name for a shader param?
 

Odelaly

Sergeant
Best answers
0
I've programmed a simple shader to recreate an old school "rotoscope" lightsaber effect.

An alchemy of glowiness and a slight shakiness.


Props to Swyter, Xenoargh, Barabas and other people for posting useful leads to shader authoring over the forums, that was really useful.

I'll shout out two questions however:

I'd like my shader to be ignored by the HDR Pass, is this possible?

I don't understand how the Motion Blur effect goes from the shader to a material and then to the object, whatever flag I use (as in, the same as a native sword for example), or vertex shader, it does not seem to affect my object, am I missing something (hardcoded)?

Thanks in advance.

 

_Sebastian_

Punkbuster 2.0
Baron
NWWBVC
Best answers
0
Heyho!
I'm currently working on a pure shader skydome which simulates atmospheric scattering.
It is still in a very early stage with only it's basics working, but the result is alrealy good enough to show off some pictures.
The static texture skyboxes allways bothered me for ages, so it was time to get rid of them and create a dynamic skydome.
But enough words for now, here are some results;

Low sun altitude, approximately 9 degrees.
Stars also blend in dynamically, depending on the amount of scattered light.

As I mentioned above it's still very basic and much more tweaking is needed to make it work in a physically correct manner.
Anyway, I'll keep you guys updated!


Odelaly said:
I'd like my shader to be ignored by the HDR Pass, is this possible?
No.
Odelaly said:
I don't understand how the Motion Blur effect goes from the shader to a material and then to the object, whatever flag I use (as in, the same as a native sword for example), or vertex shader, it does not seem to affect my object, am I missing something (hardcoded)?
The weapon blurring is hardcoded and can only be prevented by using the item flag "itp_no_blur", so check your item code.
 

Odelaly

Sergeant
Best answers
0
Thanks for the info, nothing I can't work around and... impressive work, excited to see more!
 

Tama

Veteran
Best answers
0
Okay, so I had no idea the community was this mature to delve this deep into shaders. I have some limited experience with writing cg both fragment and surface. I just pulled an all-nighter to read every post in this topic. But I still don't know where to start from, the shader codes are a mess(or I'm sleepy). It's afternoon already and at this point I'm wondering if I'm really too sleepy because even though I checked module data folder inside the module_system_zip again and again I couldn't find any references to techniques in postFx.fx. I'm I not seeing it?

P.S. Good work on all those shaders! I'm impressed.
 

Tama

Veteran
Best answers
0
_Sebastian_ said:
@Tama
You need the shader files ofc;
http://download2.taleworlds.com/mb_warband_shaders.zip
Thank you! I already figured that out ^^

I downloaded and checked them out last night but haven't fiddled with them yet. My questions are, I have basic/intermediate knowledge of how shaders work.

*But where is the warband engine stuff come in? Is there something I should know before I start?
*What are the differences between hlsl and cg?
 

Tama

Veteran
Best answers
0
Terribly sorry for double posting, but I just made this: https://forums.taleworlds.com/index.php/topic,351946.msg8452725.html#msg8452725

It isn't the best parallax out there. But it works. I thought starting at parallax to understand warband shaders would be a good step. Thanks to everything I read here I was able to do it.
 
Best answers
0
So, I am trying to achieve this effect with using shaders.

Up - Initial text.
Down - When clicked.

I have done only this much, I first wanted to change the font colors to pure white, then this came up; so can I go even further as to add bevel/emboss and shadows to achieve this effect on font uniforms? Is it possible?

Code:
#ifdef UI_SHADERS
PS_OUTPUT ps_font_uniform_color(VS_OUTPUT_FONT In) 
{ 
	PS_OUTPUT Output;
	Output.RGBColor = float4(1,1,1,1);
	Output.RGBColor.a *= tex2D(FontTextureSampler, In.Tex0).a;
	return Output;
}
PS_OUTPUT ps_font_background(VS_OUTPUT_FONT In) 
{ 
	PS_OUTPUT Output;
	Output.RGBColor = float4(0,0,0,1);
	Output.RGBColor.a *= tex2D(FontTextureSampler, In.Tex0).a;
	return Output;
}
PS_OUTPUT ps_font_outline(VS_OUTPUT_FONT In) 
{ 
	PS_OUTPUT Output;
	Output.RGBColor = float4(0,0,0,1);
	Output.RGBColor.a *= tex2D(FontTextureSampler, In.Tex0).a;
	return Output;
}
 

_Sebastian_

Punkbuster 2.0
Baron
NWWBVC
Best answers
0
Efe Karacar said:
So, I am trying to achieve this effect with using shaders.
Ahm, this should be doable by just using presentations.
No need to modify any shaders.

Edit
Once you guys come up with a question, please use this thread instead of sending me a PM everytime. :wink:
 

ThaneWulfgharn

Master Knight
Best answers
0
Hello, In the real life, I am an Electronic Engineering student and I know the basics of programming in C. Looking at what wonders you guys have done with shaders in Mount&Blade, the fact that the HLSL programming logic seems at first glance similar to C and counting that shader modders are the among the rarest in these forums I would like to learn shader scripting.

Currently I have zero experience with shader modding I can't even compile the files properly(it says "failed writing mb_2a.fxo" and "failed writing mb_2b.fxo").

I would like you to advise and guide me on the first steps of realising my shaders.

My questions are:
1) How to compile properly
2) How to create a completely new shader
3) Which is the best tutorial library for HLSL

Also, I've been wanting to create reflect shaders for various metal armors. Somewhere I found on the internet this HLSL tutorial for the Reflect:

My goal is to make two shaders(one with specular and one without specular) that read a grayscale envmap from a material and, just like specular shaders, the whiter the color the stronger the reflection. The effect should be something like:
(click to show/hide)

How should I reason and proceed in realising such a shader?
 

_Sebastian_

Punkbuster 2.0
Baron
NWWBVC
Best answers
0
@ThaneWulfgharn
Your Spoilers ain't working.

Anyway, this is the page for allmost all your needs.
https://msdn.microsoft.com/en-us/library/windows/desktop/bb509561(v=vs.85).aspx

 

ThaneWulfgharn

Master Knight
Best answers
0
Ah alright fixed it!

Those two screenshoots are from the Mercenaries mod.
I do not want to "ask" for shaders, besides, I want a reflection shader that can cover almost every metal.
 

_Sebastian_

Punkbuster 2.0
Baron
NWWBVC
Best answers
0
Native shaders already provide the stuff you need.
You have env shaders and specular/bump shaders, just combine the effects into a single shader.
It's pretty simple to do so.

Study the structure of the shaders and how they are being called from the engine.
That will keep you busy for a couple of days, but it's worth it.

Once you get used to the basics, you can come back and ask for more specific stuff.  :wink:
 

ha3481

Veteran
Best answers
0
What's it? Where did these colorful stains on the global map?

VS_OUTPUT_MAP
...
Out.Color = vMaterialColor * diffuse_light * vColor;