Site Rebuilding
Please excuse the mess while I setup. The new site should ve running soon with a podcast to match.
Concrete Examples of Conversations
Not much progress tonight. Looking at examples and the refrence scenario, getting bogged down in detail.
Will look at a code implementation of Thursday
Dissertation: Atomic Structure
Dissertation: Atomic Structure
A sample atomic structure laid out in a document.
Query and Response forms also discussed.
Cube Maps Ahoy
Cube Maps Ahoy
So there is a slight glitch with the reflection but ALMOST there.
Water
Water
So for those of you curious I’m throwing down some water rendering magic. Not to mention real-time environment cube mapping. Behold the result.
So it’s broken and the ocean needs some motion (pun fully intended). I also may be slightly sleep deprived… but onwards and upwards.
Shadows are EVIL
Shadows are EVIL!
Okay above you see rough and blurred. The rough pass uses a single sample against the depth buffer. Those bloody pixels are a result of the resolution of the shadow map.
The blurred insanity is a shadow method called PCSS, based on the White Paper, “Integrating Realistic Soft Shadows into Your Game Engine” by Kevin Myers, Randima (Randy) Fernando, & Louis Bavoil. Sadly some of there stuff uses Shader Model 4 so I did my best approximation.
Not happy with either method… pulling my hair out.
To Debug it… Draw it
To Debug it… Draw it
Many people will tell you this but whenever you have a problem try to visualise it. This can be applied to almost everything (except cases where visualisation is a constraint, think advanced maths and quantum). So above you see the debug frustum.
Well after fighting with all these various problems I’m thinking to myself… I need to double check my Frustrum. Five minutes to write and BAM problem is instantly visible. The problem I was debugging for 5 hours solved in 5 minutes.
Printf & Debug Draw rocks.
Problem: Shadows giving strange LightViewSpace results
Well the problem manifested in many ways. I was debugging shaders and tweaking render targets. Not to mention twiddling the depth bias so often that it was indecent.
The problem was two fold. Firstly the sun view & position didn’t match up. The result of a quick hack to get the sun in the right place, hacks bad. The second issue was todo with the scene bounds.
The view matrix is built with a look-at call. Well the key is that the centre of the bounds must be equal to the look-at target. Why is this? Well draw some random shapes on an A4 page. Now draw a circle which contains all those objects. Now measure the radius of the circle and draw a square at the centre of the page with double that length per side.
You see the problem, unless the circle is at the centre of the page their will be bits of it outside of the box, which means they won’t be shadowed.
So you compensate for offset and increase the radius. To do this instead of measuring the radius of the circle measure the distance from the centre of the page to the furthest point of the circle.
Before you ask we can’t move the box from the centre of the page as that would change the angle the light was coming from.
Onwards and upwards.
The shadow is low quality due to…
Wooot!
Progress, the shadow is low quality due to PC card limits. I need to add some bias to avoid flicker, and smooth off the edges to get soft shadows.
Distractions
So climbing into bed last night I got a great idea.
Debug the Light ViewProjection matrix by using a camera with the same matrix. Well you know how I managed to knock together that skybox so quickly. Well I dug into it…. YIKES.
I managed to get the sky shader down from 64 instructions to 27 instructions, and remove 4 branches. Sadly the sun doesn’t look great. On the bright side the Sky Sphere now respects it’s World Transform. Light amount now tied into horizon. Removed that horrible change line. Lost the tinting.
So this is what happened…
Oh wait I can clean up those 2 lines quickly… later… Hmm this could be improved… later… wasn’t I meant to be coding something?
Yeah so now after all that fiddling, I’m now working on the shadows again.