This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void TexelSnap_float(float3 WorldPos, float4 UV0, float4 TexelSize, out float3 SnappedWorldPos) | |
{ | |
// 1.) Calculate how much the texture UV coords need to | |
// shift to be at the center of the nearest texel. | |
float2 originalUV = UV0.xy; | |
float2 centerUV = floor(originalUV * (TexelSize.zw))/TexelSize.zw + (TexelSize.xy/2.0); | |
float2 dUV = (centerUV - originalUV); | |
// 2b.) Calculate how much the texture coords vary over fragment space. | |
// This essentially defines a 2x2 matrix that gets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
#if UNITY_EDITOR | |
[System.AttributeUsage(System.AttributeTargets.Field)] | |
public class RenameAttribute : PropertyAttribute | |
{ | |
public string[] renamePairs; | |
public RenameAttribute(params string[] renamePairs) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bl_info = { | |
"name": "Move Vertices by Direction", | |
"blender": (2, 80, 0), | |
"category": "Mesh", | |
} | |
import bpy | |
from bpy.types import Operator | |
from bpy.props import FloatProperty, BoolProperty | |
from mathutils import Vector, Matrix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// original from https://forum.unity3d.com/threads/share-volume-fog-shader.147323/ | |
Shader "Effect/SphereFog" { | |
Properties { | |
_FogColor ("Fog Color", Color) = (1,1,1,1) | |
[space] | |
_Density ("Density", Float) = 1 | |
_Power ("Power/gamma", Float) = 4 | |
_Offset ("Offset", Range(-.1,.1)) = -0.003 | |
[space] | |
_NearbyOffset ("Nearby Offset", Float) = -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class pipeGenerator : MonoBehaviour | |
{ | |
[SerializeField] Mesh straightMesh; | |
[SerializeField] Mesh elbowMesh; | |
[Space] | |
[SerializeField] Vector3[] pathPoints; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Mathfx | |
{ | |
public static void normalizePoints(ref List<Vector2> path) { | |
float length = 0; | |
List<float> lengths = UnityEngine.Pool.GenericPool<List<float>>.Get(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class treeThing { | |
// tree design: all the changable variables in one place! | |
struct treeStyle { | |
// skipping stuff like how many branches per tree, sticks per branch.. | |
// sticks | |
Vector2 stickAngleJagMM; // how jaggy the branches are (min-max) | |
Vector2 stickLengthMM; // how long the sticks are (min-max) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class logoAssembler : MonoBehaviour { | |
[SerializeField] bool debugMe; | |
[SerializeField] bool remakePixels; | |
[SerializeField] bool autoPlay; | |
[SerializeField][Range(0,10)] float autoDur = 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// threshold for mask can be controlled using vertex color alpha (useful for spriteRenderers or particle systems) | |
// _MainTex: alpha of this texture is used as a mask | |
// _EmissionTex: usually rgb noise texture, adjust it's scaling if needed | |
// color remap and oscilation for each channel of emission can be modified in _EmStrobeBFALR, _EmStrobeBFALG, _EmStrobeBFALB | |
// Base: base amplitude of brightness oscilation | |
// Freq: frequency of oscilation | |
// Ampl: amplitude of oscilation | |
// L: how much _EmissionTex affects this color | |
Shader "StandardWMask" { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// c# companion script | |
// SpriteUVToShader.cs -------------------------------------------------------------------------------------------------------------------------------- // | |
// Save you your project, add to your SpriteRenderer gameObject | |
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
[ExecuteInEditMode] |
NewerOlder