This member has provided no bio about themself...
So with Radium in the works, and the next version of Call of Chernobyl adding support for 3rd party shader authoring, I thought I'd give a little insight on how shader authoring in Xray 1.6 works. This will be a multi-part series.
Note that it is already possible to author shaders for DirectX 9 in Xray 1.6. To do this, you need to delete your "shaders_cache" folder, which is present in your appdata folder, before you will be able to load any new shaders. You can not currently add new shaders for DX10-11, though you will be able to when Radium is out, and even sooner when Call of Chernobyl 1.4 is out.
This blog series is going to assume you have thoroughly read Crash Course in HLSL before attempting anything. It's really the least you should know. This blog post is more about things that are specific to Xray 1.6.
When people have messed around with shaders in the previous games, some mistakes seem to be common.
1) Do not remove white space from your shaders. All it does is make your shader impossible for others to read. People do this thinking it is a way of "optimizing" shaders. It is not, at run-time when the shader is compiled, it does not read the white space.
2) Modifications of the wrong functions. This obviously comes from lack of knowledge, but I'll give you an example of one I came across. Someone was modifying the water shader for a different stalker game, and claimed they were improving the wave effect of the water. The value they were modifying was "Fc". Let me show you that part of the shader:
// water fog half fog_exp_intens = -4.0h; float fog = 1-exp(fog_exp_intens*waterDepth); half3 Fc = half3( 0.1h, 0.1h, 0.1h) * water_intensity.r; final = lerp (Fc, final*I.c0*2, alpha); alpha = min(alpha, saturate(waterDepth)); alpha = max (fog, alpha);Notice something? Take a look at the comment that was left (// is a comment): this area is used to calculate the fog in the water. Fc is a half3 value, meaning, it is a half-precision function that contains three floating point values. Another clue, is the next line, where you see that linear interpolation is done between Fc, final, I.c0 (the input Color), and the alpha value.
Final is defined earlier as:
half3 final=lerp(c_reflection,base.rgb,base.a); final *= I.c0*2;
So what is Fc? It's the fog color. It has nothing to do with water distortion.
3) Naming shaders you create something very unique or new, when it either already has a name, or it is not what you're claiming it is. Don't do it. It does not make you sound intelligent, it makes you look like a moron when someone reads your shader after your claims and then realizes you were full of shit.
Examples: slightly modifying lighting effects by multiplying a single value and calling it a new type of lighting, or changes the number of samples that the parallax mapping function draws from and giving it a new fancy name.
This has been shorter than anticipated, but stay tuned soon for part 2: Creating a new Pixel shader effect without having to modify the engine code.
No blogs were found matching the criteria specified. We suggest you try the blog list with no filter applied, to browse all available. Join now to share your own content, we welcome creators and consumers alike and look forward to your comments.
We're a dedicated group of modders/game developers currently working on the mod Radium for Stalker: Call of Pripyat.
Do you want to earn the respect of fellow Stalkers? Do you want to build a team of loyal friends who will stick up for you in times of trouble? Do you...
No groups were found matching the criteria specified. We suggest you try the group list with no filter applied, to browse all available. Start a group and help us achieve our mission of showcasing the best content from all developers. Join now to share your own content, we welcome creators and consumers alike and look forward to your comments.