Skip to content

Instantly share code, notes, and snippets.

View devshgraphicsprogramming's full-sized avatar

Mateusz Kielan devshgraphicsprogramming

View GitHub Profile
@devshgraphicsprogramming
devshgraphicsprogramming / raycastPlanetAtmosphere.glsl
Created February 15, 2018 16:01
Planet Atmosphere Intersection Shader Function
//!Warning does not model intersection with the Planet itself in the middle of the atmosphere
float calculateHazeFactor(in float fragDepth, in vec3 viewDir)
{
//hazeHeight and camPos are heights above sea level
bool aboveHaze = camPos>hazeHeight;
if (aboveHaze&&viewDir.y>=0.0)
return 1.0;
float planetRadius = 6357.0;
float hazeRadius = planetRadius+hazeHeight;
@devshgraphicsprogramming
devshgraphicsprogramming / SphericalHarmonicUtilMath.cpp
Created April 9, 2019 11:32
Spherical Harmonics WignerJ matrix for 3 SH function multiplications
///float tripleProductCoefficients[121][36][9];
///bool tripleProductCoefficientSparsityMask[121][121][121];
bool tripleProductCoefficientSparsityMask[121][36][9];
/**
void calculateTripleProductCoefficients()
{
float tripleComplexProductCoefficients[9][36][121];
memset(tripleComplexProductCoefficients,0,sizeof(float)*9*36*121);
@devshgraphicsprogramming
devshgraphicsprogramming / STDVectorCompatibileGPUMemAllocator.cpp
Created April 27, 2019 21:55
Garbage Collection, fencing, etc. Without Separate Memory Arenas [EARLY PROTOTYPE]
template <class T>
class STLCompatibleGPUAllocator : public irr::core::AllocatorTrivialBase<T>
{
public:
typedef size_t size_type;
typedef T* pointer;
template< class U> struct rebind { typedef STLCompatibleGPUAllocator<U> other; };
STLCompatibleGPUAllocator() {}
#version 430 core
layout (location = 0) out vec4 OutColor;
in vec3 WorldPos;
in vec2 TexCoords;
in vec3 Normal;
layout (location = 0) uniform vec3 uEmissive;
layout (location = 1) uniform vec3 uAlbedo;
#version 430 core
layout (location = 0) out vec4 OutColor;
in vec3 WorldPos;
in vec2 TexCoords;
in vec3 Normal;
layout (location = 0) uniform vec3 uEmissive;
layout (location = 1) uniform vec3 uAlbedo;
struct SphQuad {
vec2 lo,hi;
vec2 loSq,hiSq;
float z, zSq; //
float b0, b1, b0sq, k; // misc precomputed constants
float S; // solid angle of ’Q’
};
@devshgraphicsprogramming
devshgraphicsprogramming / balls.frag
Created November 19, 2020 17:43
Raytraced BALLS
#version 460
struct Sphere
{
vec3 position;
float radius2;
uint bsdfLightIDs;
};
struct Rectangle
@devshgraphicsprogramming
devshgraphicsprogramming / visibilityBufferShading.comp
Created May 8, 2021 12:21
Dump of a preprocessed shader from Nabla
#version 460 core
#extension GL_GOOGLE_include_directive : enable
#line 1 "C:/work/Nabla/examples_tests/41.VisibilityBuffer/shadeVBuffer.comp"
#define NBL_IMPL_GL_NV_viewport_array2
#define NBL_IMPL_GL_NV_stereo_view_rendering
#define NBL_IMPL_GL_NV_sample_mask_override_coverage
#define NBL_IMPL_GL_NV_geometry_shader_passthrough
#define NBL_IMPL_GL_NV_shader_subgroup_partitioned

[Company] Devsh Graphics Programming

[Location] Remote/Consulting (optional: Assistance with Relocation To Poland)

[Hiring] Vulkan/WebGPU/Emscripten Associate/Mid/Senior Developers Hourly rates Depend on Experience and Location

Who we are and what we do:

We develop an Open Source Apache 2.0 GPU Framework called Nabla, which we then use for consulting projects with external clients.

# 1 "direct.comp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "direct.comp"
layout(local_size_x = 256) in;
# 1 "../../../../nbl/builtin/glsl/scan/descriptors.glsl" 1
# 13 "../../../../nbl/builtin/glsl/scan/descriptors.glsl"
# 1 "../../../../nbl/builtin/glsl/scan/declarations.glsl" 1