Skip to content

Instantly share code, notes, and snippets.

View slipster216's full-sized avatar

Jason Booth slipster216

View GitHub Profile
@slipster216
slipster216 / gist:06c4ea4cf6003958f9e602473a8a25b7
Created December 7, 2023 08:20
Append Buffer Async Readback broken
Compute Shader:
// Each #kernel tells which function to compile; you can have many kernels
#pragma kernel CSMain
// Create a RenderTexture with enableRandomWrite flag and set it
// with cs.SetTexture
AppendStructuredBuffer<float> Result;
[numthreads(256,1,1)]
@slipster216
slipster216 / Terrain API issues
Created November 29, 2022 00:38
Some of the issues with the terrain API
TreeInstance lets you set the Y position of the tree, and then you can tell it not to set the tree's to be on the terrain when setting the TreeInstance[] with SetTreeInstances, but when the terrain sync's the height data it aligns them to the terrain Y anyway. This prevents you from sinking the tree's into the ground without changing the model, or floating lilly pads on water, etc. It will work for a second, then snap back to the terrain height.
The terrain details API uses an Int[,] for details. It should be able to readback an R8 texture the same way height/alpha maps can be read back from the GPU. This would at least half the time of MicroVerse updates, if not more if there are more details in use.
Terrain isn't tessellated when flat - this breaks tessellation shaders which subdivide the terrain, and likely doesn't do much to speed up terrain except on really old GPUs or in preventing a few microtriangles. Would be nice to be able to disable this.
When reading back heightmaps from the GPU, you have the o
BEGIN_OPTIONS
Workflow "Unlit"
END_OPTIONS
BEGIN_PROPERTIES
_Matcap("Matcap Texture", 2D) = "white" {}
END_PROPERTIES
BEGIN_CODE
Also figured out how to enter the hole. Just add a trigger zone in front of your hole and add this code to a script and add the script to your trigger zone.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnterHole : MonoBehaviour {
public Collider player;
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
@slipster216
slipster216 / Unity API issues and design thoughts.txt
Last active October 14, 2017 18:39
Unity API issues and Editor design thoughts..
List of design/api/usability thoughs generated while working with Unity- will be extended over time. Unity peeps
asked for some priorities, which are labeled (#1-5, 1 being highest) but are somewhat arbitrary (since these range
from massive refactors to simple fixes). Now adding with dates, so it's easy to see what's new..
3/28/2017
Asset publisher gripes:
- No way to enforce "one seat per user" license - companies with multiple employee's using my software only ever pay
once, when it's supposed to be one copy per user.
- Piracy of assets is rampant
- No subscription business model. You're moving to subscription, why can't we?