2014년 12월 12일 금요일

light propagation volume + tiled forward shading + cascaded deferred shadow

Now, I am developing software for smart TV.
So, I don't making game or game engine anymore.
My current job is still related game industry, and now I mainly works in linux & Xwindow & open gl es & EFL & Tizen.

But I still likes making games and have lots of interests on cutting edge tech about game engine.

So I am making small rendering engine as a hobby, I am also making mobile games using cocos2d-x(great 2d game engine with great tools), but it is not finished yet.
And this is the result of my hobby rendering engine.

light propagation volume(compute shader) + tile forward shading(4096 point light) + cascaded deferred shadow + multi threaded rendering + assimp + dx11 + shader caching


I heavily used compute shader in this project. because the major goal of this project was to learn DX11 compute shader. but still used conventional pixel shader tricks when making LPV. it was difficult to do it with only compute shader. Compute shader is makes graphics programming really funny and intuitive work. I really became fan of this.


I really enjoyed while i was working on this project. and It is still in progress, I am planning to add lots of features(hdr bloom with compute shaders), but i dont have enough time. Because In the new company i have to work overnight usually.
I hope i get more free time in the future and to put more time in my hobby engine and hobby game project.

2013년 2월 3일 일요일

Deferred Shadow.

I added shadow into my test engine.
It is called "deferred shadow". It is same with standard shadow technique, except that the shadow term is calculated in the deferred pass. Like deferred shading, we can reconstruct shadow space depth and compared this value to shadow map pixel value. Like deferred shading, this technique simplify engine architecture very much.



2013년 1월 21일 월요일

Deferred shading works.


There is 1 blue point light and 1 green point light in the scene. For every point light, Full-screen quad is being drawn. But final objective is tile-based deferred shading using compute shader. this is test for building blocks(g-buffers, view space positions, normals) for that.

2013년 1월 19일 토요일

This is my drawing. I wanted to draw cat at first. But it became a dog.


2013년 1월 18일 금요일

Weird thing in converting device depth to linear depth.

Below is the functions I used to convert device depth to linear depth. I derived this code from the projection matrix.


// Projection._34 = zn*zf/(zn-zf)
// Projection._33 = zf/(zn-zf)
//float A = Projection._34;
//float B = Projection._33;
float A = ProjectionParams.z/zf;
float B = ProjectionParams.w;

float LInearZ = A/(DeviceZ + B);

It did not work. when ZNear value is not small, resulting linear depth was smaller than the real linear depth.

But when I change the code like below, It worked.

// Projection._34 = zn*zf/(zn-zf)
// Projection._33 = zf/(zn-zf)
//float A = Projection._34/zf;
//float B = Projection._33;
float A = ProjectionParams.z;
float B = ProjectionParams.w;

float LInearZ = A/(DeviceZ + B);

The difference is deviding by 'zf' is done in CPU code. It is exactly same as the crytek's GetLinearDepth function. I still don't know what is the cause. 

2013년 1월 16일 수요일

read only depth stencil view in deferred shading.

In deferred shading, We have to both reading and writing with depth buffer. And We can't set depth buffer as rendertarget and set shader resource simultaneously.
So we have to create additinal read only depth stencil view and set it as rendertarget when lighting pass. If not, reading depth buffer will fail.



D3D11_DEPTH_STENCIL_VIEW_DESC desc;
desc.Flags = D3D11_DSV_READ_ONLY_DEPTH;


I wandered for 3 hours about this.

2013년 1월 14일 월요일

Calculating global time for animation clip.

The "Game engine architecture book" says that using global time instead of local time has several benefits. So I applied this algorithm to my current animation implementation.

Here is source code for calculating local time from global time.


float CurrentGlobalTime = GEngine->_TimeSeconds;
float NT;
if(_NumPlay == 0)
{
    NT = FLOAT_MAX;
}
else
{
    NT = _Clip->_Duration*(float)_NumPlay;
}

_LocalTime = fmod(Math::Clamp<float>((CurrentGlobalTime - _StartTime)*_TimeScale, -NT, NT), _Clip->_Duration);

if(_LocalTime < 0)
{
    _LocalTime = _Clip->_Duration + _LocalTime;
}

It works for loop and plus and minus time scale, but I think handling minus time scale is a little dirty.

looping


3x faster

repeat 3 times and stop



reverse (minus time scale)