In this page:
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 System; | |
using Unity.Burst; | |
using Unity.Collections; | |
using Unity.Jobs; | |
using Unity.Mathematics; | |
using UnityEngine; | |
using UnityEngine.UI; | |
using TMPro; | |
public class OptimalSpatialHashing : MonoBehaviour { |
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
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" | |
} |
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. |
The collections provided by this package fall into three categories:
- The collection types in
Unity.Collections
whose names start withNative-
have safety checks for ensuring that they're properly disposed and are used in a thread-safe manner. - The collection types in
Unity.Collections.LowLevel.Unsafe
whose names start withUnsafe-
do not have these safety checks. - The remaining collection types are not allocated and contain no pointers, so effectively their disposal and thread safety are never a concern. These types hold only small amounts of data.
Most of the methods in Mathematics have many overloads for different combinations of types. For example, math.abs()
takes vector arguments, not just scalars, e.g. math.abs(new int3(5, -7, -1))
returns new int3(5, 7, 1)
. This cheat sheet does not exhaustively demonstrate all of the overloads. Consult the API reference for the full list.
In this page:
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
UNITY_DECLARE_SHADOWMAP(_SunCascadedShadowMap); | |
float4 _SunCascadedShadowMap_TexelSize; | |
#define GET_CASCADE_WEIGHTS(wpos, z) getCascadeWeights_splitSpheres(wpos) | |
#define GET_SHADOW_FADE(wpos, z) getShadowFade_SplitSpheres(wpos) | |
#define GET_SHADOW_COORDINATES(wpos,cascadeWeights) getShadowCoord(wpos,cascadeWeights) | |
/** | |
* Gets the cascade weights based on the world position of the fragment and the poisitions of the split spheres for each cascade. |
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
Shader "CustomUberPost" // "Hidden/Universal Render Pipeline/UberPost" | |
{ | |
HLSLINCLUDE | |
#pragma exclude_renderers gles | |
#pragma multi_compile_local_fragment _ _DISTORTION | |
#pragma multi_compile_local_fragment _ _CHROMATIC_ABERRATION | |
#pragma multi_compile_local_fragment _ _BLOOM_LQ _BLOOM_HQ _BLOOM_LQ_DIRT _BLOOM_HQ_DIRT | |
#pragma multi_compile_local_fragment _ _HDR_GRADING _TONEMAP_ACES _TONEMAP_NEUTRAL | |
#pragma multi_compile_local_fragment _ _FILM_GRAIN | |
#pragma multi_compile_local_fragment _ _DITHERING |
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 System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.Rendering; | |
using UnityEngine.Rendering.Universal; | |
public class CustomRendererFeature : ScriptableRendererFeature { | |
public class CustomRenderPass : ScriptableRenderPass { | |
private Settings settings; |
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 System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.Rendering; | |
using UnityEngine.Rendering.Universal; | |
public class GlitchRenderFeature : ScriptableRendererFeature { | |
class CustomRenderPass : ScriptableRenderPass { | |
private Settings settings; | |
private FilteringSettings filteringSettings; |
NewerOlder