December 24, 2012

Test subject #1 enters the chamber

by Niklas Hansson

So after careful preparation and planning our test chamber is now ready for it’s first test subject #1 which we all hope will last longer than he did the Project Temporality timeline. If we somehow manage to reach #87 in the chamber it probably means we are so old that the game won’t run on any hardware anymore. But then we aren’t conducting secret time manipulation experiments in the further parts of the solar system so we think it will be ok :)

Anyway the addition of another pet is a nice addition to our office and a great morale boost which we could use as we are in getting things done(tm) mode and any breaks are welcome. But we are progressing well and our updates here will only become more and more frequent as we are growing nearer to one of our big deadlines.

Meanwhile you can enjoy observing our first test subject and more game related posts will appear shortly.

Share this



Test subject #1 enters the chamber Test subject #1 enters the chamber Test subject #1 enters the chamber Test subject #1 enters the chamber
December 14, 2012

Time in Project Temporality

by Niklas Hansson

So for this week we want to talk to you about the concept of time in Project Temporality and how it all works. But first lets talk about how time is considered to work in the real world. This comes down to the question of what does time really mean ? The core concept of time is entropy, so as time moves forward the amount of energy and therefore matter in the universe will continually decrease. There is no theory or process known to man which can stop or reverse this entropy. The amount of matter in the universe is constantly decreasing since the big bang and in an absolute insane amount of time there will be no more matter left in the universe. This is what we call time, this constant decrease of energy in the universe until it reaches zero.

This is tied into the “Arrow of time” concept which means that time is an arrow that can only go in one direction as straight as a arrow until the end of the universe. This is probably the easiest time concept to understand for the laymen, time keeps going forward no matter what we do and we can’t stop it or change it. Except that in the world of Project Temporality we somehow have managed, or have we ? It can be thought of that going back in time does not reverse the direction of the arrow instead you go back to an earlier position along the arrows path and starts over from that position but the arrow still only goes in one direction. Of course all of this is highly theoretical, like the theory that at every possible moment of choice parallel universes are created for all of our choices and those going back into time to do another choice does not really change the universe you resides in but instead changes which universe you perceives. This creates a branching arrow instead where going forward new universes are spawned constantly like a tree is growing except there needs to be one universe for every choice every single person does.

So how does it work in Temporality ? Well we are definitely subscribing to the arrow of time principle where the whole universe can be seen as a series of actions moving along a single line following the arrow. When we rewind time you move backwards to an earlier point of that arrows path and inserts new actions. Those new actions changes and modifies the actions that existed earlier when time goes forward creating a new future which may be very similar but might also be completely different depending on what you changed. So you can never go back to the future or forward in time because at any given point in time the arrow is at a certain position and you can’t move ahead of it. When you jump backward you are basically reseting the arrow to an earlier position and the world moves on again from that position.

This is shown in the gameplay mechanics of Project Temporality. When you are in our Timeline mode you are observing the timeline by looking at what we world looked like at any point in time. While in this mode you are not changing anything you are only observing time. So when it looks like you are moving forward in time in reality you are only looking at a newer part of the timeline and you can never look beyond the position of the arrow. This means that because time has a start and a direction from that start it is really just another dimension added to the other three, and you can traverse it freely in this mode. From the timeline you have two different actions you can take, you can jump to a point in time or you can spawn a new clone at a point in time (also jumping to that point). If you jump to a point in time that point becomes the current time and all things further along the time line is discarded and is instead simulated again as time moves forward.

If you select to create a new clone the results are slightly different the arrow is still moved to that point and the worlds starts moving forward again along the direction of the arrow of time. However there will be two copies of you. One is the old you the one that existed before you created the new clone. That copy of you will try to perform exactly the same actions as you did in the future before rewinding time which means that if the world is unchanged it will perform the same actions. But if you change something ,for example moves a platform that the original you was supposed to land on he will now fall to his death and die. The new clone of you is what you are given control of from that point in time and for all practical purposes is you . This means that it isn’t really you who moves forward but a duplicate of you while the old you continues on repeating history.

Understanding time and how we use it is the core of playing Project Temporality, you have to wrap your mind around time as the fourth dimension and start thinking about what you could do if you had duplicated versions of yourself to help yourself. Of course the arrow of time has some limitations if you move forward and spawn a new clone and then move then rewind till before it is spawned and creates a new clone the other clone wont’ be spawned as you are not performing that action anymore. It’s not the clones that manipulate time it is you. Which will create some interesting dilemmas when you need to retrieve an item and can’t just let any clone do it.

Share this



Time in Project Temporality Time in Project Temporality Time in Project Temporality Time in Project Temporality
December 8, 2012

Sparta 3D : Physically Based Shading

by Niklas Hansson

For this entry into our this is Sparta series we are going to talk about our shading system. It’s going to be quite a bit in depth so be prepared. After this we will go back to talking a bit more about the softer parts of the game. As mentioned in the last post we are careful to do our calculations in a physically correct color space. But when we come to our shading equations we take it one step further by using a physically based BRDF(basically a shading equation) instead of one based on observation (like the phong lighting equation). For people interested in a deeper understanding than we can cover here you can either look at my Nordic Game Conference Speak on the subject or you can read Naty Hoffman’s excellent papers from siggraph 2010 Here and Here.

So what do we mean with physically based ? What we mean is that we respect the basic properties of light, for example when light hit’s a surface a part of it is reflected (this is what we call specular light, light that has never entered the material and therefore isn’t colored by it) another part of the light enters the surface and some of this is absorbed by the surface but some re-exits the surface this is the part we call diffuse light and is the part of light that takes on the color of the object, so this is the light we mostly see. Well one thing that a physically based lighting (PBL from now on) should ensure is that the amount of light that bounces from the object can’t be greater than the amount of light hitting it. Pretty obvious but not a rule in computer graphics in fact fixing so that this is true is called energy conversation and is an important part of being physically based, Neither Phong or Blinn-Phong are energy conserving in fact booth of them reflect more light than hits them under a lot of material presets.

For Blinn-phong or Phong this can be fixed by adding a normalization factor that guarantees that the amount of light reflected cannot be bigger than the incoming light.The normalization factors does this by lowering the strength of the specular light if the area reflecting light is larger and making the light stronger if the area is smaller so that the same amount of light is reflected no matter the size of the highlight assuming the surface’s substance is the same.

This all works using something called a Micro-Facet BRDF(Bi-Directional Reflectance Distribution Function). While this might sound advanced it is basically creating the surface as a multitude of facets of perfectly reflecting mirrors.The rougher the surface of the material the more different directions the mirrors point in. And the BRDF calculates which % of mirrors are pointing directly at your eye. This is what is referred to as the roughness of the material and is what decided if we have a large weak specular or a small strong.

The other value that is necessary when doing a physically based solution is a substance value, this is the reflective property of the surface which means how much light it reflects and is based on it’s real material. For example all steel has the same substance because it’s steel but some steel has a mirror like reflection and some does not and this is due to the roughness. Brushed steel has a very high roughness for example.

Of course just having energy conservation inside the specular isn’t enough what if we have a nice shiny white material then it would reflect a lot of light but a lot of light would enter and re-exit the surface meaning it still emits more light than hit it. In this case we need energy conversation between the specular and the diffuse part. This is due to the fact that light that bounced can’t enter the surface because it has already bounced, this sounds obvious but a lot of game engines doesn’t handle this properly.

However the big advantage for me with going physically based (except that the Artists saves a ton of time thanks to much easier maps to work with) is that because your values actually mean something you can use them to handle ambient light and reflections with proper blurriness too. So that reflections and specular works together. This requires that you blurs your cubemaps correctly but works like a charm and is used in engines like CryEngine3.

For our cubemaps we however went one step further. Normal cubemaps has the problem that they don’t match up with the objects reflecting in them they are just a image being reflected. We instead use a technique called Box projected cubemaps where we project the cube images on a mesh representing the room and then correctly fins the reflection intersection with that one and finds the proper pixel. This allows us to have working reflections booth glossy and non glossy essentially for free. The same technique is also used to re project bounced light inside the room on objects moving through it.

In these examples you can see the effect of the box projection in the first one I have modified the wall segments closer to me to have a blurry reflection so you can se the button in the middle of the room of them (You can also observe the visual difference compared to the last one that doesn’t feel as metallic even where we can se no reflection this is an effect of our energy-conservation between specular and diffuse light.

This next image shows the effects of box projection using different roughness values on the floor pieces.

Backing all this is a fully deferred renderer, but thanks to our use of a physically based shading model we can produce a wealth of different materials without letting our G-Buffer get out of control size wise. We hope you have enjoyed this look into the more technical side of Project Temporality and as always don’t hesitate to tell us what kind of information you are interested in hearing about.

Share this



Sparta 3D :  Physically Based Shading Sparta 3D :  Physically Based Shading Sparta 3D :  Physically Based Shading Sparta 3D :  Physically Based Shading
December 5, 2012

This is Sparta

by Niklas Hansson

This is the first in what will be a series of articles talking about the tech we have built to create this game, Sparta3D. We have gotten a couple of requests to delve a bit deeper into the technical side of what makes our engine tick and how it’s creating this special look so here it is. The basics that we built Sparta 3D on is a couple of Techniques .

  • Properly gamma corrected Linear Space lightning
  • A Physically based lightning model.
  • Deferred Rendering
  • True Quadratic Light fall off
  • Box projected cube maps
  • Temporal multi resolution SSAO
  • Bounced Light Solution

All of this also boils down to a couple if philosophies with the main thing being “In computer games most lighting is hard and harsh but in real life most of it is soft”, “While it’s easy to make a movie look good with yellow and teal a more full colored spectrum is more interesting” and “The basics of a good looking image is good lighting”. So all the we have done with the engine is focused on these things to allow a soft nice environment with lush colors and with a high quality lightning that doesn’t require to much artist work to look good. This does not necessarily make it a better or a worse engine. It makes it a better engine for our specific game. This is a bit of a test run to see how much technical depth we should go into here so we’ll gauge the interest, but let’s get started on the specifics.

One of the most important things when doing 3d rendering is to get your lighting calculations to work properly. If the lighting is off great artists can work hard to salvage something but it’s always gonna be an uphill battle. Since we won’t our artists to spend their time working on creating as high a quality as possible we don’t want to force them to fight the tech, we want the tech to help them fight their battles.

One of the issues when doing lightning is Gamma, this actually comes from how the monitor is displaying your image instead of from your code but you still will have to compensate for it. Due to how old CRT monitors worked a linear change in value for the RGB channels resulted in a non linear change in value on the screen. This might be a bit confusing so I’ going to explain it using some images created by John Hable

The blue line in the middle is a linear line straight upwards which would mean that brightness would follow the RGB values. However the red line is what actually happens when you try to output an image through a computer monitor and this is due to the old CRT monitors (which all modern LCD,TFT,LED etc mimics). So what we need to do to keep data looking correctly is to first apply the yellow curve before we send it to the monitor which will apply the red curve and they will cancel each other out and everything will work out ? Well as long as you don’t make any changes to the data like blending textures or performing lighting you don’t have to think about this. Because the artist created the texture on a Screen it is already over brightened with the yellow line to look correct, the same happens if you are making a digital photo it automatically applies the yellow line to make it look correct.

Like you see in this image from John Hable some transformations is performed the mathematical transformations for most screens can be approximated as Gamma 2.2. This means that the monitor takes your input value between 0 and 1 and raises it with 2.2 this is the red curve. While raising it with 0.45 is the yellow curve. So as you can clearly see here the camera over brightens the image before saving it to disk to compensate for the screens darkening.

So why do this matter to us ? Well what happens if yo would like to add together two images that we say have 50% brightness. Well this gives an RGB value of 187 in monitor space. If we add them together we would get a RGB value of 384. Way above the 256 of clear white we expected. However if we first apply the red line to get them back from an over brightened state to the blue line we would be adding 128 with 128 and create the expected 256 (capped at 255 as a max number), afterwards we will have to apply the yellow curve again to get back to what the monitor is exspected but sicne 255 maps to 1 and 1 raised with any power is still 1 everything works out. For extra information look at GPU Gems or John Hables webpage or for more in depth the Uncharted 2 Lightning presentation.

Working in XNA sadly Microsoft removed access to the hardware free gamma to linear and linear to gamma converters in going from XNA 3.1 to 4.0 so we actually have to make all these conversions in shader code which does cost some performance but not doing it was never an alternative visually. I will here link an example from the GPU-Gems article.

Booth these images were lit with a white light source of the same strength the left one uses linear space lighting and the right one does not. Notice the burn out areas on the right picture and also the yellowish tone (this is an artifact of making lightning in gamma space the specular will burn out to a surrounding color and not have the color of the light ). The left looks a lot more natural and error free, this technique allows us to experiment with a lot more and stronger light sources while still maintaining good balance in the image.

We’ll be back soon with a follow up article about our physically based shading solution but this article did already get longer than it was planned so we have to cut it of for now. On the same subject we are currently hard at work putting the finishing touches on and lighting two entirely new environments that will be quite different from the ones we have showed up in trailers and screenshots so far, we just want to polish it a bit more before we can start showing them off.

Share this



This is Sparta This is Sparta This is Sparta This is Sparta