This file contains hidden or 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 Unity.Burst; | |
| using Unity.Collections; | |
| using Unity.Collections.LowLevel.Unsafe; | |
| using Unity.Jobs; | |
| using UnityEngine; | |
| // This example code demonstrates using Unity Burst directly on a static method without jobs. | |
| // Unity NativeArrays can't be used directly in Unity Burst methods (only in Burst jobs), | |
| // so we have to pass pointers to arrays instead. |
This file contains hidden or 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; | |
| // Visual effect/illusion where a rotating model alternates between | |
| // seeming to rotate one way around and the other. | |
| // Unlike many similar effects, the eyes are nudged/forced to see it | |
| // in alternating ways by oscillating between regular perspective and | |
| // inverse perspective, changing which parts of the model appear | |
| // bigger or smaller on the screen. | |
| // Attach this script on the GameObject with the Camera component. |
This file contains hidden or 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
| /* | |
| Based on the Anti-aliased Euclidean distance transform described by Stefan Gustavson and | |
| Robin Strand. For further information, see https://contourtextures.wikidot.com/ and | |
| https://web.archive.org/web/20220503051209/https://weber.itn.liu.se/~stegu/edtaa/ | |
| The algorithm is an adapted version of Stefan Gustavson's code, it inherits the copyright | |
| statement below, which applies to this file only. | |
| The rewrite with Unity Burst support makes the execution 40 times faster by default, | |
| and 75 times faster if the passed in textures are both of type TextureFormat.RGBAFloat. |
This file contains hidden or 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
| /* | |
| Erosion noise implementation in C# (with the Unity.Mathematics package), | |
| ported one-to-one from the Shadertoy shader code by Fewes and clayjohn. | |
| Please note that while the majority of the code is provided under the MIT license, | |
| the quite central "erosion" function is adapted from code shared under the | |
| Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. | |
| Shadertoy comment by Fewes from https://www.shadertoy.com/view/7ljcRW : |
This file contains hidden or 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; | |
| [ExecuteAlways] | |
| public class BalloonTouch : MonoBehaviour { | |
| public Transform start; | |
| public Transform other; | |
| void Update() { | |
| Vector2 startPoint = start.position; |
This file contains hidden or 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
| /* | |
| Fixed point 2D and 3D noise functions: | |
| float Noise(in int2 p, float pRes, float freq) | |
| float Noise(in int3 p, float pRes, float freq) | |
| Fixed point 2D noise function with derivatives: | |
| float3 NoiseD(in int2 p, float pRes, float freq) | |
| - p is the input coordinates in raw integers. | |
| - pRes is the "resolution" of one unit; the integer value |
OlderNewer