2016년 3월 27일 일요일

Incorrect naming in UE4 skylight source code.

Recently, I am reading UE4 skylight code. and found that they call projected SH coefficients as "IrradianceEnvironmentMap".

Actually, this naming is wrong.
They make this Irradiance SH Function by producting cosine lobe in the end. But until then it is projected "Radiance SH" not "Irradiance SH".

Let's recall basic rendering process using spherical harmonics.

1. Project SH coefficients from radiance cube map.
2. Convert Radiance SH to Irradiance SH by dot product with cosine lobe
(Ravi Ramamoorthi's paper)
3. Evaluate Irradiance env map with normal vector

Let's see two different shader code for SH shading.

Below code is hlsl from MJP in gamedev.net
This is easy to understand.
There is radiance SH, cosine lobe.



And below is code from Peter-Pike Sloan
This code seems to be just a sh evaluation code.
The secret is coefficient for cosine lobe is already producted to radiance SH(and it becomes Irradiance finally!)


Later code may be a lot faster(because use fewer shader instructions).

UE4 call value after 1 as IrradianceEnvironmentMap(it becomes irradiance in the end, but not at first).

Although final rendering is OK, But Incorrect naming confuse stupid reader like me.


2016년 1월 25일 월요일

UE4 Rendering thread problem related to Editor

UE4 has multi-thread rendering architecture which is similar to UE3(almost same..).
Game thread datas(PrimitiveComponent..) and Rendering thread datas(SceneProxy..) are main components of it.

Game thread enqueue asynchronous rendering command continously to rendering thread. Applying changed property in game thread to rendering thread is one of them.

Usually there is no bad thing here. Until Editor and UpdateRendertargetCapture are used together.

case :
1. Component property is changed by editor click.(from Window Msg Pump)
2. There is 2dSceneCaptureActor in the scene.
3. GarbageCollection is performed.

problem :
1. some object could be garbage collected.
2. Scene could be rendered before change of property is applied to render thread.
3. Garbaged collected object could be referenced in rendering thread.

I resolved this sitation by FlushRenderingCommand. But still, We could say this is flaw of UE4 multi-threading or update capture architecture.

2016년 1월 8일 금요일

Improving outline postprocess using stencil operation.

There is excellent tutorial for Outline postprocess.

http://www.tomlooman.com/ue4-outline-post-process/

His technique support pretty outline using custom depth(simliar technique is already being used by editor selected object), and also provide nice multi color feature too.

But what if your game designer want to specify occluders who cause occludee outlined?

Here is my solution.

1. occludee writes team color ID to stencil.
2. occluder increment stencil by 1(to do this, we need to slightly modify custom depth path, PrimitiveComponent has occluder/occludee flag and it is rendered seperately in custom depth path)
3. In PostProcess, only increment stencil pixel is considered as "outlined"

This is very useful when there are too much outline in screen, and we want to use only needed.


Got full time graphics programmer job.

Recently, I came back to game industry. and am now full time graphics programmer.
People might say that why would we need graphics programmer if we use engine like UE4. but even UE4 doesn't have all the features we want. so there are tons of things to be touched by graphics programmer.

Fortunately, UE4 is a lot easier than UE4 to modify or extend.

Here is what I am doing now.

1. understand inside of renderer, and guide artist team to use engine correctly(ex: PBR input)
2. adding missing features(ex : lighting channel in UE3 or Hair rendering and etc..)
3. make tools for faster artistic iteration and faster tweak.

I am thinking if there are more things to be done. and these are very interesing so far.

I will post some tips later.

2015년 4월 27일 월요일

Ark online.

I made this game while I served in military duty. In south korea every man server military duty. But some people was able to work in the IT company for 3 years instead of going to military.
I mostly worked on game engine.
I made quad tree terrain and dynamic weather system and runtime vegetation generation.
Considering it was almost 10 years ago, I think the visual was quite good.













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.