Hiding screenshots…

So it seems like I had some some screenshots hiding from me, and they are by far my favorite! Also showing my volumetric light scattering (Also known as God Rays)

(Cuboid Engine + Sponza Scene from Crytek)



Post Materials

As you know post processing is a vital component in today games. So, what I did is that I’ve added a component to the material parser which acts somewhat like a post processing material, made by the user. It follows the same language as the other materials, just some features are disabled.

The user can:

  • Set Linkers ( Communication between shaders )
  • Send Resources (Like textures [1D, 2D, 3D])
  • Change Vertex Shaders
  • Change Pixel Shaders

The vertex shader is preset to generate a full screen quad, which is changeable by the user if needed. For now it seems to work, I tested it using a simple falloff fog shader, works good so far:

shader "PostFog"
		Info = "Some info";

    // Considered to be global
		Texture2D _tPos;
		Texture2D _tScene;

	pass(cull = false;)
			float dz = 0.001f; // Density
			float3 fcolor = {0.5, 0.5, 0.5};

			float near = 1;
			float far = 10;

			float3 position = _tPos.Sample(ss, input.Tex);
			float3 cen = _tScene.Sample(ss, input.Tex);

			float d = length(position - eyepos);
			float l = saturate((d-near)/(far-near));
			return float4(lerp(cen,fcolor, l),1);

The material is created like the following:

CDK::MaterialPost *post_fog = pEngine->CreateMatPost(CeURL("Materials\\Fog.cs"));
post_fog->SetTexture(pEngine->GetPositionMap(), post_fog->getSlot("_tPos"));
post_fog->SetTexture(pEngine->GetCompositMap(), post_fog->getSlot("_tScene"));
post_fog->SetBlendMode(CDK::Blend::Dominant); // Two kind of blend modes: Additive, Dominant(The output color overwrites)

All that CreateMatPost does is:

CeMatParser<CDK::MaterialPost> *m = new CeMatParser<CDK::MaterialPost>();
m->Bootstrap(dev, Url);
return m;

Optimizations are still on the list!

So yeah, it’s been a productive day! 🙂