ENB Diagnostics for Fallout 4

share shaders here
Post Reply
  • Author
  • Message
Offline
User avatar
*master*
Posts: 229
Joined: 21 Feb 2013, 03:21
Location: Los Angeles, CA

ENB Diagnostics for Fallout 4

Hi All,
This is a file that is similar to the Enhanced ENB Diagnostics that I created for Skyrim. New for the Fallout 4 version I am using the tempInfo1 shader variable now available in enbeffectpostpass.fx to draw info under the mouse pointer depending on the mouse buttons pressed. To use it, copy the included files to your game dir. Then, in game, change the technique from "DEFAULT" to "ENB Diagnostics Demo". You also need to turn on either or both of the "Display Image" and "Display Text" check boxes to see the effect. Then as the green instructions in the gui will show, you press the following mouse buttons to show the info:

Left - Original Color
Middle - Processed Color ( I include a simple color filter to show the difference between this and the original)
Right - Depth
Left and Right - Linearized depth

This probably only useful for modders that really need to know the actual values that are being input and calculated in shaders. Let me know what you think and if there are any suggestions or problems with it.

Enjoy! :D
Attachments
ENB_Diagnostics_FO4.7z
(17.73 KiB) Downloaded 98 times
_________________
i7-4970K 4.8ghz, 16gb ram, Geforce Titan X 12gb vram, win7

Offline
*blah-blah-blah maniac*
Posts: 565
Joined: 05 Apr 2014, 10:29
Location: Taiwan

Re: ENB Diagnostics for Fallout 4

cool! any screen shots?

Here is a alternative text display functions I built a while ago.
No difference in functionality, but it uses array input to access in replace of groups of float4, and #define to convert sample offset and skip the ascii conversions in between.


Complete header (originally for reshade, converted to ENB without test)

Code: Select all

#ifndef _DRAWTEXT_H_
#define _DRAWTEXT_H_
//created by kingeric1992

//settings
#define Text_SIZE   10              //String input array size
#define string(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) { Char_##a0, Char_##a1, Char_##a2, Char_##a3, Char_##a4, Char_##a5, Char_##a6, Char_##a7, Char_##a8, Char_##a9 }
//string array syntax for easy access, need to be same size as Text_SIZE

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                                  //
//  Available functions:                                                                                                            //
//      DrawText_String( offset, text size, xy ratio, input coord, string array)                                                    //
//          float2 offset       = top left corner of string, screen hight pixel unit.                                               //
//          float  text size    = text size, screen hight pixel unit.                                                               //
//          float  xy ratio     = xy ratio of text.                                                                                 //
//          float2 input coord  = current texture coord.                                                                            //
//          float2 string array = string data in float2 array format, ex: "DemoText b"                                              //
//              float2 Text_0[Text_SIZE] = { Char_D, Char_e, Char_m, Char_o, Char_T, Char_e, Char_x, Char_t, Char_Space, Char_b};   //
//      or      float2 Text_0[Text_SIZE] = string(D, e, m, o, T, e, x, t, Space, b);                                                //
//                                                                                                                                  //
//      DrawText_digit( offset, text size, xy ratio, input coord, precision after dot, data)                                        //
//          float2 offset       = same as DrawText_String.                                                                          //
//          float  text size    = same as DrawText_String.                                                                          //
//          float  xy ratio     = same as DrawText_String.                                                                          //
//          float2 input coord  = same as DrawText_String.                                                                          //
//          int    precision    = digits after dot.                                                                                 //
//          float  data         = input float.                                                                                      //
//                                                                                                                                  //
//      DrawText_Width(shift, text size, xy ratio)                                                                                  //
//          float shift         = shift width, character width unit.                                                                //
//          float text size     = same as DrawText_String.                                                                          //
//          float xy ratio      = same as DrawText_String.                                                                          //
//                                                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


//Sample Usage

/*
float4 PS_TestDemo(in float4 position : SV_Position, in float2 texcoord : TEXCOORD0) : SV_Target0
{
    float test = Float_Data;
    float2 Text_0[Text_SIZE] = string( D, e, m, o, T, e, x, t, Space, b);   //Test
    float2 Text_1[Text_SIZE] = { Char_y, Char_Colon, Char_K, Char_i, Char_n, Char_g, Char_E, Char_r, Char_i,     Char_c};   //Test

    float4 res  = DrawText_String(float2(0                                 , 800), 32, 5, texcoord.xy,  Text_0);
           res += DrawText_String(float2(DrawText_Width(10, 32, 5), 800), 32, 5, texcoord.xy,  Text_1);
           res += DrawText_Digit( float2(DrawText_Width(8,  32, 5), 832), 32, 5, texcoord.xy, 5, test);
    return res;
}
*/

//Text display
//Character indexing
#define Char_Space      float2( 0, 0) //  (space)
#define Char_Exclam     float2( 1, 0) //  !
#define Char_Quote      float2( 2, 0) //  "
#define Char_Pound      float2( 3, 0) //  #
#define Char_Dollar     float2( 4, 0) //  $
#define Char_Percent    float2( 5, 0) //  %
#define Char_And        float2( 6, 0) //  &
#define Char_sQuote     float2( 7, 0) //  '
#define Char_rBrac_O    float2( 8, 0) //  (
#define Char_rBrac_C    float2( 9, 0) //  )
#define Char_Asterisk   float2(10, 0) //  *
#define Char_Plus       float2(11, 0) //  +
#define Char_Comma      float2(12, 0) //  ,
#define Char_Minus      float2(13, 0) //  -

#define Char_Dot        float2( 0, 1) //  .
#define Char_Slash      float2( 1, 1) //  /
#define Char_0          float2( 2, 1) //  0
#define Char_1          float2( 3, 1) //  1
#define Char_2          float2( 4, 1) //  2
#define Char_3          float2( 5, 1) //  3
#define Char_4          float2( 6, 1) //  4
#define Char_5          float2( 7, 1) //  5
#define Char_6          float2( 8, 1) //  6
#define Char_7          float2( 9, 1) //  7
#define Char_8          float2(10, 1) //  8
#define Char_9          float2(11, 1) //  9
#define Char_Colon      float2(12, 1) //  :
#define Char_sColon     float2(13, 1) //  ;

#define Char_Less       float2( 0, 2) //  <
#define Char_Equals     float2( 1, 2) //  =
#define Char_Greater    float2( 2, 2) //  >
#define Char_Question   float2( 3, 2) //  ?
#define Char_at         float2( 4, 2) //  @
#define Char_A          float2( 5, 2) //  A
#define Char_B          float2( 6, 2) //  B
#define Char_C          float2( 7, 2) //  C
#define Char_D          float2( 8, 2) //  D
#define Char_E          float2( 9, 2) //  E
#define Char_F          float2(10, 2) //  F
#define Char_G          float2(11, 2) //  G
#define Char_H          float2(12, 2) //  H
#define Char_I          float2(13, 2) //  I

#define Char_J          float2( 0, 3) //  J
#define Char_K          float2( 1, 3) //  K
#define Char_L          float2( 2, 3) //  L
#define Char_M          float2( 3, 3) //  M
#define Char_N          float2( 4, 3) //  N
#define Char_O          float2( 5, 3) //  O
#define Char_P          float2( 6, 3) //  P
#define Char_Q          float2( 7, 3) //  Q
#define Char_R          float2( 8, 3) //  R
#define Char_S          float2( 9, 3) //  S
#define Char_T          float2(10, 3) //  T
#define Char_U          float2(11, 3) //  U
#define Char_V          float2(12, 3) //  V
#define Char_W          float2(13, 3) //  W

#define Char_X          float2( 0, 4) //  X
#define Char_Y          float2( 1, 4) //  Y
#define Char_Z          float2( 2, 4) //  Z
#define Char_sBrac_O    float2( 3, 4) //  [
#define Char_Backslash  float2( 4, 4) //  \..
#define Char_sBrac_C    float2( 5, 4) //  ]
#define Char_Caret      float2( 6, 4) //  ^
#define Char_Underscore float2( 7, 4) //  _
#define Char_Punc       float2( 8, 4) //  `
#define Char_a          float2( 9, 4) //  a
#define Char_b          float2(10, 4) //  b
#define Char_c          float2(11, 4) //  c
#define Char_d          float2(12, 4) //  d
#define Char_e          float2(13, 4) //  e

#define Char_f          float2( 0, 5) //  f
#define Char_g          float2( 1, 5) //  g
#define Char_h          float2( 2, 5) //  h
#define Char_i          float2( 3, 5) //  i
#define Char_j          float2( 4, 5) //  j
#define Char_k          float2( 5, 5) //  k
#define Char_l          float2( 6, 5) //  l
#define Char_m          float2( 7, 5) //  m
#define Char_n          float2( 8, 5) //  n
#define Char_o          float2( 9, 5) //  o
#define Char_p          float2(10, 5) //  p
#define Char_q          float2(11, 5) //  q
#define Char_r          float2(12, 5) //  r
#define Char_s          float2(13, 5) //  s

#define Char_t          float2( 0, 6) //  t
#define Char_u          float2( 1, 6) //  u
#define Char_v          float2( 2, 6) //  v
#define Char_w          float2( 3, 6) //  w
#define Char_x          float2( 4, 6) //  x
#define Char_y          float2( 5, 6) //  y
#define Char_z          float2( 6, 6) //  z
#define Char_cBrac_O    float2( 7, 6) //  {
#define Char_vBar       float2( 8, 6) //  |
#define Char_cBrac_C    float2( 9, 6) //  }
#define Char_Tilde      float2(10, 6) //  ~
#define Char_tridot     float2(11, 6) // (...)
#define Char_empty0     float2(12, 6) // (null)
#define Char_empty1     float2(13, 6) // (null)
//Character indexing ends

Texture2D Texttex
<
    string UIName = "Text texture";
    string ResourceName = "enbText.png";
>;

SamplerState Textsampler
{
    Filter   = MIN_MAG_MIP_LINEAR;
    AddressU = Clamp;
    AddressV = Clamp;
};

float DrawText_String( float2 pos, float size, float ratio, float2 tex, float2 r[Text_SIZE])
{
    float  text = 0;
    float2 uv = (tex * ScreenSize.x * ScreenSize.w - pos) / size;
    uv.y      = saturate(uv.y);
    uv.x     *= ratio * 0.5;
    if(uv.x  <= Text_SIZE && uv.x >= 0)
        text  = Texttex.Sample(Textsampler, (frac(uv) + r[floor(uv.x)]) * float2( 0.5, 1) / 7).x;
    return text;
}

float DrawText_Width( int count, float size, float ratio)
{
    return size * count * 2 / ratio;
}

float DrawText_Digit( float2 pos, float size, float ratio, float2 tex, int digit, float data)
{
    float2 digits[13] = {Char_0, Char_1, Char_2, Char_3, Char_4, Char_5, Char_6, Char_7, Char_8, Char_9, Char_Minus, Char_Space, Char_Dot};

    float  text = 0;
    float2 uv = (tex * ScreenSize.x * ScreenSize.w - pos) / size;
    uv.y      = saturate(uv.y);
    uv.x     *= ratio * 0.5;

    float  t  = abs(data);
    int radix = floor(log10(max(t, 0.00001)));
    radix     = (floor(t) == 0)? 0:radix;

    float index = pow(10, floor(-uv.x) + step(1, uv.x)); //current digit
    index       = floor(frac(t * 0.1 / index) * 10);
    index       = lerp(lerp(10, 11, step(0, data)), index, step(-radix-1, uv.x));
    index       = (uv.x > 0 && uv.x < 1)? 12:index;

    if(uv.x <= digit + 1 && uv.x >= -radix-2)
        text    = Texttex.Sample(Textsampler, (frac(uv) + digits[index]) * float2( 0.5, 1) / 7).x;
    return text;
}
#endif   // end of file
Image
_________________
Intel Xeon L5639 6C12T @3.96GHz | Gigabyte ga-x58a-ud3r | MSI GTX680 4G | 48G RAM | Intel 760p Nvme w clover bootloader
Flickr
YouTube

Offline
User avatar
*master*
Posts: 229
Joined: 21 Feb 2013, 03:21
Location: Los Angeles, CA

Re: ENB Diagnostics for Fallout 4

Wow, this is awesome code!

I love this:

Code: Select all

string(D, e, m, o, T, e, x, t, Space, b);
A much more elegant solution. Thanks for posting! I will use definitely use it as part of this tool when I have some time to convert it over.

Here are some screenshots:
Image
Image
Image
Image

You can turn off "Display Image" if you only want to see the values
Image
_________________
i7-4970K 4.8ghz, 16gb ram, Geforce Titan X 12gb vram, win7
Post Reply