Skip to content

Instantly share code, notes, and snippets.

View andrew-raphael-lukasik's full-sized avatar
🏴‍☠️

Andrew Raphael Lukasik andrew-raphael-lukasik

🏴‍☠️
View GitHub Profile
@aras-p
aras-p / ImportMeshUtility.cpp
Created May 31, 2012 15:01
Unity tangent space calculation
// THIS IS ONLY A PORTION OF THE FILE
// WILL NOT COMPILE OUT OF THE BOX!
void OrthogonalizeTangent (TangentInfo& tangentInfo, Vector3f normalf, Vector4f& outputTangent)
{
TangentInfo::Vector3d normal = { normalf.x, normalf.y, normalf.z };
TangentInfo::Vector3d tangent = tangentInfo.tangent;
TangentInfo::Vector3d binormal = tangentInfo.binormal;
@edwerner
edwerner / Vector2.js
Last active March 26, 2019 16:34
Base Vector2 JavaScript math helper class serves methods to perform operations on object values within Cartesian coordinate systems.
var Vector2 = function () {
this._x = 0;
this._y = 0;
this.DEGRAD = 0;
};
Vector2.prototype.initialize = function (x, y) {
_x = x;
_y = y;
};
using UnityEngine;
using System.Collections;
/// <summary>
/// Automatically scales quality up or down based on the current framerate (average).
/// </summary>
///
/// \author Kaspar Manz
/// \date 2014-03-10
/// \version 1.0.0
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active July 15, 2024 12:10
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@TarasOsiris
TarasOsiris / FlowMap.shader
Last active June 24, 2024 21:45
Flow Map Shader for Unity3D. Used with Sprites.
Shader "Custom/Flow Map"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
// Flow
_FlowMap ("Flow Map", 2D) = "white" {}
_FlowSpeed ("Flow Speed", float) = 0.05
@cjddmut
cjddmut / ColorHSV.cs
Last active August 24, 2022 21:02
A HSV Color struct for Unity3D. Allows conversion between UnityEngine.Color and UnityEngine.Color32.
/*
* Created by C.J. Kimberlin (http://cjkimberlin.com)
*
* The MIT License (MIT)
*
* Copyright (c) 2015
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
@keijiro
keijiro / ToggleTest.shader
Last active March 24, 2023 00:43
Shows how to use the Toggle material property drawer in a shader. See the reference manual for further details: http://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html
Shader "ToggleTest"
{
Properties
{
[Toggle(FILL_WITH_RED)]
_FillWithRed ("Fill With Red", Float) = 0
}
SubShader
{
Pass
@unitycoder
unitycoder / MatrixPlayGround.shader
Last active May 9, 2024 08:39
Matrix Playground Shader
// Matrix PlayGround Shader - UnityCoder.com
// References:
// Matrices http://www.codinglabs.net/article_world_view_projection_matrix.aspx
// Rotation: http://www.gamedev.net/topic/610115-solved-rotation-deforming-mesh-opengl-es-20/#entry4859756
Shader "UnityCoder/MatrixPlayground"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
@YclepticStudios
YclepticStudios / CanvasMesh.cs
Created January 26, 2017 00:25
Unity script for rendering a mesh inside the canvas UI.
/**
* ============================================================================
* MIT License
*
* Copyright (c) 2017 Eric Phillips
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
@DmitriyYukhanov
DmitriyYukhanov / ObjectTools.cs
Created March 21, 2017 11:18
Updated code to get a Unity object id.
#define UNITY_5_PLUS
#if UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9
#undef UNITY_5_PLUS
#endif
using UnityEngine;
using System.Reflection;
using UnityEditor;
namespace CodeStage.Maintainer.Tools