• Custom Shaders?
    15 replies, posted
Sorry for the huge amount of questions regarding obscure area's of the source engine, but, with the advent of the sobel post processing shader it got me wondering, why aren't any of us writing cool shaders? Is it even possible for us (the gmod community) to add custom shaders to the engine? I found some pretty comprehensive tutorials on adding shaders to source but i'm wondering if they're applicable to Gmod? [url]http://www.moddb.com/engines/source/tutorials/source-shaders-tutorial[/url] from what i do understand, per-pixel effects should be quite easy to do, but what about per object, vertex shaders, anyone have any knowledge on the subject? I could find some good uses for geometry deformation, and a NPR cross thatch shader would be cool.
[QUOTE=iRzilla;19573538]Possible with a binary module, but you don't want to use them for such a large part of your game do you? Considering you can't send them..[/QUOTE] Not really no, they're purely visual anyway. I just thought it'd be really cool if we could write shaders for gmod.
You can write your own shaders for Garry's Mod, but people will have to manually download them.
[QUOTE=iRzilla;19573679]I already said that 10 mins ago >:|[/QUOTE] You said using a binary module, which is wrong.
[QUOTE=foszor;19573698]You said using a binary module, which is wrong.[/QUOTE] Then how do you do it?
All I did was send garry the sobel shader code and he was kind enough to add it. So just write and test your shader then send him the shader source and the interfacing code for it. Per object shaders are trickier. You have to enable the skinning shader combo and SkinPositionAndNormal(). [cpp]// DYNAMIC: "SKINNING" "0..1" #include "common_vs_fxc.h" static const bool g_bSkinning = SKINNING ? true : false;[/cpp] [cpp]float4 vPosition = input.Position; float3 vNormal = input.vNormal; // morph ApplyMorph( input.vPosFlex, input.vNormalFlex, vPosition.xyz, vNormal ); // Perform skinning float3 worldNormal, worldPos; SkinPositionAndNormal( g_bSkinning, vPosition, vNormal, input.vBoneWeights, input.vBoneIndices, worldPos, worldNormal ); worldNormal = normalize( worldNormal ); [/cpp]
Jinto i don't suppose i could pester to you for the source code, as an example on how to integrate it into gmod?
[QUOTE=foszor;19573698]You said using a binary module, which is wrong.[/QUOTE] Have you actually made one for source? It requires some C++ code.
[QUOTE=haza55;19599379]Have you actually made one for source? It requires some C++ code.[/QUOTE] He is not wrong, by binary module he means the interface garry setup for extending lua. Shaders require interfacing code, but the two are very different.
[QUOTE=Jinto;19599604]He is not wrong, by binary module he means the interface garry setup for extending lua. Shaders require interfacing code, but the two are very different.[/QUOTE] But you could load a shader using a lua module. Get the right engine interfaces and you can do almost anything.
Someone should make a Convolve Matrix filter shader for gmod. I don't know if it's possible in realtime without serve lag though.
[QUOTE=CapsAdmin;19610549]Someone should make a Convolve Matrix filter shader for gmod. I don't know if it's possible in realtime without serve lag though.[/QUOTE] That would be awesome.
[QUOTE=Jinto;19599604]He is not wrong, by binary module he means the interface garry setup for extending lua. Shaders require interfacing code, but the two are very different.[/QUOTE] Could you point us in the right direction for the interfacing code? [editline]01:52PM[/editline] Just there really is a huge lack of information documenting these kinda things.
Sorry, you need to Log In to post a reply to this thread.