Skip to content

Instantly share code, notes, and snippets.

@w0wca7a
w0wca7a / GPUBuffer.cs
Last active December 9, 2025 11:39
Getting data from the SDSL Compute Shader in the Stride game engine
using Stride.Core.Mathematics;
using Stride.Engine;
using Stride.Graphics;
using Stride.Rendering;
using Stride.Rendering.ComputeEffect;
public class GPUBuffer : SyncScript
{
private ComputeEffectShader computeEffectShader;
@w0wca7a
w0wca7a / BasicCameraGameController.cs
Created November 28, 2025 18:32
Camera controller for GameControllers in Stride based on DirectInput
using System;
using Stride.Core.Mathematics;
using Stride.Engine;
using Stride.Input;
public class BasicCameraGameController : SyncScript
{
private const float MaximumPitch = MathUtil.PiOverTwo * 0.99f;
private Vector3 upVector;
private Vector3 translation;
@w0wca7a
w0wca7a / AsyncShaderPrecompiler.cs
Last active September 17, 2025 13:03
Async Shader Precompiler for Garaphics compositor in Stride game engine based on https://gist.github.com/Eideren/ef6be9508d8d3b0e460d8a6d15f0937b
// Copyright (c) Stride contributors (https://stride3d.net).
// Distributed under the MIT license.
using Stride.Core.Mathematics;
using System;
using Stride.Rendering;
using Stride.Rendering.Compositing;
using Stride.Rendering.Materials.ComputeColors;
using Stride.Rendering.Materials;
using Stride.Shaders;
@w0wca7a
w0wca7a / TargetComponent.cs
Created September 3, 2025 22:24
TargetRender for Stride game engine
// add this component to Entity, which must be marked as target
using Stride.Core;
using Stride.Engine;
[DataContract]
public class TargetComponent : EntityComponent {}
@w0wca7a
w0wca7a / CursorRender.cs
Created August 16, 2025 20:27
Renderer for cursor image in Stride game engine
/// https://forums.stride3d.net/t/change-mouse-cursor-graphic/1281/5
using Stride.Games;
using Stride.Graphics;
using Stride.Core;
using Stride.Input;
using Stride.Rendering;
using Stride.Rendering.Compositing;
[Display("Demo: Sprite Cursor Renderer")]
@w0wca7a
w0wca7a / DoFEffectMenu.cs
Last active September 26, 2025 21:55
Simple menu with blur in Stride. In this example we not using Depth of field effect in game. If you already using Depth of field, you must save DoF configuration before showing UI, and restore after hiding.
using Stride.Core;
using Stride.Core.Annotations;
using Stride.Core.Mathematics;
using Stride.Engine;
using Stride.Games;
using Stride.Input;
using Stride.Rendering.Compositing;
using Stride.Rendering.Images;
using Stride.UI;
public static class EntityExtensions
{
public static void LookAt(this Entity e, Vector3 target)
{
float azimuth = GetLookAtAngles(e.Transform.Position, target, out float altitude);
var result = Quaternion.RotationYawPitchRoll(azimuth, -altitude, 0);
e.Transform.Rotation = result;
}
public static Vector3 Position(this Entity e) => e.Transform.Position;
private static float GetLookAtAngles(Vector3 source, Vector3 destination, out float altitude)
using Stride.Core.Mathematics;
using Stride.Engine;
using Stride.Input;
namespace SomeNameSpace
{
public class CameraFollow : SyncScript
{
public float DelaySpeed = 0.6f;
@w0wca7a
w0wca7a / RainEffect.cs
Last active April 15, 2025 09:04
Gorgeous rain on glass shader for Stride game engine
// Copyright (c) Stride contributors (https://stride3d.net).
// Distributed under the MIT license.
using Stride.Engine;
using Stride.Graphics;
namespace Additionals.Shader.ShadertoyExam
{
[Display("RainDrops effect")]
[ComponentCategory("Effects")]
@w0wca7a
w0wca7a / FollowHeadRotationComponent.cs
Last active April 2, 2025 05:28
Model rotates head towards camera. Basic component realization for Stride game engine. Needs additional rework.
// Copyright (c) Stride contributors (https://stride3d.net).
// Distributed under the MIT license.
// This component must be attached to Entity with Skeleton (Model component with skeleton)
using Stride.Core;
using Stride.Engine;
using Stride.Core.Mathematics;
using Stride.Rendering;
using Stride.Core.Annotations;