Post-processing-effectors (PPE)

From Mod Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 01:10, 7 July 2008 (edit)
Atrocious (Talk | contribs)
(File header - +anm info)
← Previous diff
Revision as of 07:14, 7 July 2008 (edit) (undo)
Bac9-flcl (Talk | contribs)
(Fixed some comments translation)
Next diff →
Line 37: Line 37:
00 00 80 3F 00 00 00 41 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 00 80 3F 00 00 00 41 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80
-;Do not understand how, but this triad podkrashivaet already translated into+;Do not understand how, but this triad is tinting already discoloured
; Не понимаю как, но эта триада подкрашивает уже переведенное в ; Не понимаю как, но эта триада подкрашивает уже переведенное в
-;chb image, that is doing slightly sinevatym result, at the same time+;image, so now we're adding a bit of blue tone to result, and at the same time
; чб изображение, то есть делаем слегка синеватым результат, заодно ; чб изображение, то есть делаем слегка синеватым результат, заодно
-;rusticate slightly red or green.+;the same time we slightly rusticate red or green.
; огрубляем слегка красные или зеленые. ; огрубляем слегка красные или зеленые.
Line 78: Line 78:
01 01 00 00 ;blur 01 01 00 00 ;blur
-;Dvoeniya in the eyes will not be+;There will be no image bifurcation
; Двоения в глазах не будет ; Двоения в глазах не будет
Line 84: Line 84:
01 01 00 00 ;duality_v 01 01 00 00 ;duality_v
-;Noise will not be+;Noise is turned off
; Шума не будет ; Шума не будет

Revision as of 07:14, 7 July 2008

Custom PPE for sepia vision
Custom PPE for sepia vision

Post-process effectors (.ppe) in STALKER are used to create visual effects like radiation-exposure, drunkenness, psy-effects, night-vision and other. They are binary files that have a certain internal structure. Once you understand the structure and manage to keep the overview in the file, you can edit them or even create new effectors. Note that PPEs always affect the whole screen, so it is not possible to limit the effects to certain areas. A necessary tool to edit PPEs is a decent hex editor like HxD.

This article is based on the Russian version by Green Hawk (see interwiki link). Many thanks to him for doing the research and sharing with the community!

Contents

Analysis

It may help you to understand the structure of PPEs if you look into \gamedata\script\postprocess.script and into some ltx like \gamedata\config\scripts\proba.ltx. It seems like postprocess.script was used to create PPEs - or at least read PPE configurations from .ltx'.

Every PPE file contains multiple sets of rules. The structure of these rule-sets can be guessed by looking at the files above. But to make things easier, here is an overview over the structure. If you open a PPE in HxD to compare the structure with this explanation, it can be useful to change the number of bytes per row to something like eight. It may help you to gain a better overview of the file segments.

File header

Every file starts with 01 00 00 00. This is most likely a signature to identify the file content. Note: The camera animation files .anm share the same structure and have the signature 00 11 00 00. They are located within the same folder as the PPEs. After the signature, four bytes with unknown meaning follow. Usually they are 7C 00 00 00, but there are variations. So our file until here looks like 01 00 00 00 7C 00 00 00. Now the rule-sets follow.

Rule-sets introduction

Every set begins with 01 01 XX 00 where XX is the number of rules that the set contains. For example 01 01 00 00 means that no rule follows, so the set is not active at all. Many mistakes happen if the number given at the start of the set does not fit the number of rules. Make sure to check it, every time you change something.

Rules always consist of 23 bytes! This makes keeping the overview more complicated because now we have even headers and odd content. So your lines will pretty fast break. If a rule-set started with 01 01 04 00 then there will be 04 x 23 bytes of rules following.

To get a better understanding, it might be good to look at an example file wit comments now, before we look at the explanation of the segments.

Example file with comments

The following example shows the structure of a PPE with comments. It is taken from the Russian article and translated with google. Since the translations do not always make sense, I left the Russian originals for future improved translations.

01 00 00 00 		;signature
 
;Colors twisted at a maximum 
;  Цвета выкручиваем на максимум
7C 00 00 00 		;unknown1
01 01 02 00 		;color_add_red
00 00 80 3F 00 00 00 00 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
00 00 80 3F 00 00 00 41 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
01 01 02 00 		;color_add_green
00 00 80 3F 00 00 00 00 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
00 00 80 3F 00 00 00 41 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
01 01 02 00 		;color_add_blue
00 00 80 3F 00 00 00 00 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
00 00 80 3F 00 00 00 41 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
 
;Do not understand how, but this triad is tinting already discoloured 
;  Не понимаю как, но эта триада подкрашивает уже переведенное в 
;image, so now we're adding a bit of blue tone to result, and at the same time
;  чб изображение, то есть делаем слегка синеватым результат, заодно
;the same time we slightly rusticate red or green.
;  огрубляем слегка красные или зеленые.
 
6C 10 00 00  		;unknown2
01 01 02 00 		;color_base_red
CD CC CC 3D 00 00 00 00 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
CD CC CC 3D 00 00 00 41 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
01 01 02 00 		;color_base_green
CD CC CC 3D 00 00 00 00 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
CD CC CC 3D 00 00 00 41 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
01 01 02 00 		;color_base_blue
CD CC 4C 3E 00 00 00 00 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
CD CC 4C 3E 00 00 00 41 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
 
;In the gray mode all red objects - white, blue and green - black
;  В сером режиме все красные обьекты - белым, синие и зеленые - черным
 
7C 00 00 00  		;unknown3
01 01 02 00 		;color_gray_red
00 00 80 3F 00 00 00 00 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
00 00 80 3F 00 00 00 41 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
01 01 02 00 		;color_gray_green
00 00 80 BF 00 00 00 00 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
00 00 80 BF 00 00 00 41 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
01 01 02 00 		;color_gray_blue
00 00 80 BF 00 00 00 00 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
00 00 80 BF 00 00 00 41 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
 
;Fully black-and-white image, subject to the rules color_gray_ *
;  Полностью черно-белое изображение с учетом правил color_gray_*
 
01 01 02 00 		;gray
00 00 80 3F 00 00 00 00 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
00 00 80 3F 00 00 00 41 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
 
01 01 00 00 		;blur
 
;There will be no image bifurcation
;  Двоения в глазах не будет
 
01 01 00 00 		;duality_h
01 01 00 00 		;duality_v
 
;Noise is turned off
;  Шума не будет
 
01 01 00 00 		;noise_intensivity
01 01 00 00 		;noise_granularity
01 01 00 00		;noise_fps

Rule-sets explanation

Chosen color component multiplied by the factor, the parameter equal to 1 pure white color will remain white and pure black - black, the other component preobretut shade.

  • unknown1
  • color_add_red
  • color_add_green
  • color_add_blue

This value was adopted as a base for the colour, that is, if the value of the pixel color below the specified, it was adopted as specified and, if more, it remains the same. It should be noted that this is the only set of variables, which zadirat values above 0.5 is meaningless, added 0.5 somewhere in the wild engine.

  • unknown2
  • color_base_red
  • color_base_green
  • color_base_blue

This triad is responsible for the rules of weight in grey color / brightness presentation and color in the usual result is not visible. But with increased regulations gray, it is clear that in such color_gray_red = -1 pure red components will become black, 0 = remain unchanged, 1 - pure white:

  • unknown2
  • color_gray_red
  • color_gray_green
  • color_gray_blue

Variable manages the saturation value of the inverse, that is, the more gray (maximum 1) the lower the saturation of images:

  • gray

Blur images at large (try 25) begins shoals, the lower part of ports, if long stand still:

  • blur

Split image horizontally and vertically, respectively. Perhaps indicated on the screen, that is, with 1 copy of object, originally located in the center will be exactly at the edges:

  • duality_h
  • duality_v
  • noise_intensity
  • noise_granularity (the size of noise grain)
  • noise_fps (how many times per second should noise be calculated)

Rule explanation

Every rule (23 bytes) consists of different fields. Example rule with field labels:

value time function k1 k2 k3 unused (?)
9A 99 99 3E 00 00 A0 40 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80
  • value is what you usually want to change.
  • time
  • function is 00 in all PPEs, but it can be changed to 03 sinus, 01/05 cosine, 02 linear, 04 CTD.
  • k1, k2, k3 are probably ratios affected by function, but their usage is yet unresolved.
  • unused doesn't seem to be used, thus the name.

Using new effector files

  • A simple way to try new effector files is, to call them nightvision_bad.ppe or nightvision_good.ppe and put them into the gamedata\anims folder. Then you can use the effectors in game with suits that have either good night-vision or bad night-vision.
  • A little more complex (but necessary if you don't want to overwrite the existing night-visions) is the following: Call the new effector file like you want e.g. my_super_effector.ppe and make a new section for it in gamedata\config\misc\postprocess.ltx. You could also replace the link to another .ppe in an existing section. Then you can tie the new section to another suit, for example.
  • In scripts you can use the following codes
to add an effector to the vision:
level.add_pp_effector("my_super_effector.ppe", 2008, true)
to remove the effector again:
level.remove_pp_effector(2008)
Note that 2008 in this case is the unique identifier for the effector. You could use a different number as well.

Source codes

You can copy the following source codes and use them as templates for experiments. Simply make a new file with HxD, then copy the hex codes from this page into HxD (ignore the warning) and save the file. If you want to compare both source files, to see what I have changed to make the gray vision, you can copy them into a text file, save as text document and compare them with WinMerge or Compare It!.

If you did something wrong, x-ray will report an error, which is most likely noise.grain cannot be zero.

Please add more source codes, if you achieve interesting effects.

Example file without comments

This is the example file Green Hawk posted on the Russian article. It's some kind of good night-vision.

Purple NV good (at day)
Purple NV good (at day)
01 00 00 00 7C 00 00 00 01 01 02 00 00 00 80 3F 
00 00 00 00 00 00 80 00 80 00 80 00 80 00 80 00 
80 00 80 00 00 80 3F 00 00 00 41 00 00 80 00 80 
00 80 00 80 00 80 00 80 00 80 01 01 02 00 00 00 
80 3F 00 00 00 00 00 00 80 00 80 00 80 00 80 00 
80 00 80 00 80 00 00 80 3F 00 00 00 41 00 00 80 
00 80 00 80 00 80 00 80 00 80 00 80 01 01 02 00 
00 00 80 3F 00 00 00 00 00 00 80 00 80 00 80 00 
80 00 80 00 80 00 80 00 00 80 3F 00 00 00 41 00 
00 80 00 80 00 80 00 80 00 80 00 80 00 80 6C 10 
00 00 01 01 02 00 CD CC CC 3D 00 00 00 00 00 00 
80 00 80 00 80 00 80 00 80 00 80 00 80 CD CC CC 
3D 00 00 00 41 00 00 80 00 80 00 80 00 80 00 80 
00 80 00 80 01 01 02 00 CD CC CC 3D 00 00 00 00 
00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 CD 
CC CC 3D 00 00 00 41 00 00 80 00 80 00 80 00 80 
00 80 00 80 00 80 01 01 02 00 CD CC 4C 3E 00 00 
00 00 00 00 80 00 80 00 80 00 80 00 80 00 80 00 
80 CD CC 4C 3E 00 00 00 41 00 00 80 00 80 00 80 
00 80 00 80 00 80 00 80 7C 00 00 00 01 01 02 00 
00 00 80 3F 00 00 00 00 00 00 80 00 80 00 80 00 
80 00 80 00 80 00 80 00 00 80 3F 00 00 00 41 00 
00 80 00 80 00 80 00 80 00 80 00 80 00 80 01 01 
02 00 00 00 80 BF 00 00 00 00 00 00 80 00 80 00 
80 00 80 00 80 00 80 00 80 00 00 80 BF 00 00 00 
41 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
01 01 02 00 00 00 80 BF 00 00 00 00 00 00 80 00 
80 00 80 00 80 00 80 00 80 00 80 00 00 80 BF 00 
00 00 41 00 00 80 00 80 00 80 00 80 00 80 00 80 
00 80 01 01 02 00 00 00 80 3F 00 00 00 00 00 00 
80 00 80 00 80 00 80 00 80 00 80 00 80 00 00 80 
3F 00 00 00 41 00 00 80 00 80 00 80 00 80 00 80 
00 80 00 80 01 01 00 00 01 01 00 00 01 01 00 00 
01 01 00 00 01 01 00 00 01 01 00 00

Sepia vision effector

Coincidental I made a grey filter that has something of another color in it. A bit like sepia filter. Atrocious

Sepia vision effector
Sepia vision effector
01 00 00 00 7C 00 00 00 01 01 02 00 00 00 80 3F 
00 00 00 00 00 00 80 00 80 00 80 00 80 00 80 00 
80 00 80 00 00 80 3F 00 00 00 41 00 00 80 00 80 
00 80 00 80 00 80 00 80 00 80 01 01 02 00 00 00 
80 3F 00 00 00 00 00 00 80 00 80 00 80 00 80 00 
80 00 80 00 80 00 00 80 3F 00 00 00 41 00 00 80 
00 80 00 80 00 80 00 80 00 80 00 80 01 01 02 00 
00 00 80 3F 00 00 00 00 00 00 80 00 80 00 80 00 
80 00 80 00 80 00 80 00 00 80 3F 00 00 00 41 00 
00 80 00 80 00 80 00 80 00 80 00 80 00 80 6C 10 
00 00 01 01 02 00 CD CC CC 3D 00 00 00 00 00 00 
80 00 80 00 80 00 80 00 80 00 80 00 80 CD CC CC 
3D 00 00 00 41 00 00 80 00 80 00 80 00 80 00 80 
00 80 00 80 01 01 02 00 CD CC CC 3D 00 00 00 00 
00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 CD 
CC CC 3D 00 00 00 41 00 00 80 00 80 00 80 00 80 
00 80 00 80 00 80 01 01 02 00 CD CC CC 3D 00 00 
00 00 00 00 80 00 80 00 80 00 80 00 80 00 80 00 
80 CD CC CC 3D 00 00 00 41 00 00 80 00 80 00 80 
00 80 00 80 00 80 00 80 7C 00 00 00 01 01 02 00 
00 00 00 01 00 00 00 00 00 00 80 00 80 00 80 00 
80 00 80 00 80 00 80 00 00 00 01 00 00 00 41 00 
00 80 00 80 00 80 00 80 00 80 00 80 00 80 01 01 
02 00 00 00 00 01 00 00 00 00 00 00 80 00 80 00 
80 00 80 00 80 00 80 00 80 00 00 00 01 00 00 00 
41 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
01 01 02 00 00 00 00 01 00 00 00 00 00 00 80 00 
80 00 80 00 80 00 80 00 80 00 80 00 00 00 01 00 
00 00 41 00 00 80 00 80 00 80 00 80 00 80 00 80 
00 80 01 01 02 00 00 00 DD DD 00 00 00 00 00 00 
80 00 80 00 80 00 80 00 80 00 80 00 80 00 00 DD 
DD 00 00 00 41 00 00 80 00 80 00 80 00 80 00 80 
00 80 00 80 01 01 00 00 01 01 00 00 01 01 00 00 
01 01 00 00 01 01 00 00 01 01 00 00

Black and White vision effector

Again some effect happened, as I tried working with sinus. Atrocious

Black and White vision effector
Black and White vision effector
01 00 00 00 7C 00 00 00 01 01 02 00 00 00 80 3F 
00 00 00 00 00 00 80 00 80 00 80 00 80 00 80 00 
80 00 80 00 00 80 3F 00 00 00 41 00 00 80 00 80 
00 80 00 80 00 80 00 80 00 80 01 01 02 00 00 00 
80 3F 00 00 00 00 00 00 80 00 80 00 80 00 80 00 
80 00 80 00 80 00 00 80 3F 00 00 00 41 00 00 80 
00 80 00 80 00 80 00 80 00 80 00 80 01 01 02 00 
00 00 80 3F 00 00 00 00 00 00 80 00 80 00 80 00 
80 00 80 00 80 00 80 00 00 80 3F 00 00 00 41 00 
00 80 00 80 00 80 00 80 00 80 00 80 00 80 6C 10 
00 00 01 01 02 00 40 A0 00 00 00 00 00 00 03 00 
80 00 80 00 80 00 80 00 80 00 80 00 80 40 20 00 
00 00 00 00 41 03 00 80 00 80 00 80 00 80 00 80 
00 80 00 80 01 01 02 00 00 00 00 00 00 00 00 00 
00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 
00 00 00 00 00 00 41 00 00 80 00 80 00 80 00 80 
00 80 00 80 00 80 01 01 02 00 00 00 00 00 00 00 
00 00 00 00 80 00 80 00 80 00 80 00 80 00 80 00 
80 00 00 00 00 00 00 00 41 00 00 80 00 80 00 80 
00 80 00 80 00 80 00 80 7C 00 00 00 01 01 02 00 
00 00 80 3F 00 00 00 00 00 00 80 00 80 00 80 00 
80 00 80 00 80 00 80 00 00 80 3F 00 00 00 41 00 
00 80 00 80 00 80 00 80 00 80 00 80 00 80 01 01 
02 00 00 00 80 BF 00 00 00 00 00 00 80 00 80 00 
80 00 80 00 80 00 80 00 80 00 00 80 BF 00 00 00 
41 00 00 80 00 80 00 80 00 80 00 80 00 80 00 80 
01 01 02 00 00 00 80 BF 00 00 00 00 00 00 80 00 
80 00 80 00 80 00 80 00 80 00 80 00 00 80 BF 00 
00 00 41 00 00 80 00 80 00 80 00 80 00 80 00 80 
00 80 01 01 02 00 00 00 80 3F 00 00 00 00 00 00 
80 00 80 00 80 00 80 00 80 00 80 00 80 00 00 80 
3F 00 00 00 41 00 00 80 00 80 00 80 00 80 00 80 
00 80 00 80 01 01 00 00 01 01 00 00 01 01 00 00 
01 01 00 00 01 01 00 00 01 01 00 00

Questions

As you can see, there are still open questions:

  • What are the byte blocks that are labled unknownX?
  • How do k1, k2, k3 work?
  • Is there a meaning for the unused part of each rule?

Feel free to contribute, if you find out anything about it.

Personal tools
In other languages