forked from BlueSkyDefender/Depth3D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSuperDepth3D_FlashBack.fx
1202 lines (1062 loc) · 28 KB
/
SuperDepth3D_FlashBack.fx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
////--------------------------//
///**SuperDepth3D_FlashBack**///
//--------------------------////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//* Depth Map Based 3D post-process shader v1.9.4 *//
//* For Reshade 3.0 *//
//* -------------------------- *//
//* This work is licensed under a Creative Commons Attribution 3.0 Unported License. *//
//* So you are free to share, modify and adapt it for your needs, and even use it for commercial use. *//
//* I would also love to hear about a project you are using it with. *//
//* https://creativecommons.org/licenses/by/3.0/us/ *//
//* *//
//* Have fun, *//
//* Jose Negrete AKA BlueSkyDefender *//
//* *//
//* http://reshade.me/forum/shader-presentation/2128-sidebyside-3d-depth-map-based-stereoscopic-shader *//
//* --------------------------------- *//
//* *//
//* Original work was based on Shader Based on forum user 04348 and be located here http://reshade.me/forum/shader-presentation/1594-3d-anaglyph-red-cyan-shader-wip#15236 *//
//* *//
//* *//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
uniform int Alternate_Depth_Map <
ui_type = "combo";
ui_items = "DM 0\0DM 1\0DM 2\0DM 3\0DM 4\0DM 5\0DM 6\0DM 7\0DM 8\0DM 9\0DM 10\0DM 11\0DM 12\0DM 13\0DM 14\0DM 15\0DM 16\0DM 17\0DM 18\0DM 19\0DM 20\0DM 21\0DM 22\0DM 23\0DM 24\0DM 25\0DM 26\0DM 27\0DM 28\0DM 29\0DM 30\0DM 31\0DM 32\0DM 33\0DM 34\0DM 35\0DM 36\0DM 37\0";
ui_label = "Alternate Depth Map";
ui_tooltip = "Alternate Depth Map for different Games. Read the ReadMeDepth3d.txt, for setting. Each game May and can use a diffrent Alternet Depth Map.";
> = 0;
uniform int Depth <
ui_type = "drag";
ui_min = 0; ui_max = 30;
ui_label = "Depth Slider";
ui_tooltip = "Determines the amount of Image Warping and Separation between both eyes. To go beyond 25 max you need to enter your own number.";
> = 10;
uniform float Depth_Limit <
ui_type = "drag";
ui_min = 0.500; ui_max = 1.0;
ui_label = "Depth Limit";
ui_tooltip = "Limit how far Depth Image Warping is done. Default is One.";
> = 1.0;
uniform float Perspective <
ui_type = "drag";
ui_min = -50; ui_max = 50;
ui_label = "Perspective Slider";
ui_tooltip = "Determines the perspective point.";
> = 0;
uniform bool Depth_Map_View <
ui_label = "Depth Map View";
ui_tooltip = "Display the Depth Map. Use This to Work on your Own Depth Map for your game.";
> = false;
uniform bool Depth_Map_Enhancement <
ui_label = "Depth Map Enhancement";
ui_tooltip = "Enable Or Dissable Depth Map Enhancement. Default is Off";
> = 0;
uniform float Adjust <
ui_type = "drag";
ui_min = 0; ui_max = 1.5;
ui_label = "Adjust";
ui_tooltip = "Adjust DepthMap Enhancement, Dehancement occurs past one. Default is 1.0";
> = 1.0;
uniform int Weapon_Depth_Map <
ui_type = "combo";
ui_items = "Weapon Depth Map Off\0Custom Weapon Depth Map One\0Custom Weapon Depth Map Two\0Custom Weapon Depth Map Three\0Custom Weapon Depth Map Four\0WDM 1\0WDM 2\0WDM 3\0WDM 4\0WDM 5\0WDM 6\0WDM 7\0WDM 8\0WDM 9\0WDM 10\0WDM 11\0WDM 12\0WDM 13\0WDM 14\0WDM 15\0WDM 16\0WDM 17\0WDM 18\0WDM 19\0WDM 20\0WDM 21\0WDM 22\0WDM 23\0";
ui_label = "Alternate Weapon Depth Map";
ui_tooltip = "Alternate Weapon Depth Map for different Games. Read the ReadMeDepth3d.txt, for setting.";
> = 0;
uniform float3 Weapon_Adjust <
ui_type = "drag";
ui_min = -1.0; ui_max = 1.500;
ui_label = "Weapon Adjust Depth Map";
ui_tooltip = "Adjust weapon depth map. Default is (Y 0, X 0.250, Z 1.001)";
> = float3(0.0,0.250,1.001);
uniform float Weapon_Percentage <
ui_type = "drag";
ui_min = -1.0; ui_max = 5.0;
ui_label = "Weapon Percentage";
ui_tooltip = "Adjust weapon percentage. Default is 5.0";
> = 5.0;
uniform bool Depth_Map_Flip <
ui_label = "Depth Map Flip";
ui_tooltip = "Depth Flip if the depth map is Upside Down.";
> = false;
uniform int Custom_Depth_Map <
ui_type = "combo";
ui_items = "Custom Off\0Custom One\0Custom Two\0Custom Three\0Custom Four\0Custom Five\0Custom Six\0Custom Seven\0Custom Eight\0Custom Nine\0Custom Ten\0Custom Eleven\0Custom Twelve\0";
ui_label = "Custom Depth Map";
ui_tooltip = "Adjust your own Custom Depth Map.";
> = 0;
uniform float2 Near_Far <
ui_type = "drag";
ui_min = 0; ui_max = 100;
ui_label = "Near & Far";
ui_tooltip = "Adjustment for Near and Far Depth Map Precision.";
> = float2(1,1.5);
uniform int Stereoscopic_Mode <
ui_type = "combo";
ui_items = "Side by Side\0Top and Bottom\0Line Interlaced\0Checkerboard 3D\0";
ui_label = "3D Display Mode";
ui_tooltip = "Side by Side/Top and Bottom/Line Interlaced/Checkerboard 3D display output.";
> = 0;
uniform int Downscaling_Support <
ui_type = "combo";
ui_items = "Native\0Option One\0Option Two\0";
ui_label = "Downscaling Support";
ui_tooltip = "Dynamic Super Resolution & Virtual Super Resolution downscaling support for Line Interlaced & Checkerboard 3D displays.";
> = 0;
uniform bool Eye_Swap <
ui_label = "Eye Swap";
ui_tooltip = "Left right image change.";
> = false;
/////////////////////////////////////////////D3D Starts Here/////////////////////////////////////////////////////////////////
#define pix float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT)
texture DepthBufferTex : DEPTH;
sampler DepthBuffer
{
Texture = DepthBufferTex;
};
texture BackBufferTex : COLOR;
sampler BackBuffer
{
Texture = BackBufferTex;
};
texture texL { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA32F;};
sampler SamplerL
{
Texture = texL;
};
texture texR { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA32F;};
sampler SamplerR
{
Texture = texR;
};
//Depth Map Information
float4 DepthMap(float2 texcoord)
{
float4 color = 0;
if (Depth_Map_Flip)
texcoord.y = 1 - texcoord.y;
float4 depthM = tex2D(DepthBuffer, float2(texcoord.x, texcoord.y));
float4 WDM = tex2D(DepthBuffer, float2(texcoord.x, texcoord.y));
if (Custom_Depth_Map == 0)
{
//Alien Isolation | Firewatch
if (Alternate_Depth_Map == 0)
{
float cF = 1000000000;
float cN = 1;
depthM = (exp(depthM * log(cF + cN)) - cN) / cF;
}
//Amnesia: The Dark Descent
if (Alternate_Depth_Map == 1)
{
float cF = 1000;
float cN = 1;
depthM = cN/(cN-cF) / ( depthM - cF/(cF-cN));
}
//Among The Sleep | Soma
if (Alternate_Depth_Map == 2)
{
float cF = 10;
float cN = 0.05;
depthM = cN/(cN-cF) / ( depthM - cF/(cF-cN));
}
//The Vanishing of Ethan Carter Redux
if (Alternate_Depth_Map == 3)
{
float cF = 0.0075;
float cN = 1;
depthM = (cN * cF / (cF + depthM * (cN - cF)));
}
//Batman Arkham Knight | Batman Arkham Origins | Batman: Arkham City | BorderLands 2 | Hard Reset | Lords Of The Fallen | The Elder Scrolls V: Skyrim
if (Alternate_Depth_Map == 4)
{
float cF = 50;
float cN = 0;
depthM = (pow(abs(cN-depthM),cF));
}
//Call of Duty: Advance Warfare | Call of Duty: Black Ops 2 | Call of Duty: Ghost | Call of Duty: Infinite Warfare
if (Alternate_Depth_Map == 5)
{
float cF = 25;
float cN = 1;
depthM = (pow(abs(cN-depthM),cF));
}
//Casltevania: Lord of Shadows - UE | Dead Rising 3
if (Alternate_Depth_Map == 6)
{
float cF = 25;
float cN = 0;
depthM = (pow(abs(cN-depthM),cF));
}
//Doom 2016
if (Alternate_Depth_Map == 7)
{
float cF = 25;
float cN = 5;
depthM = (exp(pow(depthM, depthM + cF / pow(depthM, cN) - 1 * (pow((depthM), cN)))) - 1) / (exp(depthM) - 1);
}
//Deadly Premonition:The Directors's Cut
if (Alternate_Depth_Map == 8)
{
float cF = 30;
float cN = 0;
depthM = (pow(abs(cN-depthM),cF));
}
//Dragon Ball Xenoverse | Quake 2 XP
if (Alternate_Depth_Map == 9)
{
float cF = 1;
float cN = 0.005;
depthM = cN/(cN-cF) / ( depthM - cF/(cF-cN));
}
//Warhammer: End Times - Vermintide | Fallout 4
if (Alternate_Depth_Map == 10)
{
float cF = 7.0;
float cN = 1.5;
depthM = (exp(pow(depthM, depthM + cF / pow(depthM, cN) - 1 * (pow((depthM), cN)))) - 1) / (exp(depthM) - 1);
}
//Dying Light
if (Alternate_Depth_Map == 11)
{
float cF = 100;
float cN = 0.0075;
depthM = cF / (1 + cF - (depthM/cN) * (1 - cF));
}
//GTA V
if (Alternate_Depth_Map == 12)
{
float cF = 10000;
float cN = 0.0075;
depthM = cF / (1 + cF - (depthM/cN) * (1 - cF));
}
//Magicka 2
if (Alternate_Depth_Map == 13)
{
float cF = 1.025;
float cN = 0.025;
depthM = clamp(pow(abs((exp(depthM * log(cF + cN)) - cN) / cF),1000)/0.5,0,1.25);
}
//Middle-earth: Shadow of Mordor
if (Alternate_Depth_Map == 14)
{
float cF = 650;
float cN = 651;
depthM = pow(abs((exp(depthM * log(cF + cN)) - cN) / cF),1000);
}
//Naruto Shippuden UNS3 Full Blurst
if (Alternate_Depth_Map == 15)
{
float cF = 150;
float cN = 0.001;
depthM = (pow(abs(cN-depthM),cF));
}
//Shadow warrior(2013)XP
if (Alternate_Depth_Map == 16)
{
float cF = 5;
float cN = 0.05;
depthM = cN/(cN-cF) / ( depthM - cF/(cF-cN));
}
//Ryse: Son of Rome
if (Alternate_Depth_Map == 17)
{
float cF = 1.010;
float cN = 0;
depthM = pow(abs((exp(depthM * log(cF + cN)) - cN) / cF),1000);
}
//Sleeping Dogs: DE | DreamFall Chapters
if (Alternate_Depth_Map == 18)
{
float cF = 1;
float cN = 0.025;
depthM = (cN * cF / (cF + depthM * (cN - cF)));
}
//Souls Games
if (Alternate_Depth_Map == 19)
{
float cF = 1.050;
float cN = 0.025;
depthM = pow(abs((exp(depthM * log(cF + cN)) - cN) / cF),1000);
}
//Witcher 3
if (Alternate_Depth_Map == 20)
{
float cF = 7.5;
float cN = 1;
depthM = (pow(abs(cN-depthM),cF));
}
//Assassin Creed Unity | Just Cause 3
if (Alternate_Depth_Map == 21)
{
float cF = 150;
float cN = 151;
depthM = pow(abs((exp(depthM * log(cF + cN)) - cN) / cF),1000);
}
//Silent Hill: Homecoming
if (Alternate_Depth_Map == 22)
{
float cF = 25;
float cN = 25.869;
depthM = clamp(1 - (depthM * cF / (cF - cN) + cN) / depthM,0,255);
}
//Monstrum DX11
if (Alternate_Depth_Map == 23)
{
float cF = 1.075;
float cN = 0;
depthM = pow(abs((exp(depthM * log(cF + cN)) - cN) / cF),1000);
}
//S.T.A.L.K.E.R:SoC
if (Alternate_Depth_Map == 24)
{
float cF = 1.001;
float cN = 0;
depthM = pow(abs((exp(depthM * log(cF + cN)) - cN) / cF),1000);
}
//Double Dragon Neon
if (Alternate_Depth_Map == 25)
{
float cF = 0.5;
float cN = 0.150;
depthM = log(depthM / cN) / log(cF / cN);
}
//Deus Ex: Mankind Divided
if (Alternate_Depth_Map == 26)
{
float cF = 250;
float cN = 251;
depthM = pow(abs((exp(depthM * log(cF + cN)) - cN) / cF),1000);
}
//The Elder Scrolls V: Skyrim Special Edition
if (Alternate_Depth_Map == 27)
{
float cF = 20;
float cN = 0;
depthM = (exp(pow(depthM, depthM + cF / pow(depthM, cN) - 1 * (pow((depthM), cN)))) - 1) / (exp(depthM) - 1);
}
//Rage64|
if (Alternate_Depth_Map == 28)
{
float cF = 50;
float cN = -0.5;
depthM = (exp(pow(depthM, depthM + cF / pow(depthM, cN) - 1 * (pow((depthM), cN)))) - 1) / (exp(depthM) - 1);
}
//Through The Woods
if (Alternate_Depth_Map == 29)
{
float cF = 25;
float cN = 0;
depthM = (exp(pow(depthM, depthM + cF / pow(depthM, cN) - 1 * (pow((depthM), cN)))) - 1) / (exp(depthM) - 1);
}
//Amnesia: Machine for Pigs
if (Alternate_Depth_Map == 30)
{
float cF = 100;
float cN = 0;
depthM = (exp(pow(depthM, depthM + cF / pow(depthM, cN) - 1 * (pow((depthM), cN)))) - 1) / (exp(depthM) - 1);
}
//Requiem: Avenging Angel
if (Alternate_Depth_Map == 31)
{
float cF = 100;
float cN = 1.555;
depthM = 1 - log(pow(abs(cN-depthM),cF));
}
//Turok: Dinosaur Hunter
if (Alternate_Depth_Map == 32)
{
float cF = 1000; //10+
float cN = 0;//1
depthM = (pow(abs(cN-depthM),cF));
}
//Never Alone (Kisima Ingitchuna)
if (Alternate_Depth_Map == 33)
{
float cF = 112.5;
float cN = 1.995;
depthM = 1 - log(pow(abs(cN-depthM),cF));
}
//Stacking
if (Alternate_Depth_Map == 34)
{
float cF = 15;
float cN = 0;
depthM = (exp(pow(depthM, depthM + cF / pow(depthM, cN) - 1 * (pow((depthM), cN)))) - 1) / (exp(depthM) - 1);
}
//Fez
if (Alternate_Depth_Map == 35)
{
float cF = 25.0;
float cN = 1.5125;
depthM = clamp(1 - log(pow(abs(cN-depthM),cF)),0,1);
}
//Lara Croft & Temple of Osiris
if (Alternate_Depth_Map == 36)
{
float cF = 0.340;//1.010+ or 150
float cN = 12.250;//0 or 151
depthM = 1 - clamp(pow(abs((exp(depthM * log(cF + cN)) - cN) / cF),10),0,1);
}
//RE7
if (Alternate_Depth_Map == 37)
{
float cF = 32.5;
float cN = 1;
depthM = (pow(abs(cN-depthM),cF));
}
}
else
{
//Custom One
if (Custom_Depth_Map == 1)
{
float cF = Near_Far.y; //10+
float cN = Near_Far.x;//1
depthM = (pow(abs(cN-depthM),cF));
}
//Custom Two
if (Custom_Depth_Map == 2)
{
float cF = Near_Far.y; //100+
float cN = Near_Far.x; //0.01-
depthM = cF / (1 + cF - (depthM/cN) * (1 - cF));
}
//Custom Three
if (Custom_Depth_Map == 3)
{
float cF = Near_Far.y;//0.025
float cN = Near_Far.x;//1.0
depthM = (cN * cF / (cF + depthM * (cN - cF)));
}
//Custom Four
if (Custom_Depth_Map == 4)
{
float cF = Near_Far.y;//1000000000 or 1
float cN = Near_Far.x;//0 or 13
depthM = (exp(depthM * log(cF + cN)) - cN) / cF;
}
//Custom Five
if (Custom_Depth_Map == 5)
{
float cF = Near_Far.y;//1
float cN = Near_Far.x;//0.025
depthM = cN/(cN-cF) / ( depthM - cF/(cF-cN));
}
//Custom Six
if (Custom_Depth_Map == 6)
{
float cF = Near_Far.y;//1
float cN = Near_Far.x;//1.875
depthM = clamp(1 - (depthM * cF / (cF - cN) + cN) / depthM,0,255); //Infinite reversed-Z. Clamped, not so Infinate anymore.
}
//Custom Seven
if (Custom_Depth_Map == 7)
{
float cF = Near_Far.y;//1.01
float cN = Near_Far.x;//0
depthM = clamp(pow(abs((exp(depthM * log(cF + cN)) - cN) / cF),1000)/0.5,0,1.25);
}
//Custom Eight
if (Custom_Depth_Map == 8)
{
float cF = Near_Far.y;//1.010+ or 150
float cN = Near_Far.x;//0 or 151
depthM = pow(abs((exp(depthM * log(cF + cN)) - cN) / cF),1000);
}
//Custom Nine
if (Custom_Depth_Map == 9)
{
float cF = Near_Far.y;
float cN = Near_Far.x;
depthM = log(depthM / cN) / log(cF / cN);
}
//Custom Ten
if (Custom_Depth_Map == 10)
{
float cF = Near_Far.y;//5
float cN = Near_Far.x;//5
depthM = (exp(pow(depthM, depthM + cF / pow(depthM, cN) - 1 * (pow((depthM), cN)))) - 1) / (exp(depthM) - 1);
}
//Custom Eleven
if (Custom_Depth_Map == 11)
{
float cF = Near_Far.y;//1.010+ or 150
float cN = Near_Far.x;//0 or 151
depthM = 1 - log(pow(abs(cN-depthM),cF));
}
//Custom Twelve
if (Custom_Depth_Map == 12)
{
float cF = Near_Far.y;//
float cN = Near_Far.x;//
depthM = 1 - clamp(pow(abs((exp(depthM * log(cF + cN)) - cN) / cF),10),0,1);
}
}
float4 D;
float4 depthMFar;
float4 depthMFarT;
float Adj;
float Per;
//Custom Weapon Depth Profile One
if (Weapon_Depth_Map == 1)
{
Adj = Weapon_Adjust.x;//0
Per = Weapon_Percentage;//5
float cWF = Weapon_Adjust.y;//0.250
float cWN = Weapon_Adjust.z;//1.001
WDM = 1 - (log(cWF * cWN/WDM - cWF));
}
//Custom Weapon Depth Profile Two
if (Weapon_Depth_Map == 2)
{
Adj = Weapon_Adjust.x;//0
Per = Weapon_Percentage;//5
float cWF = Weapon_Adjust.y;//-1000
float cWN = Weapon_Adjust.z;//0.985
WDM = (log(cWF / cWN*WDM - cWF));
}
//Custom Weapon Depth Profile Three
if (Weapon_Depth_Map == 3)
{
Adj = Weapon_Adjust.x;//0
Per = Weapon_Percentage;//5
float cWF = Weapon_Adjust.y;//0.250
float cWN = Weapon_Adjust.z;//1.001
WDM = (log(cWF * cWN/WDM - cWF));
}
//Custom Weapon Depth Profile Four
if (Weapon_Depth_Map == 4)
{
Adj = Weapon_Adjust.x;//0
Per = Weapon_Percentage;//5
float cWF = Weapon_Adjust.y;//-0.05
float cWN = Weapon_Adjust.z;//0.500
WDM = 1 - (log(cWN * WDM)/ 1 - log(cWF+WDM));
}
//Weapon Depth Map One
if (Weapon_Depth_Map == 5)
{
Adj = 0;
Per = 5;
float cWF = -1000;
float cWN = 0.9856;
WDM = (log(cWF / cWN*WDM - cWF));
}
//Weapon Depth Map Two
if (Weapon_Depth_Map == 6)
{
Adj = 0.001;
Per = 0.440;
float cWF = 0.255;
float cWN = 1.001;
WDM = 1 - (log(cWF * cWN/WDM - cWF));
}
//Weapon Depth Map Three
if (Weapon_Depth_Map == 7)
{
Adj = 0.000;
Per = 0.180;
float cWF = 0.235;
float cWN = 1.001;
WDM = 1 - (log(cWF * cWN/WDM - cWF));
}
//Weapon Depth Map Four
if (Weapon_Depth_Map == 8)
{
Adj = 0.00000001;
Per = 0.675;
float cWF = 10;
float cWN = 0.0085;
WDM = (log(cWF / cWN*WDM - cWF));
}
//Weapon Depth Map Five
if (Weapon_Depth_Map == 9)
{
Adj = 0.001;
Per = 0.525;
float cWF = 0.080;
float cWN = 1.001;
WDM = 1 - (log(cWF * cWN/WDM - cWF));
}
//Weapon Depth Map Six
if (Weapon_Depth_Map == 10)
{
Adj = 0;
Per = 0.500;
float cWF = -1.9;
float cWN = 1.001;
WDM = 1 - (log(cWF * cWN/WDM - cWF));
}
//Weapon Depth Map Seven
if (Weapon_Depth_Map == 11)
{
Adj = 0.125;
Per = 1;
float cWF = -1.0;
float cWN = -0.1;
WDM = (log(cWF * cWN/WDM - cWF));
}
//Weapon Depth Map Eight
if (Weapon_Depth_Map == 12)
{
Adj = 0.037;
Per = 5.0;
float cWF = 0.75;
float cWN = -1.0;
WDM = 1 - (log(cWF * cWN/WDM - cWF));
}
//Weapon Depth Map Nine
if (Weapon_Depth_Map == 13)
{
Adj = 0.000001;
Per = 5.0;
float cWF = 0.0045;
float cWN = 100;
WDM = 1 - (log(cWF * cWN/WDM - cWF));
}
//Weapon Depth Map Ten
if (Weapon_Depth_Map == 14)
{
Adj = 0.0;
Per = 2;
float cWF = 37.5;
float cWN = 0.523;
WDM = (log(cWF / cWN*WDM - cWF));
}
//Weapon Depth Map Eleven
if (Weapon_Depth_Map == 15)
{
Adj = 0.0003;
Per = 0.625;
float cWF = 0.625;
float cWN = 1.001;
WDM = 1 - (log(cWF * cWN/WDM - cWF));
}
//Weapon Depth Map Twelve
if (Weapon_Depth_Map == 16)
{
Adj = 0.050;
Per = 1.0;
float cWF = 1.5;
float cWN = 1.7;
WDM = 1 - (log(cWF * cWN/WDM - cWF));
}
//Weapon Depth Map Thirteen
if (Weapon_Depth_Map == 17)
{
Adj = 0;
Per = 0.666;
float cWF = -0.06;
float cWN = 0.666;
WDM = 1 - (log(cWN * WDM)/ 1 - log(cWF+WDM));
}
//Weapon Depth Map Fourteen
if (Weapon_Depth_Map == 18)
{
Adj = 0;
Per = 0.500;
float cWF = -0.0865;
float cWN = -0.2;
WDM = 1 - (log(cWN * WDM)/ 1 - log(cWF+WDM));
}
//Weapon Depth Map Fifteen
if (Weapon_Depth_Map == 19)
{
Adj = 0.000001;
Per = 5;
float cWF = 1.6;
float cWN = 1.001;
WDM = 1 - (log(cWF * cWN/WDM - cWF));
}
//Weapon Depth Profile Sixteen
if (Weapon_Depth_Map == 20)
{
Adj = 0.00000001;
Per = 5;
float cWF = -0.4925;
float cWN = 0.200;
WDM = 1 - (log(cWN * WDM)/ 1 - log(cWF+WDM));
}
//Weapon Depth Profile Seventeen
if (Weapon_Depth_Map == 21)
{
Adj = 0.040;
Per = 5;
float cWF = 0.051;
float cWN = 1.250;
WDM = 1 - (log(cWF * cWN/WDM - cWF));
}
//Weapon Depth Profile Eighteen
if (Weapon_Depth_Map == 22)
{
Adj = 0;
Per = 0.580;
float cWF = -0.005;
float cWN = 1.5;
WDM = 1 - (log(cWN * WDM)/ 1 - log(cWF+WDM));
}
//Weapon Depth Profile Nineteen
if (Weapon_Depth_Map == 23)
{
Adj = 0.0001;
Per = 5;
float cWF = 0.025;
float cWN = 1.001;
WDM = 1 - (log(cWF * cWN/WDM - cWF));
}
//Weapon Depth Profile Twenty
if (Weapon_Depth_Map == 24)
{
Adj = 0.0001;
Per = 5;
float cWF = 0.035;
float cWN = 1.001;
WDM = 1 - (log(cWF * cWN/WDM - cWF));
}
//Weapon Depth Profile Twenty One
if (Weapon_Depth_Map == 25)
{
Adj = 0.000010;
Per = 5;
float cWF = -0.4;
float cWN = 0.375;
WDM = 1 - (log(cWN * WDM)/ 1 - log(cWF+WDM));
}
//Weapon Depth Profile Twenty Two
if (Weapon_Depth_Map == 26)
{
Adj = 0.102000;
Per = 3.650000;
float cWF = 0.001300;
float cWN = 50.000000;
WDM = 1 - (log(cWF * cWN/WDM - cWF));
}
//Weapon Depth Map Twenty Three
if (Weapon_Depth_Map == 27)
{
Adj = 0.00000001;
Per = 0.6;//0.675
float cWF = 4.925;//10
float cWN = 0.0075;//0.0085
WDM = (log(cWF / cWN*WDM - cWF));
}
float NearDepth;
if (Weapon_Depth_Map == 27 || Weapon_Depth_Map == 23 || Weapon_Depth_Map == 20 || Weapon_Depth_Map == 19 || Weapon_Depth_Map == 13 || Weapon_Depth_Map == 8)
{
NearDepth = step(depthM.r,Adj/100000);
}
else
{
NearDepth = step(depthM.r,Adj);
}
if(Depth_Map_Enhancement == 0)
{
if (Weapon_Depth_Map <= 0)
{
D = depthM;
}
else
{
D = lerp(depthM,WDM%Per,NearDepth);
}
}
else
{
if (Weapon_Depth_Map <= 0)
{
float A = Adjust;
float cDF = 1.025;
float cDN = 0;
depthMFar = pow(abs((exp(depthM * log(cDF + cDN)) - cDN) / cDF),1000);
D = lerp(depthMFar,depthM,A);
}
else
{
float A = Adjust;
float cDF = 1.025;
float cDN = 0;
depthMFar = pow(abs((exp(depthM * log(cDF + cDN)) - cDN) / cDF),1000);
D = lerp(lerp(depthMFar,depthM,A),WDM%Per,NearDepth);
}
}
color.rgb = min(Depth_Limit,D.rrr);
return color;
}
void PS_calcLR(in float4 position : SV_Position, in float2 texcoord : TEXCOORD0, out float4 colorR : SV_Target0, out float4 colorL : SV_Target1)
{
colorL = texcoord.x+Depth*pix.x*DepthMap(float2(texcoord.x,texcoord.y));
colorR = texcoord.x-Depth*pix.x*DepthMap(float2(texcoord.x,texcoord.y));
}
/////////////////////////////////////////L/R//////////////////////////////////////////////////////////////////////
float4 L(float2 texcoord)
{
float4 color;
//Workaround for DX9 Games
int x = 5;
if (Depth == 0)
x = 0;
else if (Depth == 1)
x = 1;
else if (Depth == 2)
x = 2;
else if (Depth == 3)
x = 3;
else if (Depth == 4)
x = 4;
else if (Depth == 5)
x = 5;
else if (Depth == 6)
x = 6;
else if (Depth == 7)
x = 7;
else if (Depth == 8)
x = 8;
else if (Depth == 9)
x = 9;
else if (Depth == 10)
x = 10;
else if (Depth == 11)
x = 11;
else if (Depth == 12)
x = 12;
else if (Depth == 13)
x = 13;
else if (Depth == 14)
x = 14;
else if (Depth == 15)
x = 15;
else if (Depth == 16)
x = 16;
else if (Depth == 17)
x = 17;
else if (Depth == 18)
x = 18;
else if (Depth == 19)
x = 19;
else if (Depth == 20)
x = 20;
else if (Depth == 21)
x = 21;
else if (Depth == 22)
x = 22;
else if (Depth == 23)
x = 23;
else if (Depth == 24)
x = 24;
else if (Depth == 25)
x = 25;
else if (Depth == 26)
x = 26;
else if (Depth == 27)
x = 27;
else if (Depth == 28)
x = 28;
else if (Depth == 29)
x = 29;
else if (Depth == 30)
x = 30;
//Workaround for DX9 Games
//Left
color.rgb = tex2D(BackBuffer, float2(texcoord.x, texcoord.y)).rgb;
[unroll]
for (int i = 0; i <= x; i++)
{
if (tex2D(SamplerL, float2(texcoord.x+i*pix.x,texcoord.y)).r <= texcoord.x)
{
color = tex2D(BackBuffer, float2(texcoord.x+i*pix.x,texcoord.y));
}
}
return color;
}
float4 R(float2 texcoord)