Hello there! So my name is Youness, i'm currently working as a data engineer and on my free time i love to do some artsy stuff. My interest for softwares and my passion for art has obviously led me to game development and computer graphics. I love experimenting, creating new ideas, trying new processes and such and that's what i found when i discovered the Stride game engine and i'd like to share my process for experimenting in graphics with Stride.
But let's dive in and experiment with our first shaders.
Here's the Stride Game studio, as you can see we have a plane colored in black. The reason is that the material is empty, nothing to compute of course. For our first experiment we'll create a shader to give our plane a little bit of color.
choose color to emissive map
That's fine but we can use other ways of coloring those meshes, for example a vector value. Although if we want the alpha to work we'd have to make the material transparent.
Next up, Shaders! I'd like to introduce you to the heart of Stride, the shader language SDSL. It's a very neatly designed language that allows reuse of code through mixins and more. A lot of SDSL comes from HLSL, you're basically writing a kind of supercharged HLSL.
Here our shaders inherits a compute function that we can override, this function is used by the general material shader and the mixin systems allows you to focus on one part of the rendering.
We can already change the color of the shader by returning a float4 and observe the result directly in the editor, or if you're running the game, the shader will be updated live too.
You can also use the mixin system to make some data available.
shader ShaderTutorial : ComputeColor, Texturing, NormalStream
{
override float4 Compute()
{
return float4(streams.normalWS,1);
}
};// Normalized pixel coordinates (from 0 to 1)
float2 uv = streams.TexCoord;
// Time varying pixel color
float3 col = 0.5 + 0.5*cos(Global.Time+uv.xyx+float3(0,2,4));
// Output to screen
return float4(col,1);So that was the basic idea of experimenting with shaders but you can go further with that, you could for example make some raymarching using this, there are tons of tutorials explaining raymarching using unity, those tutorials are easily transferable to Stride too!
Now i want to show you something different. I've found an old paper written by a frostbite engineer explaining how PBR was included on the engine with some area of lights. When i read this paper i could see some code snippets that i had to try and see if i could add area of lights in Stride so i began experimenting and here's how things are so far.
Explaing the shader for the disc light emissive color explain how the lighting system works and how the forward renderer shader is composed on the high level show the shader computation and how i copy pasted some code from the source and how easy it is to enhance the engine without having to recompile the whole source code