GOSUKE FACTORY

何かの記録

2020/09/03 - 
GTA5


 YAMAHA VMAX できました。今回は改造パーツはありませんが、ペイントは可能です。

YAMAHA VMAX


2020/08/08 - 
その他
 UIDetect はとても便利なシェーダーですが、適用できるマスクが3つまでと少ない。そこで、もっと適用できるマスクを増やして使えるように改造をしてみました。10個以上使えるようにすると不具合が起きてしまい、それを修正する事ができなかったので、適用できるマスクは9個までです。改造するのはUIDetect.fxの方で、変更内容は以下の通り。

38行目あたりにある下記の個所を
#if (UIDetect_USE_RGB_MASK == 1)
    texture texUIDetectMask <source="UIDetectMaskRGB.png";>
    { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format=RGBA8; };
    sampler UIDetectMask { Texture = texUIDetectMask; };
#endif

以下の様に変更する。
#if (UIDetect_USE_RGB_MASK == 1)
    texture texUIDetectMask_1 <source="UIDetectMaskRGB.png";>
    { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format=RGBA8; };
    sampler UIDetectMask_1 { Texture = texUIDetectMask_1; };

    texture texUIDetectMask_2 <source="UIDetectMaskRGB_2.png";>
    { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format=RGBA8; };
    sampler UIDetectMask_2 { Texture = texUIDetectMask_2; };

    texture texUIDetectMask_3 <source="UIDetectMaskRGB_3.png";>
    { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format=RGBA8; };
    sampler UIDetectMask_3 { Texture = texUIDetectMask_3; };

#endif


98行目あたりにある下記の個所を
    #if (UIDetect_USE_RGB_MASK == 1)
        float3 uiMaskRGB = 1 - tex2D(UIDetectMask, texcoord).rgb;
        float3 uiMask = 0;

        if      (ui > .39) uiMask = 1;            //UI-Nr >3 -> apply no mask
        else if (ui > .29) uiMask = uiMaskRGB.b;  //UI-Nr  3 -> apply masklayer blue
        else if (ui > .19) uiMask = uiMaskRGB.g;  //UI-Nr  2 -> apply masklayer green
        else if (ui > .09) uiMask = uiMaskRGB.r;  //UI-Nr  1 -> apply masklayer red
        color = lerp(color, colorOrig, uiMask);
    #else

以下の様に変更する。
    #if (UIDetect_USE_RGB_MASK == 1)

        float3 uiMaskRGB;	

             if (ui > .69) uiMaskRGB = 1 - tex2D(UIDetectMask_3, texcoord).rgb;
        else if (ui > .39) uiMaskRGB = 1 - tex2D(UIDetectMask_2, texcoord).rgb;
        else if (ui > .09) uiMaskRGB = 1 - tex2D(UIDetectMask_1, texcoord).rgb;

        float3 uiMask = 0;

			 if  (ui > .99) uiMask = 1;            //UI-Nr >9 -> apply no mask
        else if (ui > .89) uiMask = uiMaskRGB.b;  //UI-Nr  9 -> apply masklayer blue
        else if (ui > .79) uiMask = uiMaskRGB.g;  //UI-Nr  8 -> apply masklayer green
        else if (ui > .69) uiMask = uiMaskRGB.r;  //UI-Nr  7 -> apply masklayer red

        else if (ui > .59) uiMask = uiMaskRGB.b;  //UI-Nr  6 -> apply masklayer blue
        else if (ui > .49) uiMask = uiMaskRGB.g;  //UI-Nr  5 -> apply masklayer green
        else if (ui > .39) uiMask = uiMaskRGB.r;  //UI-Nr  4 -> apply masklayer red

        else if (ui > .29) uiMask = uiMaskRGB.b;  //UI-Nr  3 -> apply masklayer blue
        else if (ui > .19) uiMask = uiMaskRGB.g;  //UI-Nr  2 -> apply masklayer green
        else if (ui > .09) uiMask = uiMaskRGB.r;  //UI-Nr  1 -> apply masklayer red


        
        color = lerp(color, colorOrig, uiMask);
      
    #else


全文
変更前
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// UIDetect by brussell
// v. 2.0
// License: CC BY 4.0
//
// UIDetect is configured via the file UIDectect.fxh. Please look
// there for a full description and usage of this shader.
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#include "ReShadeUI.fxh"

uniform float fPixelPosX < __UNIFORM_SLIDER_FLOAT1
    ui_label = "Pixel X-Position";
    ui_category = "Show Pixel";
    ui_min = 0; ui_max = BUFFER_WIDTH;
    ui_step = 1;
> = 100;

uniform float fPixelPosY < __UNIFORM_SLIDER_FLOAT1
    ui_label = "Pixel Y-Position";
    ui_category = "Show Pixel";
    ui_min = 0; ui_max = BUFFER_HEIGHT;
    ui_step = 1;
> = 100;

#include "ReShade.fxh"
#include "UIDetect.fxh"

#define epsilon 0.00001

//textures and samplers
texture texColorOrig { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; };
sampler ColorOrig { Texture = texColorOrig; };

texture texUIDetect { Width = 1; Height = 1; Format = R8; };
sampler UIDetect { Texture = texUIDetect; };

#if (UIDetect_USE_RGB_MASK == 1)
    texture texUIDetectMask <source="UIDetectMaskRGB.png";>
    { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format=RGBA8; };
    sampler UIDetectMask { Texture = texUIDetectMask; };
#endif

//pixel shaders
float3 PS_ShowPixel(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
    float2 pixelCoord = float2(fPixelPosX, fPixelPosY) * BUFFER_PIXEL_SIZE;
    float3 pixelColor = tex2Dlod(ReShade::BackBuffer, float4(pixelCoord, 0, 0)).xyz;
    return pixelColor;
}

float PS_UIDetect(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
    float3 pixelColor, uiPixelColor;
    float2 pixelCoord;
    float diff;
    float ui = 1;
    bool uiDetected = false;
    bool uiNext = false;

    for (int i=0; i < PIXELNUMBER; i++)
    {
        [branch]
        if (UIPixelCoord_UINr[i].z - ui < epsilon){
            if (uiNext == false){
                pixelCoord = UIPixelCoord_UINr[i].xy * BUFFER_PIXEL_SIZE;
                pixelColor = round(tex2Dlod(ReShade::BackBuffer, float4(pixelCoord, 0, 0)).rgb * 255);
                uiPixelColor = UIPixelRGB[i].rgb;
                diff = abs(dot(pixelColor - uiPixelColor, 0.333));
                if (diff < epsilon) {
                    uiDetected = true;
                }else{
                    uiDetected = false;
                    uiNext = true;
                }
            }
        }else{
            if (uiDetected == true){ return ui * 0.1; }
            ui += 1;
            uiNext = false;
            i -= 1;
        }
    }
    return uiDetected * ui * 0.1;
}

float4 PS_StoreColor(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
    return tex2D(ReShade::BackBuffer, texcoord);
}

float4 PS_RestoreColor(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
    float ui = tex2D(UIDetect, float2(0,0)).x;
    float4 colorOrig = tex2D(ColorOrig, texcoord);
    float4 color = tex2D(ReShade::BackBuffer, texcoord);
    
    #if (UIDetect_USE_RGB_MASK == 1)
        float3 uiMaskRGB = 1 - tex2D(UIDetectMask, texcoord).rgb;
        float3 uiMask = 0;

        if      (ui > .39) uiMask = 1;            //UI-Nr >3 -> apply no mask
        else if (ui > .29) uiMask = uiMaskRGB.b;  //UI-Nr  3 -> apply masklayer blue
        else if (ui > .19) uiMask = uiMaskRGB.g;  //UI-Nr  2 -> apply masklayer green
        else if (ui > .09) uiMask = uiMaskRGB.r;  //UI-Nr  1 -> apply masklayer red
        color = lerp(color, colorOrig, uiMask);
    #else
        color = ui > epsilon ? colorOrig : color;
    #endif
    return color;
}

//techniques
technique UIDetect_ShowPixel
{
    pass {
        VertexShader = PostProcessVS;
        PixelShader = PS_ShowPixel;
    }
}

technique UIDetect
{
    pass {
        VertexShader = PostProcessVS;
        PixelShader = PS_UIDetect;
        RenderTarget = texUIDetect;
    }
}

technique UIDetect_Before
{
    pass {
        VertexShader = PostProcessVS;
        PixelShader = PS_StoreColor;
        RenderTarget = texColorOrig;
    }
}

technique UIDetect_After
{
    pass {
        VertexShader = PostProcessVS;
        PixelShader = PS_RestoreColor;
    }
}

変更後
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// UIDetect by brussell
// v. 2.0
// License: CC BY 4.0
//
// UIDetect is configured via the file UIDectect.fxh. Please look
// there for a full description and usage of this shader.
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#include "ReShadeUI.fxh"

uniform float fPixelPosX < __UNIFORM_SLIDER_FLOAT1
    ui_label = "Pixel X-Position";
    ui_category = "Show Pixel";
    ui_min = 0; ui_max = BUFFER_WIDTH;
    ui_step = 1;
> = 100;

uniform float fPixelPosY < __UNIFORM_SLIDER_FLOAT1
    ui_label = "Pixel Y-Position";
    ui_category = "Show Pixel";
    ui_min = 0; ui_max = BUFFER_HEIGHT;
    ui_step = 1;
> = 100;

#include "ReShade.fxh"
#include "UIDetect.fxh"

#define epsilon 0.00001

//textures and samplers
texture texColorOrig { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; };
sampler ColorOrig { Texture = texColorOrig; };

texture texUIDetect { Width = 1; Height = 1; Format = R8; };
sampler UIDetect { Texture = texUIDetect; };

#if (UIDetect_USE_RGB_MASK == 1)
    texture texUIDetectMask_1 <source="UIDetectMaskRGB.png";>
    { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format=RGBA8; };
    sampler UIDetectMask_1 { Texture = texUIDetectMask_1; };

    texture texUIDetectMask_2 <source="UIDetectMaskRGB_2.png";>
    { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format=RGBA8; };
    sampler UIDetectMask_2 { Texture = texUIDetectMask_2; };

    texture texUIDetectMask_3 <source="UIDetectMaskRGB_3.png";>
    { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format=RGBA8; };
    sampler UIDetectMask_3 { Texture = texUIDetectMask_3; };

#endif

//pixel shaders
float3 PS_ShowPixel(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
    float2 pixelCoord = float2(fPixelPosX, fPixelPosY) * BUFFER_PIXEL_SIZE;
    float3 pixelColor = tex2Dlod(ReShade::BackBuffer, float4(pixelCoord, 0, 0)).xyz;
    return pixelColor;
}

float PS_UIDetect(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
    float3 pixelColor, uiPixelColor;
    float2 pixelCoord;
    float diff;
    float ui = 1;
    bool uiDetected = false;
    bool uiNext = false;

    for (int i=0; i < PIXELNUMBER; i++)
    {
        [branch]
        if (UIPixelCoord_UINr[i].z - ui < epsilon){
            if (uiNext == false){
                pixelCoord = UIPixelCoord_UINr[i].xy * BUFFER_PIXEL_SIZE;
                pixelColor = round(tex2Dlod(ReShade::BackBuffer, float4(pixelCoord, 0, 0)).rgb * 255);
                uiPixelColor = UIPixelRGB[i].rgb;
                diff = abs(dot(pixelColor - uiPixelColor, 0.333));
                if (diff < epsilon) {
                    uiDetected = true;
                }else{
                    uiDetected = false;
                    uiNext = true;
                }
            }
        }else{
            if (uiDetected == true){ return ui * 0.1; }
            ui += 1;
            uiNext = false;
            i -= 1;
        }
    }
    return uiDetected * ui * 0.1;
}

float4 PS_StoreColor(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
    return tex2D(ReShade::BackBuffer, texcoord);
}

float4 PS_RestoreColor(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
    float ui = tex2D(UIDetect, float2(0,0)).x;
    float4 colorOrig = tex2D(ColorOrig, texcoord);
    float4 color = tex2D(ReShade::BackBuffer, texcoord);
    
    #if (UIDetect_USE_RGB_MASK == 1)

        float3 uiMaskRGB;	

             if (ui > .69) uiMaskRGB = 1 - tex2D(UIDetectMask_3, texcoord).rgb;
        else if (ui > .39) uiMaskRGB = 1 - tex2D(UIDetectMask_2, texcoord).rgb;
        else if (ui > .09) uiMaskRGB = 1 - tex2D(UIDetectMask_1, texcoord).rgb;

        float3 uiMask = 0;

             if (ui > .99) uiMask = 1;            //UI-Nr >9 -> apply no mask
        else if (ui > .89) uiMask = uiMaskRGB.b;  //UI-Nr  9 -> apply masklayer blue
        else if (ui > .79) uiMask = uiMaskRGB.g;  //UI-Nr  8 -> apply masklayer green
        else if (ui > .69) uiMask = uiMaskRGB.r;  //UI-Nr  7 -> apply masklayer red

        else if (ui > .59) uiMask = uiMaskRGB.b;  //UI-Nr  6 -> apply masklayer blue
        else if (ui > .49) uiMask = uiMaskRGB.g;  //UI-Nr  5 -> apply masklayer green
        else if (ui > .39) uiMask = uiMaskRGB.r;  //UI-Nr  4 -> apply masklayer red

        else if (ui > .29) uiMask = uiMaskRGB.b;  //UI-Nr  3 -> apply masklayer blue
        else if (ui > .19) uiMask = uiMaskRGB.g;  //UI-Nr  2 -> apply masklayer green
        else if (ui > .09) uiMask = uiMaskRGB.r;  //UI-Nr  1 -> apply masklayer red


        
        color = lerp(color, colorOrig, uiMask);
      
    #else
        color = ui > epsilon ? colorOrig : color;
    #endif
    return color;
}

//techniques
technique UIDetect_ShowPixel
{
    pass {
        VertexShader = PostProcessVS;
        PixelShader = PS_ShowPixel;
    }
}

technique UIDetect
{
    pass {
        VertexShader = PostProcessVS;
        PixelShader = PS_UIDetect;
        RenderTarget = texUIDetect;
    }
}

technique UIDetect_Before
{
    pass {
        VertexShader = PostProcessVS;
        PixelShader = PS_StoreColor;
        RenderTarget = texColorOrig;
    }
}

technique UIDetect_After
{
    pass {
        VertexShader = PostProcessVS;
        PixelShader = PS_RestoreColor;
    }
}






 9個では足りなく、もっと適用できるマスクが欲しかったりマスクを重ねたい場合は、UIDetect.fx, UIDetect.fxhを複製して使用します。複製した方のUIDetect.fx#include "ReShadeUI.fxh"texColorOrigtexUIDetectが元のUIDetect.fxと被らないように適当に名前を変更してください。同様のシェーダーを重複してエフェクトをかけるのは無駄に負荷をかける気もしますが、このシェーダーは大した影響もなさそうなので、たぶん大丈夫、でしょう。

2020/08/05 - 
Blackthorn Arena
ReShade オフ

Blackthorn Arena
ReShade オン

Blackthorn Arena
ReShade オフ

Blackthorn Arena
ReShade オン

その他
  • 有効にした Shader
    • UIDetect
      •  指定した範囲内のシェーダーの効果を有効にしたり無効にしたり自動的な切り替えを可能にする。(例えば、UI などが DOF や AO の効果に影響されて UI を見辛くさせたくない時に使う。常時表示されている UI なら UIMask のシェーダーを使えばよいが、UI が表示された時だけ、その UI の個所に特定のシェーダーの効果を無効にしたい場合は、この UIDetect を使う。)
    • LiftGammaGain
      •  リフト(暗部)・ガンマ(中間)・ゲイン(ハイライト)の調整
    • DPX
      •  色調補正(RGB カーブ・コントラスト・色彩など)
    • Comic
      •  ポリゴンのエッジや色相・彩度が変化している個所に線を描画する。
    • PPFXSSDO
      •  SSDO の追加
    • qUINT_MXAO
      •  SSAO の追加

プリセット
PreprocessorDefinitions=SKETCH_SMOOTH_SAMPLES=1,fLUT_TileSizeXY=32,fLUT_TileAmount=32,UNSHARP_BLUR_SAMPLES=128,UIDetect_USE_RGB_MASK=1
Techniques=UIDetect,LiftGammaGain,DPX,UIDetect_Before,Comic,PPFXSSDO,MXAO,UIDetect_After
TechniqueSorting=UIDetect,LiftGammaGain,DPX,UIDetect_Before,Comic,Sketch,PPFXSSDO,MXAO,UIDetect_After,UIDetect_ShowPixel

[Comic.fx]
bUIChromaEdgesDebugLayer=1
bUIColorEdgesDebugLayer=1
bUIEnableDebugLayer=0
bUIMeshEdgesDebugLayer=1
bUIOutlinesDebugLayer=1
fUIChromaEdgesDetails=1.000000
fUIChromaEdgesDistanceFading=-1.000000,0.124000,0.800000
fUIChromaEdgesStrength=1.500000,1.000000
fUIColor=0.000000,0.000000,0.000000
fUIColorEdgesDetails=1.000000
fUIColorEdgesDistanceFading=-1.000000,0.124000,0.800000
fUIColorEdgesStrength=1.500000,1.000000
fUIEdgesLumaWeight=0.000000,1.000000,0.800000
fUIEdgesSaturationWeight=0.000000,1.000000,0.800000
fUIMeshEdgesDistanceFading=-1.000000,1.000000,1.000000
fUIMeshEdgesStrength=2.990000,0.750000
fUIOutlinesDistanceFading=-0.999000,1.000000,1.000000
fUIOutlinesStrength=1.000000,1.000000
fUIOutlinesThreshold=1.030000
fUIOverlayColor=1.000000,0.000000,0.000000
fUIStrength=0.800000
iUIChromaEdgesType=2
iUIColorEdgesType=2
iUIMeshEdgesEnable=1
iUIMeshEdgesIterations=1
iUIOutlinesEnable=0
iUIShowFadingOverlay=0

[DPX.fx]
Colorfulness=2.500000
Contrast=0.000000
RGB_C=0.360000,0.360000,0.340000
RGB_Curve=8.000000,8.000000,8.000000
Saturation=3.000000
Strength=0.305000

[LiftGammaGain.fx]
RGB_Gain=1.000000,1.000000,1.000000
RGB_Gamma=1.200009,1.200009,1.200009
RGB_Lift=1.000000,1.000000,1.000000

[PPFX_SSDO.fx]
pSSDOAmount=1.500000
pSSDOAngleThreshold=0.125000
pSSDOBounceLOD=2
pSSDOBounceMultiplier=0.800000
pSSDOBounceSaturation=1.000000
pSSDODebugMode=0
pSSDOFadeEnd=0.950000
pSSDOFadeStart=0.900000
pSSDOFilterRadius=8.000000
pSSDOIntensity=1.500000
pSSDOSampleAmount=10
pSSDOSampleRange=70.000000
pSSDOSourceLOD=1

[qUINT_mxao.fx]
MXAO_BLEND_TYPE=0
MXAO_DEBUG_VIEW_ENABLE=0
MXAO_FADE_DEPTH_END=0.400000
MXAO_FADE_DEPTH_START=0.050000
MXAO_GLOBAL_RENDER_SCALE=1.000000
MXAO_GLOBAL_SAMPLE_QUALITY_PRESET=2
MXAO_SAMPLE_NORMAL_BIAS=0.200000
MXAO_SAMPLE_RADIUS=2.500000
MXAO_SSAO_AMOUNT=1.000000

[UIDetect.fx]
fPixelPosX=1305.000000
fPixelPosY=1054.000000


2020/05/29 - 
GTA5
 LOD モデル全部完成。LOD1, LOD2, LOD3, LOD4 を格納するファイルを制限内のサイズに収める事ができました。時間がかかって面倒ではあったが、これをつくらないとゲーム内の動作が重くなってしまうからきちんとやらないとね。各モデルの三角ポリゴンの数は以下の通り。

LOD0 (Very Hi)  230773
LOD1 (Hi)       209390
LOD2 (Mid)      120756
LOD3 (Low)       13486
LOD4 (Very Low)   2667

 現状、yft のファイルサイズは 制限 16MB 以下の 15.1MB なので改造パーツの追加はできなくはないけど、特別つくりたいパーツもないから、今回は改造パーツはなしかな。あと残す作業は、3D モデルの最終チェックと handling.meta などの設定の調整作業で、これが終わればリリースとなる予定です。


2020/05/01 - 
GTA5
 マテリアルとテクスチャの設定ができた。次は、これをベースに LOD モデルの作成作業です。これまた、面倒な作業が続く。

 今回の VMAX は現在の三角ポリゴン数は 230000 あるので(前回に作成した XLCR は、ハイポリモデルで 130000)、いつもよりちゃんと LOD モデルをつくらないと駄目ですね。yft ファイルのサイズ制限が、16MBでしたっけ?そんなのがあったと思うので、LOD モデルの作成はいろいろと大変そうだ。現状のハイポリモデルで、yft のファイルサイズが 9.5MB あるからうまくやりくりして、Hi, Mid, Low, Very Low の4つのモデルをつくらないと、うまく格納することができなくなりそう。

2020/03/24 - 
GTA5
  • Red: 反射の強度
  • Green: 光沢の度合い
  • Blue: フレネルの強度(白→黒 強→弱)


最初前5 89・[10]・1112 次5最後


Youtube Twitter



 当サイトはPC版ゲームのMODを中心に取り扱うなか、私gosukeのたわ言をつらつらと記録しています。(MODとはModification、元のゲームに様々な要素を追加・改変する事で、オリジナルのゲームよりさらに楽しめる幅が広がります。)

 また、リンクフリーではありますが、ファイルへの直リンクは出来ればご遠慮お願い致します。バナーでリンクする場合は下にあるバナーを使用して下さい。

管理者:gosuke

banner

意見、要望、感想、叱咤、激励、などなどありましたら下の意見箱またはX(旧Twitter)にメッセージをどうぞ。
意見箱