devonium / EGSM

SHADERS FOR EVERYONE!!!! i have no idea wtf is going on
88 stars 3 forks source link

where do i put the lua file #5

Closed ttmso closed 1 year ago

ttmso commented 1 year ago

so i made the vmt but idk where to put the lua file, in autorun/client?

ttmso commented 1 year ago

yeah image image

ttmso commented 1 year ago

i have both the menu.lua thing and the bin file

ttmso commented 1 year ago

oh shit, im a idiot image

ttmso commented 1 year ago

oh no, oh no not you again https://user-images.githubusercontent.com/93525030/223705010-045626dd-23b7-4397-b5ae-9dfbe0de4c34.mp4

ttmso commented 1 year ago

so i got rid of all the addons and checked the verify integrity of game files, and still doesn't work...

devonium commented 1 year ago

i don't have a way to reproduce, so i've no idea what could cause it

ttmso commented 1 year ago

ok ):

ttmso commented 1 year ago

so i factory reset gmod and now it works (: and i made this: image

ttmso commented 1 year ago

i just copied the soble shader and then changed some shit and boom, code:

shaderlib.CompileVertexShader("SobelOperatorVertexShader", 0, [==[

include "common_vs_fxc.h"

struct VS_INPUT { float4 vPos : POSITION; };

struct VS_OUTPUT { float4 projPosSetup : POSITION; };

VS_OUTPUT main( const VS_INPUT v ) { VS_OUTPUT o = (VS_OUTPUT)0;

float4 vProjPos = mul(  v.vPos, cViewProj );
vProjPos.z = dot( v.vPos, cViewProjZ );
o.projPosSetup = vProjPos;
return o;

}

]==])

shaderlib.CompilePixelShader("SobelOperatorPixelShader", 0, [==[

sampler FrameBuffer : register(s0); float3 SBColor : register(c0);

struct PS_IN { float2 P : VPOS; };

float4 main(PS_IN i ) : COLOR { float4 pixel = tex2D(FrameBuffer, i.P/float2(1920, 1080)); // float4 pixel = PARAM_COLOR

// float4 color = pixel/sin(i.P.x/100);
float4 color = float4(1-pixel.x, 1-pixel.y, 1-pixel.z, 1);

return color;

};

]==])

ttmso commented 1 year ago

also im wondering if you can make it so a time var is in it, i want to make a procedural pulse effect

ttmso commented 1 year ago

also the sun is a black hole wtf image

ttmso commented 1 year ago

lol villager hmmm image

ttmso commented 1 year ago

code:

if !EGSM or !(EGSM.Version > 0) then return end -- DON'T FORGET TO CHECK
local function CompileShaders()
shaderlib.CompileVertexShader("SobelOperatorVertexShader", 0, [==[
#include "common_vs_fxc.h"

struct VS_INPUT
{
    float4 vPos                 : POSITION;
};

struct VS_OUTPUT
{
    float4 projPosSetup : POSITION;
};

VS_OUTPUT main( const VS_INPUT v )
{
    VS_OUTPUT o = (VS_OUTPUT)0;

    float4 vProjPos = mul(  v.vPos, cViewProj );
    vProjPos.z = dot( v.vPos, cViewProjZ );
    o.projPosSetup = vProjPos;
    return o;
}

]==])

shaderlib.CompilePixelShader("SobelOperatorPixelShader", 0, [==[

sampler FrameBuffer : register(s0);
float3  SBColor : register(c0);

struct PS_IN
{
    float2 P            : VPOS;
};

float4 main(PS_IN i ) : COLOR
{
    float4 pixel = tex2D(FrameBuffer, (i.P+float2(sin((i.P.x/16))*16, sin((i.P.y/16))*16))/float2(SCR_W, SCR_H));

    float4 color = pixel/float4(1, 1.25, 1.25, 1);

    return color;
};

]==])

end
CompileShaders()

local shader = shaderlib.NewShader("SobelOperator")

shader:SetPixelShader("SobelOperatorPixelShader")
shader:SetVertexShader("SobelOperatorVertexShader")

shader:BindTexture(0, PARAM_BASETEXTURE)

local SBColor = shader:AddParam("$SBColor", SHADER_PARAM_TYPE_COLOR)
shader:SetPixelShaderConstantFP(0, SBColor)

local mat = Material("lucman/test_shader")
local screentexture = render.GetScreenEffectTexture()

hook.Add("RenderScreenspaceEffects", "SobelOperator", function()
    render.UpdateScreenEffectTexture()
    render.CopyRenderTargetToTexture(screentexture)
    render.SetMaterial(mat)
    render.DrawScreenQuad()
end )

hook.Add("RecompileShaders", shader:GetName(), CompileShaders)
ttmso commented 1 year ago

omg steve is dead image

devonium commented 1 year ago

also im wondering if you can make it so a time var is in it, i want to make a procedural pulse effect

shader:SetPixelShaderStandardConstant(index, STDCONST_CURTIME)
ttmso commented 1 year ago

nice

ttmso commented 1 year ago

is there a depth buffer too?

ttmso commented 1 year ago

oh good idea: make a discord server where people can show what they made and ask how to do things like me

devonium commented 1 year ago

is there a depth buffer too?

_rt_ResolvedFullFrameDepth

oh good idea: make a discord server where people can show what they made and ask how to do things like me

https://discord.gg/X2Ay3cgW8T