Skip to content

Instantly share code, notes, and snippets.

View starock's full-sized avatar
😊
Working from home

Stormer starock

😊
Working from home
View GitHub Profile
@andrew-raphael-lukasik
andrew-raphael-lukasik / .GpuInstancingForGameObjects.cs.md
Last active November 13, 2024 01:55
GPU Instancing for GameObjects

GPU Instancing for GameObjects

frustum culling, multiple materials are being segregated into batches with their own AABB:

@PamisuMyon
PamisuMyon / FrustumCulling.compute
Last active July 10, 2024 10:21
Unity URP DrawMeshInstancedIndirect Frustum Culling Demo
#pragma kernel CSMain
float4 _FrustumPlanes[6]; // 视锥体的六个面
float3 _BoundMin; // 物体包围盒最小点
float3 _BoundMax; // 物体包围盒最大点
StructuredBuffer<float4x4> _AllMatricesBuffer; // 所有物体的复合变换矩阵
AppendStructuredBuffer<uint> _VisibleIDsBuffer; // 可见物体实例ID
bool IsOutsideThePlane(float4 plane, float3 position)
{
@ArieLeo
ArieLeo / Usage.cs
Created November 7, 2021 09:38 — forked from Refsa/Usage.cs
DrawMeshInstancedIndirect with ShaderGraph and URP
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
class Render : MonoBehaviour
{
struct DrawData
{
public Vector3 Pos;
public Quaternion Rot;
// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "Unlit/Directional Tint"
{
Properties
{
_MainTex("MainTex", 2D) = "white" {}
_Color("Color", Color) = (1,1,1,1)
_ColorA("ColorA", Color) = (1,1,1,1)
_ColorB("ColorB", Color) = (1,1,1,1)
@JohannesDeml
JohannesDeml / README.md
Last active July 17, 2024 14:38
Remove Unity mobile notification warning for WebGL builds

Remove warning

Unity shows the following warning on mobile devices up to Unity 2019.4: "Please note that Unity WebGL is not currently supported on mobiles. Press OK if you wish to continue anyway." This script helps you remove this warning

Live example

To see live examples see Unity Web GL Loading Test

Logic

The script will run after the build has completed and replace the checks from all generated javascript files.

Support

@mtrive
mtrive / EnableThreads.cs
Last active September 11, 2022 07:07
Unity Editor script to enable WebAssembly multithreading
using UnityEditor;
using UnityEngine;
[InitializeOnLoad]
class EnableThreads
{
static EnableThreads()
{
PlayerSettings.WebGL.linkerTarget = WebGLLinkerTarget.Wasm;
PlayerSettings.WebGL.threadsSupport = true;
// budo boop.ts --live --dir . -- -p [ tsify --target es6 ]
import * as B from 'babylonjs'
import * as parseMagicaVoxel from 'parse-magica-voxel'
import * as createAOMesh from 'ao-mesher'
import * as fill from 'ndarray-fill'
import * as ndarray from 'ndarray'
let canvas : any = document.createElement( "canvas" );
document.body.appendChild(canvas)
@MattRix
MattRix / PhysicsFollower.cs
Last active August 8, 2024 00:25
A thing you can use to make a rigidbody move towards a position reliably
using UnityEngine;
using System.Collections;
using System;
[RequireComponent (typeof(Rigidbody))]
public class PhysicsFollower : MonoBehaviour
{
public Transform target;
Rigidbody rb;
@joyrexus
joyrexus / README.md
Last active September 7, 2024 14:28
Form/file uploads with hapi.js

Demo of multipart form/file uploading with hapi.js.

Usage

npm install
npm run setup
npm run server

Then ...