Skip to content

Instantly share code, notes, and snippets.

View Doprez's full-sized avatar
⚠️
Not a real dog!

Doprez

⚠️
Not a real dog!
View GitHub Profile
@Doprez
Doprez / OilStainPortal.sdsl
Last active May 27, 2025 14:37
ShaderToy to Stride HLSL conversion 3
// https://www.shadertoy.com/view/ll2GRt
shader OilStainPortal : ComputeColor, Texturing
{
override float4 Compute()
{
float2 uv = 1.0 - 2.0 * (streams.TexCoord);
float t = Global.Time * 0.6;
float2 rv = uv/(length(uv*2.5)*(uv*90.0));
@Doprez
Doprez / HazePortal.sdsl
Created May 27, 2025 02:36
Another ShaderToy conversion to Stride SDSL
//https://www.shadertoy.com/view/sttSzf
shader HazePortal : ComputeColor, Texturing
{
compose ComputeColor portalColor;
override float4 Compute()
{
float2 uv = streams.TexCoord.xy;
@Doprez
Doprez / RibbonBackgroundShader.sdsl
Created November 30, 2024 21:35
ps3 xmb menu background shader for Stride.
shader RibbonBackgroundShader : SpriteBase
{
stage float3 Top;
stage float3 Bottom;
stage float WidthFactor;
stage float DeltaTime;
stage float Frequency;
stage float Amplitude;
stage float Speed;
stage float Intensity;
@Doprez
Doprez / ConversionTest.cs
Last active December 25, 2024 03:00
Testing faster conversion methods between different C# math libraries.
using BenchmarkDotNet.Attributes;
using NVector3 = System.Numerics.Vector3;
using SVector3 = Stride.Core.Mathematics.Vector3;
using MVector3 = Microsoft.Xna.Framework.Vector3;
using MMatrix = Microsoft.Xna.Framework.Matrix;
using NMatrix = System.Numerics.Matrix4x4;
using SMatrix = Stride.Core.Mathematics.Matrix;
using NQuaternion = System.Numerics.Quaternion;
using MQuaternion = Microsoft.Xna.Framework.Quaternion;
using SQuaternion = Stride.Core.Mathematics.Quaternion;
using BepuPhysics;
using BepuPhysics.Collidables;
using BepuPhysics.CollisionDetection;
using Stride.BepuPhysics.Components;
using Stride.BepuPhysics.Definitions;
using Stride.BepuPhysics.Definitions.Contacts;
using Stride.Core;
using Stride.Core.Extensions;
using Stride.Core.Mathematics;
using Stride.Engine;
@Doprez
Doprez / SmoothFollowAndRotate.cs
Created April 7, 2024 21:54
Fixes jitter found in the default templates due to the camera being directly attached to a physics component.
[ComponentCategory("Utils")]
[DataContract("SmoothFollowAndRotate")]
public class SmoothFollowAndRotate : SyncScript
{
public Entity EntityToFollow { get; set; }
public float Speed { get; set; } = 1;
public override void Update()
{
var deltaTime = (float)Game.UpdateTime.Elapsed.TotalSeconds;
@Doprez
Doprez / MeshExtensions.cs
Created November 11, 2023 05:10
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
@Doprez
Doprez / SmoothRotate.cs
Last active June 2, 2023 13:16
Smooth rotation to fix Stride Physics stutter when moving. This script mathces the rotation of another entity using Slerp.
using MagicAndMight.Code.Core.Extensions;
using Stride.Core;
using Stride.Core.Mathematics;
using Stride.Engine;
namespace MagicAndMight.Code.Core.Utils;
[DataContract(nameof(SmoothRotate))]
[ComponentCategory("Utils")]
public class SmoothRotate : SyncScript
@Doprez
Doprez / CreateButtons.cs
Created April 30, 2023 17:26
This is how I create buttons at runtime for a basic inventory system.
public void InitializeOtherInventory()
{
// InventoryPage is a variable assigned through the Stride GameStudion of type UIPage
var inventoryStack = InventoryPage.Page.RootElement.FindVisualChildOfType<ScrollViewer>("OtherItems")
.FindVisualChildOfType<StackPanel>();
// Clear the current list of buttons
inventoryStack.Children.Clear();
// Run GetInventoryButton and add it to the list of reach item
@Doprez
Doprez / SmoothFollow.cs
Created April 30, 2023 16:01
I use this to fix an issue where if a camera is attached to a physics component it creates an annoying stutter when moving.
[DataContract(nameof(SmoothFollow))]
[ComponentCategory("Animation")]
public class SmoothFollow : SyncScript
{
public Entity EntityToFollow { get; set; }
public Vector3 Speed { get; set; } = new Vector3(1, 1, 1);
public override void Update()
{