Tuesday, June 24, 2008

Going on Holidays

Yeah, I'm going to switzerland for about 6-8 weeks or so I'm not gonna post anything during that time. I'm in a rush right now, have to pack this and that....

btw: I hate Flying

Wednesday, June 18, 2008

Fog and Field of Vision

I've implemented some simple fog and field of vision.

Here's a picture:
The red line represents the end of the map. Now the map could go on almost infinitely so it's important that we stop drawing at some distance. This distance is the field of vision and is represented in the following image as a blue line.

To implement field of vision simply do a check:

Blogger is messing up my code, Trying to fix it soon

if((a.z+b.z+c.z)/3 <>
where a, b and c are the 3 vertices of the triangle.
This doesn't look quite so good so we try to blend it out with fog:

The green line represents the FogDistance, this is so that the fog doesn't start right in front of our eyes. That could get annoying, but sometimes it is wanted so just set the distance to 1 when needed. We simply add a little bit more black each time the triangle gets farther away from FogDistance:


Blogger is messing up my code, Trying to fix it soon

int r,b,g; // Color values of triangle

if((a.z+b.z+c.z)/3 > FogDistance) // Check if greater than distance
{
// Make Darker by distance to fogdistance*fogintensity
r = r-(FogIntensity*a.z+b.z+c.z)/3-FogDistance);
b = b-(FogIntensity*a.z+b.z+c.z)/3-FogDistance);
g = g-(FogIntensity*a.z+b.z+c.z)/3-FogDistance);
}
// Very important check if color values are acceptable:
if(r > 255) r = 255;
if(r < r =" 0;"> 255) b = 255;
if(b < b =" 0;"> 255) g = 255;
if(g < g =" 0">


int r,b,g // Color values of triangle
if((a.z+b.z+c.z)/3 > FogDistance) // Check if greater than distance
{
// Make Darker by distance to fogdistance*fogintensity
r-(FogIntensity*a.z+b.z+c.z)/3-FogDistance);
b-(FogIntensity*a.z+b.z+c.z)/3-FogDistance);
g-(FogIntensity*a.z+b.z+c.z)/3-FogDistance);
}
// Very important check if color values are acceptable:
if(r > 255) r = 255;
if(r < r =" 0;"> if(b > 255) b = 255;
if(b < b =" 0;"> if(g > 255) g = 255;
if(g < g =" 0;">



FogIntensity should be very small, just try it out. Something like: 0.0001

That's it for today, I'll hopefully implement colors next.

Thursday, June 12, 2008

Ubuntu

SummerHoliday = True;
if(SummerHoliday) System.out.println("Yay");

A friend of mine(my teacher, heh) got me interested in Ubuntu and I must admit it's rather god(intention++; spelling--;) compared to windows. I'm trying to install Ubuntu on my current computer so I will have dual boot(XP/Ubuntu). So far it's all working except the start-up takes 5min., that's the thing I'm working on right now of course.

Ubuntu is a great operating system if you enjoy do-it-yourself guides and want to know whats going on behind the scenes. It has shiny, quick, great, beautiful, work-enhancing, graphics which you can turn off if you have a different opinion. It's very clean since everything can be installed by packages from one place. No need to buy a CD or search the web for a cracked version, everything is completely free. (rambles on about how secure it is...) *dreams on*

After installing Eclipse and if needed JDK/JRE (Java Development Kit/Java Runtime Environment) I'll be back to my 3D engine. I thought about a simple implementation of colored triangles and field of vision fog.