Updated MonoGame Shader Editor and create voxel shader with it .

I have added textures slots into MonoGame shader editor !

MGShaderEditor2

I have created my first shader for CubeShooter game with my new editor.

Grid on voxels is now computed directly into pixels shader.

//Vertex Shader
 //Compute UV
float3 n = abs(input.vertexNormal.xyz);
float2 tileUV = float2( dot(n,  input.vertexPosition.zxx),
dot(-n, input.vertexPosition.yzy));
  output.uv0 = tileUV * 0.5;
//Pixel Shader
float4 tex0Color = tex2D(TexSamplerSlot0, input.uv0);
return (tex0Color * xGridPower) + input.color;

 

It’s sure now I gain enormously times with this editor.

VoxelGrid

Advertisements

Voxels destruction

I started a physics engine in order to manage the game level destruction. The impact of player’s missiles generate a hole in world created by boolean operation with a sphere. Then for each not empty voxels at the surface of the sphere, I generate a debris. Each debris are managed as a particle with a velocity, a time of life and a numbers of bounces with the environment.