Skip to content

Instantly share code, notes, and snippets.

Hermann Plass h3r

Block or report user

Report or block h3r

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@h3r
h3r / tweening.inc
Created May 23, 2020
Tweening funcs
View tweening.inc
/*
This is another set of easing functions I used for VFX, should work in HLSL, GLSL and C/C++, if not leave a comment.
Most of this code hasn't been made by me (maybe partially tweaked to fit) and just collected those snippets from many sources
across the internet. I haven't saved some of the original author names and all the credits
should go to them. I'm pretty some of you may find optimizations to them, feel free to leave a comment.
HPlass (hermann.plass@gmail.com) - 2020
*/
// ------------------------------
@h3r
h3r / easing.inc
Created May 23, 2020
Easing funcs
View easing.inc
/*
This is a set of easing functions I used for VFX, should work in HLSL, GLSL and C/C++, if not leave a comment.
Most of this code hasn't been made by me (maybe partially tweaked to fit) and just collected those snippets from many sources
across the internet. I haven't saved some of the original author names and all the credits
should go to them. I'm pretty some of you may find optimizations to them, feel free to leave a comment.
HPlass (hermann.plass@gmail.com) - 2020
*/
@h3r
h3r / noise.inc
Created May 23, 2020
hlsl Noise generator functions
View noise.inc
/*
Most of this code hasn't been made by me (maybe partially tweaked to fit) and just collected those snippets from many sources
across the internet. I haven't saved some of the original author names and all the credits
should go to them. I'm pretty some of you may find optimizations to them, feel free to leave a comment.
HPlass (hermann.plass@gmail.com) - 2020
Source:
https://thebookofshaders.com/11/
https://thebookofshaders.com/edit.php#11/lava-lamp.frag
@h3r
h3r / matcap.glsl
Created May 23, 2020
GLSL Matcap funcs
View matcap.glsl
vec4 matcap(sampler2D sampler, mat4 view_matrix, vec3 normal, float scale){
vec3 vN = (view_matrix * vec4(normal, 0.)).xyz;
float2 uvs = view_N.xy * vec2(1.,-1.) * 0.48 * scale + vec2(.5, .5);
return texture2D(sampler, uvs);
}
@h3r
h3r / generators.inc
Created May 23, 2020
HLSL Sequence Generators
View generators.inc
float2 hammersley(uint index) {
// Compute Hammersley sequence
// TODO: these should come from uniforms
// TODO: we should do this with logical bit operations
const uint numSamples = uint(IBL_INTEGRATION_IMPORTANCE_SAMPLING_COUNT);
const uint numSampleBits = uint(log2(float(numSamples)));
const float invNumSamples = 1.0 / float(numSamples);
uint i = uint(index);
uint t = i;
uint bits = 0u;
@h3r
h3r / angular.h
Last active May 23, 2020
C/C++ Math snippets for game development
View angular.h
/*
Most of this code hasn't been made by me (maybe partially tweaked to fit) and just collected those snippets from many sources
across the internet. I haven't saved some of the original author names and all the credits
should go to them. I'm pretty some of you may find optimizations to them, feel free to leave a comment.
HPlass (hermann.plass@gmail.com) - 2020
*/
/*
@h3r
h3r / ballistic.h
Created May 23, 2020
Solving Ballistic Trajectories
View ballistic.h
/*
C/C++ reimplementation of the code.
Read: https://www.forrestthewoods.com/blog/solving_ballistic_trajectories/
Source: https://github.com/forrestthewoods/lib_fts/blob/master/code/fts_ballistic_trajectory.cs
Dependencies: https://github.com/Microsoft/DirectXTK/wiki/SimpleMath
HPlass (hermann.plass@gmail.com) - 2020
*/
bool solve_ballistic_arc_lateral(const VEC3 proj_pos, const float lateral_speed, const VEC3 target_pos, const float max_height, VEC3& fire_velocity, float& gravity)
{
@h3r
h3r / color_snippet.glsl
Last active May 23, 2020
GLSL Color operations
View color_snippet.glsl
/*
All components are in the range [0...1], including hue.
Source: http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl
*/
vec3 rgb2hsv(vec3 c)
{
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
@h3r
h3r / matrix_snippet.glsl
Last active May 23, 2020
GLSL Matrix operations polyfill
View matrix_snippet.glsl
/*
None of this code has been made by me and just collected those snippets from many sources
across the internet. I haven't saved any of the original author names and all the credits
should go to them.
HPlass (hermann.plass@gmail.com) - 2020
*/
/*
@h3r
h3r / event.h
Last active Mar 10, 2020
A super basic event system based on LEvent implementation from @jagenjo.
View event.h
#pragma once
/*
A super basic event system based on LEvent implementation from @jagenjo.
Some improvements should be done:
* swap to numerical ids instead of strings: https://github.com/mariusbancila/stduuid
* add sorting method to controll the call order on trigger
You can’t perform that action at this time.