This member has provided no bio about themself...

  • View media
  • View media
  • View media
  • View media
  • View media
  • View media
RSS My Blogs

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.

Common mistakes

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.


Start a group Groups
Espadon

Espadon

7 members Developer

We're a dedicated group of modders/game developers currently working on the mod Radium for Stalker: Call of Pripyat.

Freedom

Freedom

109 members Fans & Clans

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...

Comments  (0 - 10 of 18)
Blitzkriegrekrut
Blitzkriegrekrut

Hello,

I need help!
If I install Atmosfear 3, Absolute Nature 4, Absolute Structures and OWR Lite 2.1 my game crash at "start a new game". Why??...
I thinks they're fully compatible??...

Reply Good karma Bad karma+1 vote
MSwartz Creator
MSwartz

Sorry for not answering your PM.

I am not the author of OWR Lite, I simply re-hosted it. I can't help with that as I am busy with other projects.

Reply Good karma+1 vote
NickBros_256
NickBros_256

Hey buddy anything new?

Reply Good karma Bad karma+1 vote
alanyu2234
alanyu2234

Hey man, I had been playing Swartz mod for a while now, still cannot find m60 and m79 in the game, please pm me if you are willing to tell me?

Reply Good karma Bad karma+1 vote
MSwartz Creator
MSwartz

Wow, sorry I hadn't replied to this. I never check my profile.

I actually don't remember where the M79 is, but the M60 is in Jupiter Underground in a very hard to get to spot. You'll need to climb some ladders and perform a series of jumps to get to it. Look up!

Reply Good karma+1 vote
HDKramer
HDKramer

Hey dude!
I have a very cool Metro 2033 revolver fully upgradable with anims/model/textures for Stalker COP. The only bad thing is the speed of reload animation : way too slow! But I'm sure you can take care of that right? :D

PM me if you want it!
Good luck for Swartz mods!

Reply Good karma Bad karma+1 vote
quandan113
quandan113

Hey man , about the mod SWAZT , i need to khow how to do the "Emission Warning and other warning" show back ?

Reply Good karma Bad karma+1 vote
MSwartz Creator
MSwartz

Never heard of SWAZT mod. If you mean Swartz mod, I answered you on that page.

Reply Good karma+3 votes
loner85
loner85

Good work with Swartz mod for CoP and FC3 ;) I'm playing the last one right now :D

Reply Good karma Bad karma+1 vote
MSwartz Creator
MSwartz

Thanks :)

Reply Good karma+2 votes
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Level
Avatar
Avatar
Status
Last Online
Country
United States United States
Gender
Male
Friends
Become friends
Member watch
Follow
Statistics
Rank
431 of 592,165
Visitors
18,571 (4 today)
Time Online
2 weeks
Activity Points
3,448
Watchers
52 members
Comments
1,367
Site visits
17,301
Contact
Contact
Send Message
Friends
mp5lng
mp5lng Online
FanofCrommsWorks
FanofCrommsWorks Online
Borovos
Borovos Online
Lоner
Lоner Online
Cyrano7
Cyrano7 Online
Dаntе
Dаntе Online
Alundaio
Alundaio Online
burguois Online
trojanuch
trojanuch Online
Predator_828
Predator_828 Online