Skip to content

Instantly share code, notes, and snippets.

@ArieLeo
ArieLeo / MeshExtensions.cs
Created February 13, 2024 15:23 — forked from Doprez/MeshExtensions.cs
Get Vertices and Indices from a mesh in Stride3d
using Stride.Games;
using Stride.Rendering;
using System;
using Stride.Core.Serialization;
using Stride.Core;
using Stride.Physics;
using System.Collections.Generic;
using Stride.Core.Mathematics;
public static class MeshExtensions
@ArieLeo
ArieLeo / YourGameDefinition.cs
Created February 13, 2024 15:21 — forked from Eideren/YourGameDefinition.cs
How to setup async shader compilation in stride, note that the game will still freeze initially to compile the fallback
public class YourGameDefinition : Stride.Engine.Game
{
protected override void BeginRun()
{
base.BeginRun();
foreach( var feature in SceneSystem.GraphicsCompositor.RenderFeatures )
{
if( feature is MeshRenderFeature meshRf )
{
meshRf.ComputeFallbackEffect += FallbackForAsyncCompilation;
@ArieLeo
ArieLeo / AnimationEvent.cs
Created February 9, 2024 13:58 — forked from Doprez/AnimationEvent.cs
Stride Animation event trigger
using ImmoApocalypse.Code.Core.Structs;
using Stride.Core;
using Stride.Engine;
using System;
using System.Windows.Media.Animation;
namespace Core;
[DataContract(nameof(AnimationEvent))]
[AllowMultipleComponents]
@ArieLeo
ArieLeo / RenderObjectsPass.cs
Created September 27, 2023 13:44 — forked from wonkee-kim/RenderObjectsPass.cs
Unity URP sample -RenderObjects's RenderPass
using System.Collections.Generic;
using UnityEngine.Rendering.Universal;
using UnityEngine.Rendering;
using UnityEngine.Scripting.APIUpdating;
namespace UnityEngine.Experimental.Rendering.Universal
{
[MovedFrom("UnityEngine.Experimental.Rendering.LWRP")] public class RenderObjectsPass : ScriptableRenderPass
{
RenderQueueType renderQueueType;
@ArieLeo
ArieLeo / RenderObjects.cs
Created September 27, 2023 13:44 — forked from wonkee-kim/RenderObjects.cs
Unity URP sample -RenderObjects's RendererFeature
using System.Collections.Generic;
using UnityEngine.Rendering.Universal;
using UnityEngine.Rendering;
using UnityEngine.Scripting.APIUpdating;
namespace UnityEngine.Experimental.Rendering.Universal
{
[MovedFrom("UnityEngine.Experimental.Rendering.LWRP")]public enum RenderQueueType
{
Opaque,
@ArieLeo
ArieLeo / Outline.shader
Created June 8, 2023 09:38 — forked from ScottJDaley/Outline.shader
Wide Outlines Renderer Feature for URP and ECS/DOTS/Hybrid Renderer
// Original shader by @bgolus, modified slightly by @alexanderameye for URP, modified slightly more
// by @gravitonpunch for ECS/DOTS/HybridRenderer.
// https://twitter.com/bgolus
// https://medium.com/@bgolus/the-quest-for-very-wide-outlines-ba82ed442cd9
// https://alexanderameye.github.io/
// https://twitter.com/alexanderameye/status/1332286868222775298
Shader "Hidden/Outline"
{
Properties
@ArieLeo
ArieLeo / URP_Normal.shader
Created April 27, 2023 08:47 — forked from shivaduke28/URP_Normal.shader
simple URP Lit shaders for learning
Shader "MyShader/URP_Normal"
{
Properties
{
[Header(Base Color)]
[MainTexture]_BaseMap("_BaseMap (Albedo)", 2D) = "white" {}
[HDR][MainColor]_BaseColor("_BaseColor", Color) = (1,1,1,1)
[Header(Normal)]
[MainTexture]_NormalMap("_NormalMap", 2D) = "white" {}
}
@ArieLeo
ArieLeo / ComponentVariable.cs
Created March 20, 2023 12:58 — forked from adamski11/ComponentVariable.cs
A ComponentVariable<T> can be used as a mini dependancy injection system to allow for rapid prototyping and the referencing of values without having to hard set those references in your scripts.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using UnityEngine.Serialization;
/*To use this script, when you need to get a variable from another script/component, instead of directly
referencing the component and then the specific variable (e.g. rBody.velocity), you would make a "ComponentVariable"
@ArieLeo
ArieLeo / DebugNode.hlsl
Created March 9, 2023 16:52 — forked from bestknighter/DebugNode.hlsl
"Print a value" custom function node code for Unity ShaderGraph, aware of +Inf/-Inf and nan
// This gist can be found at https://gist.github.com/bestknighter/660e6a53cf6a6643618d8531f962be2c
// I modified Aras Pranckevičius's awesome shader code to be able to handle Infinite and Not A Number numbers
// Tested on Unity 2023.1.0a15 with ShaderGraph 15.0.1.
// Quick try at doing a "print value" node for Unity ShaderGraph.
//
// Use with CustomFunction node, with two inputs:
// - Vector1 Value, the value to display,
// - Vector2 UV, the UVs of area to display at.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Profiling;
using UnityEngine.UI;
using System.Text;
using Unity.Profiling.LowLevel.Unsafe;
public class ReleaseBuildRecordCheck : MonoBehaviour
{