Archive for June, 2009

RealKo Engine: Updated Map 3

Wednesday, June 24th, 2009

Hey, nice to be here again.

Now the map is updated (current code is 3), you will see quite of improvement stuffs in the scene.
The map now included with buildings, highways, trees, lots of texture lights, the emissive map (which you can see the building turns on its own lights in the night),  and more and more detail on textures.

My artist has done quite a great job here. Lots of the time which he spent on the detailing the textures for each mesh. Diffuse, normal, specular, and emissive map and others too, when integrated with RealKo Engine, can give nice and virtualized both in feeling and actual quality in the scene.

I have captured a lot of screenshots here so I dont want to waste any time now, just see them below.

Last 13 screenshots (before last 2) of above gallery are the most recently updated from my experiment with light’s properties.
I have changed the position, color, specular intensity, radius, etc of the light itself just to see the different in variety in the scene. There are 1 directinal light for sun, and other 10-13 for point lights in the scene you just saw above.

Sorry for my english this time, it’s quite late now and I feel blurry. But I really want to finish the post to show you the improvement right away, so please don’t mind this thing :)

Til next time my friends.
Thanks for coming by.

RealKo Engine: Update working gallery

Saturday, June 20th, 2009

Hey, my friends.

After having a good long rest, I decide to come back quickly and start to work again!!

Programmer should have some naps right? If energy is too low, or some of the motivation has gone, it’s the time to refresh thing up by doing anything that not involving with code. That the couple of days for my day-off, but please do not worry because this time I also have something to show you again.

It’s the working gallery from my lastest testbed on the airport map. The map is updated from my professional artist, P.Yod. As I have said to you last post about the power of texture lights. They come in handy and we will put them to use again for the lights of airport. They’re cheap, nice to look at, and they’re alpha stuff that need to be cared if used in deferred shading process.

I did the same as I did for my alpha scene stuff, just draw them on top of the deferred shading scene. Thus everything gonna be in our control.

You will see the 2 types of light again. One for static light the same as what you already saw from the airplane’s head light. Another for signal light, blinking all the time in the night. The different this time is that we gonna apply lights for building, runway, taxi way, and ground under building. No matter where’s the position they’re located, the algorithm behind the scene is the same for airplane’s alpha stuff (for both types of light).

In the scene we can control all the lights (to turn it on/off, and blinking which depend on the type of light), in which the lights are brought into the engine via config file. Currently 2 types are allowed.

Also note that the map is not fully updated, some of the assets are not finished and put into the scene yet. But it’s quite close now.

Now don’t waste time, let’s see the gallery below.

RealKo Engine: Airplane asset and their functionality

Sunday, June 14th, 2009

Welcome back my friends.

Lots of improvement in term of airplane asset and its related functionality inside the engine have been done. They are now quite close to stable.

For what I have planned before dumpping myself into the code is this.
For the airplane asset configuration, there are many type of airplane such as “Boeing 747 - 100 class”, or “Boeing 747 - 400 lcass”, thus I plan to let the user who implements upon my engine to edit the config file. By inserting the information about all type of airplanes that will be used in the simulation, in this way the engine will know how to treat each type (but not too flexible, due to the limitation on particular artist-method => there are many ways to do things, so the limitation on this will surely comes to play.) and hold all of the information.

Anytime user wants to create new airplane entity and put it to fly over the airport. He/She just grabs the desire type of airplane information (which now already loaded prior to the content-load period)  from the engine, and create one.
As you may see the flexibility for creating process,  content-loading process, and clean code can be achieved. Thus user can be more focus on the core part of the simulation itself, not wasting time too much on misc steps to create just one another airplane entity.

In fact RealKo Engine relies heavily on the config files. All of the model which are airport, airplane, skydome/clouddome, and others to come will use the config files. You may ask it’s a bit of cumbersome to edit the config file and thus giving the slow on setting up the scene. But it takes time at first but then after user specifies all the assets’ information, user can now be freely from that part and move into the actual core of the simulation. The final result is better and better. Anyway not all the engine uses config files, it’s up to the situation and case. For RealKo Engine, I must le t the user freely specifies new type of asset, enable them to modify the resource (not worry about file name, name of file can be changed, but just reenter that name in config file.), and it some assets are modified by user, they can reedit the config file and keep going. So at this point I think you have got what I mean. ;)

Okay, let’s talk about airplane. Airplane has lights, right? That’s true. But my clients said that Suvarnabhumi Airport can hold about 400 airplanes at once! If you think along with me, one airplane can have at least about 5-6 lights attached to itself. RealKo Engine powered by the Deferred Shading Rendering System, thus it can support more light (specially for many small point lights, as they’re cheap.). But not for this, if we use real lights attached to each airplane.
If we do so, 400 x 5 = 2000 lights will be on the scene at once, hauhhhhh!!!!! At first glance this is not possible at all.
Nevertheless that I already know it’s not the solution I will take and go on with it, but I will test it anyway.
By inserting the lights into the scene for 2000 lights, my GTX 275 is pulled down to earth at the rate of 2 fps. Immediately I switch back to another solution ….

Another solution suggested by my artist leader (P.Yod), he said that we will use the textures instead of lights. I agree and it’s the similar thought as mine as well. One drawback if we use the textured light is that “far far away, we may not be able to see the light, and some visualization will be gone”. If the textured light is lit by light sources in the scene, absolutely we will not be able to see the light of airplane in the night (in which we must have light shows well and clearly in that time!!).

After P.Yod sent me the airplane resource, and I saw the textured light is alpha texture. The solution just come out directly from my head. We will draw it externally after deferred shading process is finished thus this will give the best result as the particle system that I have faced it before and solved it. By drawing the alpha textured light on top of deferred shading result, the light-calculation will not be taken into effect, and we see it clearly in the night, for the day time, the alpha textured light will be blended nicely with the pixel already resided in the color buffer and thus it will automatically reduce the strengh of textured light attached to airplane. WOW!!!! (In the night of course, mostly the color in the color buffer is quite close or in the theme of black color, thus it will step up the strength of texture lights attached to airplane.)

There are 4 types of light for airplane.
1. Window light, light coming from the inside airplane through the window. Thus simulating the night time.
2. Head light, turn on before landing process begins.
3. Signal light, always blinking at night
4. Ground light, will be turn on when airplane landed or touch the runway (thus simulate the realistic light, but infact it’s just the textured light.)

To draw those lights stuff correctly, I decide to create just another effect file for those light-type.
I categorize the light into 2 types.
1. Non-blinking light
2. Blinkging light

Both of them is similar in code, but just when doing this stuff for blinking light, I use the current time from engine, and put it into sin() function to calculate the intensity to be applied to texture light. Thus it will be like blinking!! That’s all, simple enough.

See that section of code from my effect file to draw the blinking light below.

float4 PixelShader(BasicPSInput input): COLOR0
{
	float4 color = tex2D(diffuseSampler, input.TexCoords);
 
	//calculate the light intensity used specially for the signal light (blinking effect)
	float intensity = sin(time);
 
	if(intensity < 0)
		intensity = 0;
 
	color *= intensity;
 
	return color;
}

I think you already get the idea from seeing the code above.
If the intensity is below 0, then I will not take any risk to multiply the color with negative number, I just want it to be dissappered. So let it be zero, 0 will be better.

When combining the particle scene with the airplane, in the time of collision or just normal weather effect.
The visual effect is more enhanced in the way we can feel it, and appreciate the result it can give us.
(Remember that deferred shading is backed the engine up, so the lighting calculation is more neatly and at least cost as it can be, thus giving another advantage.)

Enough for chitchat now, let’s see the real stuff below.
Please enjoy!!!

XNA Game Studio 3.1 is released now!!

Friday, June 12th, 2009

As the xna team works quite hard to get the new XNA Framework version out every period of time.
Now XNA Game Studio 3.1 is released.
You can find more information from http://creators.xna.com.

And also the important thing to note is that, if your project is relied on the framework version 3.0. You can upgrade your project into 3.1 with ease. Refer to http://creators.xna.com/en-us/article/convert30to31 for step-by-step.

I’m quite pleased with one of the features, more at http://creators.xna.com/en-US/news/xnagamestudio3.1, it’s about the sound stuff. Now you can play sound with just one method call, and it will do the burden job (initialize, releasing the resource, etc for us). Wow, it maybe the time we can take the sound into the game with fun feeling.

Enjoy new version everyone!.

RealKo Engine: Apply textureset with airplane

Friday, June 12th, 2009

Hey, we meet again.
I hope to come back in a while and post something in progress about my RealKo Engine.
Okay, this time I will show you the real stuff of airplane applied with diffuse/specular/normal mapp.

I have found out by myself, get the feeling that only the diffuse map is not enough in this modern day. Every models, if possible, should have all the basic textureset that is diffuse/specular/normal as the base. For other maps, it’s up to the implementation. That textureset can enhance the visual-feeling of the material for each of the different model in the game in the great amount. By combining it with the deferred shading, you can get most the visual quality (along with performance at the same time).

For what I gonna show you now is the demo scene, consists of 2 boeing classes which are Boeing 100 with master texture, and Boeing 400 with Thai Airways texture. Also with the preset 3 lights which are 1 directional light (sun light which point straight downward), and 2 pointlight which one of them is located near the airport tower, and another is located infront the tower on the runway-floor, both of point light just be a bit higher from the ground.
Note that one of the point light has Coral color, another has white color.

The demo scene demonstrates the effect of light, particles scene integrated with deferred shading process (in fact it’s just drawed after the deferred shading result), textureset applied for model (boeing in this case). And you can see other minor features by yourself in the gallery below.

Before I show you the gallery of this demo scene, let’s see the textureset applied with the airplane itself first. Just to get some feeling of how important the diffuse/specular/normal can enhance our scene and overall visualization.

Textureset applied with airplane

Diffuse Map

Diffuse Map

Specular Map

Specular Map

Normal Map

Normal Map

Those are textures used and applied with the airplane model.

Note: The reason I tell my artist to do the gray scale format for specular map for me is that, my shader code will get the data out from the specular map in one whole scalar value, not color. So by choosing the gray scale, we can just read the red channel of the map and that’s it, just furthur apply with the lighting algorithm then we’re done.

See my excerpt shader code for that part.

if(specularTextureEnabled)
{
output.Color.a = tex2D(specularSampler, input.TexCoords).r * specularIntensity;
}
else
{
output.Color.a = specularIntensity;
}

Let’s see the result of all we are talking about.

I also included a couple of images that aren’t applied with textureset.

Okay, it’s late now haaah!!
Until next time my friends.