Skip to content

Instantly share code, notes, and snippets.

View ufna's full-sized avatar
:octocat:
⊂(◉‿◉)つ

Vladimir Alyamkin ufna

:octocat:
⊂(◉‿◉)つ
View GitHub Profile
@ufna
ufna / shader.hlsl
Created September 16, 2022 10:16
Coastal Landscape Shadertoy UE4
// Author: bitless
// Title: Coastal Landscape
// Thanks to Patricio Gonzalez Vivo & Jen Lowe for "The Book of Shaders"
// and Fabrice Neyret (FabriceNeyret2) for https://shadertoyunofficial.wordpress.com/
// and Inigo Quilez (iq) for https://iquilezles.org/www/index.htm
// and whole Shadertoy community for inspiration.
#define p(t, a, b, c, d) ( a + b*cos( 6.28318*(c*t+d) ) ) //IQ's palette function (https://www.iquilezles.org/www/articles/palettes/palettes.htm)
#define sp(t) p(t,float3(.26,.76,.77),float3(1,.3,1),float3(.8,.4,.7),float3(0,.12,.54)) //sky palette
@ufna
ufna / BuildConfiguration.xml
Created July 28, 2022 12:30
Limit unreal engine build cores
<?xml version="1.0" encoding="utf-8"?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
<BuildConfiguration>
<MaxParallelActions>6</MaxParallelActions>
</BuildConfiguration>
</Configuration>
@ufna
ufna / MyWebSocketNetDriver.cpp
Created June 29, 2022 22:58
Emscripten -> Module control from c++
bool UMyWebSocketNetDriver::InitConnect(FNetworkNotify* InNotify, const FURL& ConnectURL, FString& Error)
{
const auto GameSettings = FMyGameModule::Get().GetGameSettings();
FString ConnectionURL = FString::Printf(TEXT("%s/%s:%i/"), *GameSettings->DefaultWebSocketServer, *ConnectURL.Host, ConnectURL.Port);
if (ConnectURL.Op.Num() > 0)
{
ConnectionURL += TEXT("?");
for (int32 i = 0; i < ConnectURL.Op.Num(); ++i)
{
@ufna
ufna / phantom_star.hlsl
Created December 21, 2021 12:14
Phantom Star for CineShader (UE4 version)
const MaterialFloat pi = acos(-1.0);
const MaterialFloat pi2 = pi*2.0;
struct Functions
{
float mod(float x, float y)
{
return x - y * floor(x/y);
}
@ufna
ufna / noncopyable.C
Created April 26, 2021 15:38 — forked from jwpeterson/noncopyable.C
Demonstrate usage of noncopyable class in std containers
// http://stackoverflow.com/questions/17603666/copy-move-requirements-for-the-key-value-types-in-a-stdmap
#include <map>
#include <vector>
struct foo
{
int i;
foo(int j) : i(j) {}
@ufna
ufna / PakBlacklist-Shipping.txt
Created June 15, 2020 11:56
Ignore engine files on Unreal Engine 4.24
../../../Engine/Content/EditorMeshes/
../../../Engine/Content/Functions/Engine_MaterialFunctions02/ExampleContent/
../../../Engine/Content/Maps/Templates
../../../Engine/Content/EngineDebugMaterials/LightingModels/
../../../Engine/Content/EngineDebugMaterials/BlackUnlitMaterial.uasset
../../../Engine/Content/EngineDebugMaterials/BoneWeightMaterial.uasset
../../../Engine/Content/EngineDebugMaterials/CASC_Cross.uasset
../../../Engine/Content/EngineDebugMaterials/CASC_None.uasset
../../../Engine/Content/EngineDebugMaterials/ClothMaterial.uasset
../../../Engine/Content/EngineDebugMaterials/ClothMaterial_WF.uasset
@ufna
ufna / clouds.hlsl
Last active July 22, 2022 03:30
Clouds by iq adoptation for Unreal Engine 4
float3 sundir = normalize( float3(-1.0,0.0,-1.0) );
struct Functions
{
float noise( in float3 x )
{
float3 p = floor(x);
float3 f = frac(x);
f = f*f*(3.0-2.0*f);
@ufna
ufna / variations.hlsl
Created January 24, 2020 05:57
Texture variation for unreal engine 4
#define USEHASH
struct Functions
{
float4 hash4( float2 p ) { return frac(sin(float4( 1.0+dot(p,float2(37.0,17.0)),
2.0+dot(p,float2(11.0,47.0)),
3.0+dot(p,float2(41.0,29.0)),
4.0+dot(p,float2(23.0,31.0))))*103.0); }
float4 textureNoTile(Texture2D iChannel0, SamplerState iChannel0Sampler, in float2 uv, Texture2D iChannel1, SamplerState iChannel1Sampler)
@ufna
ufna / kawase.hlsl
Created January 23, 2020 11:53
Kawase Blur HLSL function for UE4
float3 BlurColor = Texture2DSample(Tex, TexSampler, UV + float2(Shift, Shift) / Resolution);
BlurColor += Texture2DSample(Tex, TexSampler, UV + float2(Shift, -Shift) / Resolution);
BlurColor += Texture2DSample(Tex, TexSampler, UV + float2(-Shift, Shift) / Resolution);
BlurColor += Texture2DSample(Tex, TexSampler, UV + float2(-Shift, -Shift) / Resolution);
BlurColor /= 4.0;
return BlurColor;
@ufna
ufna / plexus.hlsl
Created January 21, 2020 12:36
Plexus Particles for Unreal Engine 4 (based on work of eclmist)
struct Functions
{
float distLine(float2 p, float2 a, float2 b) {
float2 ap = p - a;
float2 ab = b - a;
float aDotB = clamp(dot(ap, ab) / dot(ab, ab), 0.0, 1.0);
return length(ap - ab * aDotB);
}
float drawLine(float2 uv, float2 a, float2 b) {