[Fallout 4] kingeric's toolset

share shaders here
Post Reply
  • Author
  • Message
Offline
*blah-blah-blah maniac*
Posts: 565
Joined: 05 Apr 2014, 10:29
Location: Taiwan

[Fallout 4] kingeric's toolset

Some tools that might be useful when creating presets or shaders.

Implementation instructions are in the files.

1. Magnifying glass:
Opens a magnifying window where mouse is or fixed position with different size and scale.

Code: Select all

 * Settings:
 *
 * magnify_enable:        Opens magnifying window.
 * magnify_fixedwindow:   Fix window position.
 * magnify_fixedcursor:   Fix cursor position.
 * magnify_windowpos:     window position.
 * magnify_cursorpos:     cursor position.
 * magnify_windowsize:    Size of the magnifying window in screen scale.
 * magnify_Scale:         Magnifying scale.
Image
enbmagnify.fx
update. Dec/9/2015 fixed
(4.36 KiB) Downloaded 453 times
2. Bicubic Filtering:
http://pastebin.com/raw/RTKzjtsu

Code: Select all

//sample usage:
//      float4 filteredcolor = BicubicFilter(TextureColor, Sampler1, coord, float2(srcsize));
// **Sampler1 is linear sampler.
Left: Bilinear, Right: Bicubic x2 upscale, x8 enlarge
ImageImage

3. FPS History:
A debug UI hud/function to show FPS history.
enbFPShistory.fx
update. Jan/22/2016
(3.68 KiB) Downloaded 460 times

Code: Select all

 * Settings:
 *      Debug::FPS TimeScale (second):   set history range (x axis)
 *      Debug::FPS LineWidth:   set Line width.
implement detail in the file.
Image

4. 10bit-float3 packing/unpacking:
Use 2 16bit-floats to store 3 10bit-floats.

Code: Select all

//packing float3 into f16 x2
float2 pack10F(float3 v) {
    uint3 u16 = f32tof16(abs(v));

    //replace lower 5 bit.
    u16.x = (u16.x & 0x7FE0) | (( u16.z & 0x7C00) >> 10); // .x: (bit10 e0) | (bit5 m0) | (bit0 e2) 
    u16.y = (u16.y & 0x7FE0) | (( u16.z & 0x03E0) >> 5 ); // .y: (bit10 e1) | (bit5 m1) | (bit0 m2)

    return f16tof32(u16.xy);
}

// unpack 3 10bit floats from 2 16bit floats
float3 unpack10F(float2 v) {
    uint3 u16;
    u16.xy = f32tof16(abs(v));
    u16.z  = ((u16.x & 0x1F) << 10) | ((u16.y & 0x1F) << 5);
    return max(0, f16tof32(u16 & 0x7FE0));
}

//sample usage:

// the first pass write to RGBA16F rendertarget.
    float4 PS_pass0(float4 pos: SV_POSITION, float4 txcoord: TEXCOORD0) : SV_Target {

        //negative val not supported.
        float3 c = { 0.1, 0.22, 0.333};
        float3 w = {10.6, 1.22, 0.003};

        return float4( pack10F(c),  pack10F(w)); 
    }

// second pass retrieve data from RGBA16F texture
    float4 PS_pass1(float4 pos: SV_POSITION, float4 txcoord: TEXCOORD0) : SV_Target {

        // WARNING!
        //     Interpolation will disrupt the retrieved data.
        //     Use point sampler or texObj.Load() only.
        float4 data = TexRGBA16F.Sample(samplerPoint, txcoord.xy); 

        float3 c = unpack10F(data.xy);
        float3 w = unpack10F(data.zw);

        return c * w;
    }
Last edited by kingeric1992 on 09 Oct 2018, 06:13, edited 13 times in total.
_________________
Intel Xeon L5639 6C12T @3.96GHz | Gigabyte ga-x58a-ud3r | MSI GTX680 4G | 48G RAM | Intel 760p Nvme w clover bootloader
Flickr
YouTube

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

Re: [Fallout 4] kingeric's debugging toolset

file update:
use PASSNAME as technique name. Enables fast implementation with #define PASSNAME prior to including the effect file.

hotfix:
sorry guys, wrong file...fixed now.

hotfix again:
Oops, wrong date, fixed now. no need to redownload.
Last edited by kingeric1992 on 09 Dec 2015, 12:45, edited 3 times in total.
_________________
Intel Xeon L5639 6C12T @3.96GHz | Gigabyte ga-x58a-ud3r | MSI GTX680 4G | 48G RAM | Intel 760p Nvme w clover bootloader
Flickr
YouTube

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

Re: [Fallout 4] kingeric's toolset

post update:
add bicubic filtering function
_________________
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
*sensei*
Posts: 341
Joined: 27 Dec 2011, 21:33
Location: Poland, Gdańsk

Re: [Fallout 4] kingeric's toolset

Could the bicubic filtering be used for blurring bloom output, instead of using the performance lowering "scale" parameter?
_________________
OS: Windows 10
CPU: AMD R5 3600
RAM: Corsair DDR4 16GB 3200MHz Vengeance
GPU: AMD Radeon 5700 XT
Sound Card: X-FI Titanium HD
Mobo: ASRock X370 Pro4
Monitor: M340CLZ 34" 3440x1440 100HZ AMD FREE Sync Curved Monitor

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

Re: [Fallout 4] kingeric's toolset

what do you mean by blurring bloom output?

bicubic filter is superior in up scaling in large magnitude, like when blending 1024*1024 bloom to 1920*1080 or even 4k resolution, or up scaling other deferred rendered post-process.
in that case, it could come in handy when mixing bloom texture from different scale (less aliasing?), but I'm not sure how it compares to scale parameter in bloom.
_________________
Intel Xeon L5639 6C12T @3.96GHz | Gigabyte ga-x58a-ud3r | MSI GTX680 4G | 48G RAM | Intel 760p Nvme w clover bootloader
Flickr
YouTube

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

Re: [Fallout 4] kingeric's toolset

post update:
add FPS history hud
_________________
Intel Xeon L5639 6C12T @3.96GHz | Gigabyte ga-x58a-ud3r | MSI GTX680 4G | 48G RAM | Intel 760p Nvme w clover bootloader
Flickr
YouTube

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

Re: [Fallout 4] kingeric's toolset

post update:
adding 10bit-float3 packing/unpacking function,
which packs/unpacks 3 10bit-floats into/from 2 16bit-floats.
_________________
Intel Xeon L5639 6C12T @3.96GHz | Gigabyte ga-x58a-ud3r | MSI GTX680 4G | 48G RAM | Intel 760p Nvme w clover bootloader
Flickr
YouTube
Post Reply