Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
✅
‏‏‎

mika unitycoder

✅
‏‏‎
View GitHub Profile
@unitycoder
unitycoder / Sprites_ScrollFX-ScreenSpace.shader
Last active February 14, 2024 01:36
Scrolling Sprite Shader Effect
// Unity buit-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
// modified to add scrolling lines fx, use black and white mask texture for scrollingtex. - unitycoder.com
Shader "Sprites/ScrollFX (ScreenSpace)"
{
Properties
{
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
_ScrollTex("Scroll Texture", 2D) = "white" {}
@unitycoder
unitycoder / WEBCONNECTOR.cs
Created April 3, 2022 13:55
webgl get onfocus onblur events
using UnityEngine;
using System.Collections;
public class WEBCONNECTOR : MonoBehaviour
{
void Start()
{
Application.ExternalEval("function onfoc(){GetUnity().SendMessage('WEBCONNECTOR','BrowserFocus','...');}");
Application.ExternalEval("function onblr(){GetUnity().SendMessage('WEBCONNECTOR','BrowserBlur','...');}");
Application.ExternalEval("window.onfocus=onfoc;");
@unitycoder
unitycoder / Caustics.shader
Created March 21, 2022 14:44
Caustics shader
Shader "Caustics"
{
Properties
{
[Header(Caustics)]
_CausticsTexture("Texture", 2D) = "white" {}
_CausticsStrength("Strength", float) = 0
_CausticsSplit("RGB Split", float) = 0
[Header(Movement)]
@unitycoder
unitycoder / ModifiedMarchingCubes.js
Created March 21, 2022 14:13 — forked from dwilliamson/ModifiedMarchingCubes.js
Transvoxel's Modified Marching Cubes Lookup Tables
//
// Lookup Tables for Transvoxel's Modified Marching Cubes
//
// Unlike the original paper (Marching Cubes: A High Resolution 3D Surface Construction Algorithm), these tables guarantee
// a closed mesh "whose connected components are continuous and free of holes."
//
// Rotations are prioritised over inversions so that 3 of the 6 cases containing ambiguous faces are never added. 3 extra
// cases are added as a post-process, overriding inverses through custom-build rotations to eliminate the rest.
//
// Uses the exact same co-ordinate system as https://gist.github.com/dwilliamson/c041e3454a713e58baf6e4f8e5fffecd
@unitycoder
unitycoder / package.json
Created March 18, 2022 19:33
UnityHub 3.1.1 - List of Node Packages
{
"name": "UnityHub",
"version": "3.1.1",
"description": "The Official Unity Hub",
"main": "build/index.js",
"repository": {
"type": "git",
"url": "https://github.com/Unity-Technologies/unity-hub"
},
"author": "Unity Technologies Inc.",
@unitycoder
unitycoder / Nurbs.compute
Created March 16, 2022 07:01
Nurbs Surface in Unity Compute shader
// https://forum.unity.com/threads/feedback-wanted-mesh-compute-shader-access.1096531/page-2#post-7966668
#pragma kernel CSMain
 
float4 _ControlPoints[8][8];
RWByteAddressBuffer _GraphicsBuffer;
uint _TessellationFactor, _VertexCount;
 
static float KnotVectors[8][2] = // knotsDim = (8, 8)
{
    {0.0, 0.0},
@unitycoder
unitycoder / .vs
Created March 14, 2022 18:23
Send byte array from js to Unity (webgl)
// https://forum.unity.com/threads/send-byte-array-from-js-to-unity.1252413/
getByteArrayTmp: function(instantiateByteArrayCallback) {
    const byteArray = new Uint8Array([21, 31]);//example
    Module["yourplugin"].byteArray = byteArray;
       
},
getByteArray: function(callback, byteArray) {
    Module.HEAPU8.set(Module["yourplugin"].byteArray, byteArray);
    Module.dynCall_v(callback);
},
@unitycoder
unitycoder / ReflectionProbeAccess.shader
Created March 14, 2022 08:32 — forked from josephbk117/ReflectionProbeAccess.shader
Reflection Probe In Custom Unity Shader
/*Please do support www.bitshiftprogrammer.com by joining the facebook page : fb.com/BitshiftProgrammer
Legal Stuff:
This code is free to use no restrictions but attribution would be appreciated.
Any damage caused either partly or completly due to usage this stuff is not my responsibility*/
Shader "BitshiftProgrammer/ReflectionProbeAccess"
{
Properties
{
_Roughness("Roughness", Range(0.0, 10.0)) = 0.0
}