Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
‏‏‎

mika unitycoder

‏‏‎
View GitHub Profile
@unitycoder
unitycoder / README.md
Created September 17, 2024 19:50 — forked from jamiephan/README.md
A script to automatically add ALL items to your account in quixel

Script to add all items from quixel

As quixel is being removed, all items are free to aquire. This script is to automate the process to add items to your account (As of writing, a total of 18874 items)

Note: This script only tested in the latest version of Chrome.

How to use

  1. Copy the script from below (run.js)
  2. Login into https://quixel.com
@unitycoder
unitycoder / FpsCapper.cs
Created September 16, 2024 09:52 — forked from keijiro/FpsCapper.cs
FpsCapper - Limits the frame rate of the Unity Editor in Edit Mode
using UnityEditor;
using UnityEngine;
using UnityEngine.LowLevel;
using System.Linq;
using System.Threading;
namespace EditorUtils {
//
// Serializable settings
@unitycoder
unitycoder / screenshot_display.cs
Created September 10, 2024 07:29
Take Screenshot from Specific Display1 - n (camera)
// https://discussions.unity.com/t/multiple-camera-screenshots/481847/13
public void Screenshot()
{
foreach (GameObject go in GameObject.FindGameObjectsWithTag("picCam"))
{
Camera cam = go.GetComponent<Camera>();
resWidth = cam.pixelWidth;
resHeight = cam.pixelHeight;
RenderTexture rt = new RenderTexture(resWidth, resHeight, 24);
cam.targetTexture = rt;
@unitycoder
unitycoder / VertexBillboard.shader
Created September 4, 2024 21:49 — forked from camnewnham/VertexBillboard.shader
Point cloud shaders
Shader "Points/Billboard"
{
Properties
{
_PointSize("PointSize", Range(0, 0.1)) = 0.01
[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend("Source Blend", Float) = 1 // "One"
[Enum(UnityEngine.Rendering.BlendMode)] _DstBlend("Destination Blend", Float) = 0 // "Zero"
[Enum(UnityEngine.Rendering.CompareFunction)] _ZTest("Depth Test", Float) = 4 // "LessEqual"
[Enum(DepthWrite)] _ZWrite("Depth Write", Float) = 1 // "On"
}
@unitycoder
unitycoder / generate-points.ts
Created September 4, 2024 19:36 — forked from donmccurdy/generate-points.ts
Generate a point cloud in glTF format, using glTF Transform.
import { Document, NodeIO, Primitive } from '@gltf-transform/core';
const document = new Document();
const buffer = document.createBuffer();
const position = document.createAccessor()
.setType('VEC3')
.setBuffer(buffer)
.setArray(new Float32Array([
0, 0, 0, // ax,ay,az
@unitycoder
unitycoder / convert-glb.mjs
Created September 3, 2024 20:58 — forked from wallabyway/convert-glb.mjs
convert 3D-Tiles v1 to v1.1 (3D-Tiles-Next) for point clouds
// PURPOSE: convert draco-pnts to glb (ie. 3dTiles v1.0 to v1.1)
// INSTALL: npm install draco3d gltfpack
// RUN:
// > node infolderPNTS outfolderGLB
import fs from 'fs';
import draco3d from 'draco3d';
import gltfpack from 'gltfpack';
const inFolder = process.argv.slice(2)[0] || 'infolder';
hader "Unlit/GridOverlay"
{
Properties
{
_GridSize("Grid Size", Float) = 10
_Grid2Size("Grid 2 Size", Float) = 160
_Grid3Size("Grid 3 Size", Float) = 320
_Alpha ("Alpha", Range(0,1)) = 1
}
SubShader
@unitycoder
unitycoder / keywordenum-shader.cs
Last active September 2, 2024 11:40
unity toggle KeywordEnum from script (shader feature)
[KeywordEnum(Off, On)] _UseSomething ("Use Something",float) = 0
#pragma shader_feature _USESOMETHING_ON
#pragma shader_feature _USESOMETHING_OFF
#ifdev _USESOMETHING_ON
..
#endif
public void ToggleSomething(bool state)
{
@unitycoder
unitycoder / UnityShaderFFS.md
Created September 2, 2024 10:51 — forked from Leopotam/UnityShaderFFS.md
Controlling fixed function states from materials/scripts in Unity

16999105_467532653370479_4085466863356780898_n

Shader "MaterialPropertyDrawer"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
 
[HideInInspector] _MainTex2("Hide Texture", 2D) = "white" {}
@unitycoder
unitycoder / calculate-top-list-itchio.js
Created September 1, 2024 20:47
calculate top user submitted games count from itch.io games list
// https://itch.io/games/newest
// Step 1: Select all elements with the class "game_cell has_cover"
const gameCells = document.querySelectorAll('.game_cell.has_cover');
// Step 2: Create an empty object to store username counts and their display names
const usernameData = {};
// Step 3: Loop through each "game_cell has_cover" element
gameCells.forEach((cell) => {