Volumetric Lighting!

So one topic that we all hear over and over is VOLUMETRIC LIGHTING ( caps intended ). Why? Because its so damn awesome. Why not? Because it can get expensive depending on the hardware. So after countless of tries I scrapped the code I’ve been wanting to shoot then resurrect then shoot again and just wrote what made sense, and it worked!

The implementation is actually really simple, in simple terms I did it like this: ( I havent optimized it yet, E.g. I should do it all in light view space )

// Number of raymarches
steps = 50

// Get world space position
positionWS = GetPosition();

// Get world space position of the pixel
rayWS = GetWorldSpacePixelPos();

// Get ray between world space position and pixel world space pos
v = positionWS - rayWS;
vStep = v / steps;

color = 0,0,0
for i = 0 to steps
    rayWS += vStep;

    // Calculate view and proj space rayWS
    rayWSVS = ...
    rayWSPS = ...

    // Does this position recieve light?
    occlusion = GetShadowOcclusion(..., rayWSPS);

    // Do some fancy math about energy
    energy = ... * occlusion * ...

    color += energy.xxx;

return color * gLightColor;

Results: ( Its not done yet )

Posted Image

Posted Image
.

Thats all! Until next time!

The beginning of particle simulation

Last Entry: http://www.gamedev.net/blog/1882/entry-2260844-got-new-particle-rendering-up-and-running-simulation-next/

So I got a basic backbones of the simulation system up and running. The simulation happens in a compute shader, and everything just works out, which is great! :) So to test it out I put two point masses with low intensity a bit from eachother, and this was the result.
Next step will to be stretch the particles based on velocity for a fake like motion blur, and then allowing the particles to collide with the objects around them.

GIF: ( Its a bit large )

http://i.imgur.com/il5rcCk.gif

Until next time!

Beginning on terrain rendering

Terrains are awesome, so therefore I’m trying to mess around with them.

I didnt really need to change anything in my engine because I really dont see any reason to seperate a mesh from a terrain like many engines do. So using World machine to generate a small section of a terrain, I imported the mesh file and heightmap to generate and displace the terrain. In the process I saw some disgusting SSAO errors which I still dont get why:

Posted Image

The voxelization for GI:
Posted Image

The diffuse output which is just a really simple shader that lerps between height and normals:
Posted Image

But in the process I saw this nightmare when voxelizing, not good.
Posted Image
.

The shader if anyone is interested. Really simple.

A simple shader file that the engine parses

shader "Simple Terrain"
{
    Properties()
    {
                info = "A simple terrain shader that lerps between 4 textures";
    }
	
    // Considered to be global
    input()
    {
		Texture2D tgrass;
		Texture2D trock;
		Texture2D tsnow;
		Texture2D tdarkdirt;
    }
	
	pass(cull = true ;)
	{
		pixel()
		{
			float2 tex =  input.positionWS.xz * 2.5f;
			
			float3 rock = trock.Sample(ss, tex);
			float3 grass = tgrass.Sample(ss, tex);
			float3 snow = tsnow.Sample(ss, tex);
			float3 dirt = tdarkdirt.Sample(ss, tex);

			float NormalLerp = 
			saturate( lerp( 0.0f, 1.0f, 1 - dot( input.normalWS, float3( 0.0, 1.3, 0.0 ) ) ) );
			
			float3 fvColor =  lerp(
			lerp(grass, dirt, NormalLerp), lerp(snow, rock, NormalLerp), 
			saturate(input.positionWS.y / 20.0f - 0.5));

			output.dffXYZTrA.xyz = fvColor;
			
                        // Yeah yeah its hackyish...
                        // Sets the specular level to 0.2f
			SetSpecular((0.2f).xxx);
		}
	}
}

Thats it, just a bit of progress! Posted Image

New Editor – 2 Days Progress

So we all hate manually ajusting positions and such. “Ohh it should be 0.1 to the right, ohh well, better recompile…. Hmm no actually 0.05″ and so on… So I decided I wanted to make an editor, or start.

Now I had a great problem, which was the fact that my project was built under the /MT option. This was mainly because the normally distributed Physx libraries were built under /MT too. But Qt was built under /MD, and if I recompile Qt under /MT there are certain bugs such as the designer not working ( They also document this ). So, what to do!? So theflamingskunk ( user here ) came to action and said: “But wait! There is a Physx MD ,here!”. I mean, cmon, what are the exact chances of this happening, first time I ever see this guy in chat ever ( Been off chat for a while though ), and he has the perfect solution, awesome!

So after building my project under /MD and reconfiguring ( Takes time, so many linker errors! Argh! ), I finally successfully linked to Qt. However I cant build under /MDd for some reason, not sure why… So no qt debug mode, but it hasnt stopped me, hehe. Screenshots!
Main Editor, where you place stuff and stuff. Currently suppots Assets ( A preconfigured mesh ) and Directional Lights.

Posted Image

Now the asset editor works pretty well in my opinion. The first tab is the base per mesh options, such as material, and so on. However they can change with textures and such.
Posted Image

The second tab is the resource tab, it allows for integrated types, such as normal speular, displacement maps bla bla bla. But also allows for custom textures currently, more to come though:
Posted Image

So with this its easy to add new assets to the scene, go into the asset list and double click it and it spawns, then edit it: ( Asset list is on the far left middle tab )
Posted Image
Posted Image

Now I also made some changes to my voxelization pass to allow wandering around without going outside the bonds of the voxel grid. So I move the voxel grid. However I had loads of artifacts which were HORRIBLE. So moving was not an option. Instead I rendered the voxelization from 0,0,0 and as culling and all of that is disabled, I simply check the position in the pixel shader, and “assume” that the voxel grid is there. No artifacts no nothing. The VERY red, not red, is outside of the voxel grid:

Posted Image

Funny thing: I ended up calling the class that handles the asset configuration AssConfig, because I could.

QAss::GetResources…
QAss::CreateAssConfig…
QAss::…
That’s all folks! Just a summery of the early stages of the editor, so its still pretty rough…

Thanks!

Just don’t use the automated BIOS update tools

So I was an idiot and used Asus Ez update to update a few things, and by mistake selected a new bios. Now the problem is that Ez Update isnt really good for bios updates. Right, so I didn’t cancel it in time and it just got stuck on 99%. Now I was really afraid of cancelling the update, because you know, I might brick my bios. After like half an hour of staying 99%, I just restarted and crossed my fingers. Luckily it actually somehow updated the bios without any errors.

Just… don’t use Ez update for bios stuff… Its a nightmare…
Thats all!

Dont let Hieroglyph 3’s Scene grow!

I finally got my new pc up and running, shes working smooth and quiet with no issues yet. After reinstalling everything, I had some fun with the scene that comes with the Hieroglyph 3 framework, so I added a bunch of plants and grass. This was the result:

Just ignore the red dot and the complete black background.

Posted Image

And thats all, nothing more, just a bit of fun! Posted Image