Archive

Archive for March, 2008

Pictures of my new Macbook Pro

March 13, 2008 Leave a comment

Hi all, I’ve added some pictures of my brand new Macbook Pro! Take a look at them, just click on my flickr pictures on the right..

Soon I’ll post a little review on it and the third and final part of TSM tecnique!

Make it translucid! (Part Two)

March 3, 2008 2 comments

The last time we discussed about the approximations needed to compute translucency in real time using TSM. We also created a translucent shadow map and now we are going to use it…

4 – Light diffuses through the material

The light entering the material diffuses in it according to the Rd equation Rd Equation(take a look at the figure on the right).

Thanks to the TSM computed in the last article, we only need two more informations: X_{in} and X_{out}. X_{in} represents the fragment coordinate (in light space) were light enters the material, while X_{out} is the point from which the light leaves the object.

In practice, X_{out} is the fragment coordinate as seen by the camera moving around the object PROJECTED in light space. Once you get the fragment coordinate from the vertex shade, you have it automatically projected in camera (or view) space: since we need to compare this with the data stored in the TSM, we must have them both in the same space (light space). The projection in light space is done by multiplying the view-space-projected coordinate by the camera’s model-view-projection matrix inverse: by doing so we get the object space coordinates, ready to be multiplied by the light’s model-view-projection matrix.

Once we have projected X_{out} in light space, calculating X_{in} is just a matter of shifting X_{out}‘s (x, y) coordinates by a delta (usually the size of a pixel – 1.0/resX and 1.0/res if you want resolution/ratio independency). In this way we can compute translucency simply by filtering the TSM previously calculated. An elegant an also pretty fast solution, if you ask! Of course, this method have some drawbacks: it assumes the object being completely convex so some errors might occur, even though them not being visually important in the majority of cases…

Rd function in GLSL:

vec4 multipleScattering (vec4 Xin, vec4 Xout, float lvl)

{

   vec4 finalColor = vec4(0.0,0.0,0.0,1.0);

   float e = 2.718281828459;

   /***************************/

   //irradiance, depth and normals must account for coordinate shifting!

   vec4 irradIN = texture2D(Irradiance, Xin.xy,lvl);

   vec4 depthIN = texture2D(DepthBuff, Xin.xy,lvl);

   vec4 sNormIN = texture2D(SNormals, Xin.xy,lvl);

   //

   vec4 sigma_a = lightFreqAbsorbed * tsm_freqAbsorption;

   vec4 sigma_s = lightFreqAbsorbed * (1.5-tsm_freqAbsorption);

   //

   vec4 extinction_coeff = (sigma_a + sigma_s);

   vec4 reduced_albedo = sigma_s / extinction_coeff;

   vec4 effective_extinction_coeff = sqrt(3.0 * sigma_a * extinction_coeff);

   vec4 D = 1.0/(3.0*extinction_coeff);

   //

   float fresnel_diff = -(1.440/(refr_index*refr_index))+(0.710/refr_index)+0.668+(0.0636*refr_index);

   float A = (1.0+fresnel_diff)/(1.0-fresnel_diff);

   //

   vec4 zr = 1.0/extinction_coeff;

   vec4 zv = zr + 4.0*A*D;

   //

   vec4 xr = Xin – zr * sNormIN;

   vec4 xv = Xin + zv * sNormIN;

   //

   float dr = length(xr – Xout);

   float dv = length(xv – Xout);

   //

   vec4 f1 = reduced_albedo/(4.0*3.1415296);

   vec4 f2 = zr * (effective_extinction_coeff * dr + 1.0);

   vec4 f3 = pow(vec4(e) , -effective_extinction_coeff * dr) / (extinction_coeff * pow(dr,3.0));

   vec4 f4 = zv * (effective_extinction_coeff * dv + 1.0);

   vec4 f5 = pow(vec4(e), -effective_extinction_coeff * dv) / (extinction_coeff * pow(dv,3.0));

   //

   finalColor = f1 * ( f2 * f3 + f4 * f5);

   //

   return irradIN*finalColor;

}

My first notebook

March 2, 2008 Leave a comment

Some days ago I’ve ordered my first notebook ever. I’m quite excited since I’ve chosen a nice beast, without sacrificing mobility: an Apple MacBook Pro. Actually, I don’t really care about MacOS even though I’m in the need for that OS to test applications I write, with different OSes and hardware configs. One of the first things I’m gonna do is install WinXP since I’ve got already Vista on my desktop.

For all the people that might wonder what made me choose an Apple product… I just reply saying that an Apple product is just like any other product. Yes, they are quite a bit more expensive, but that’s because in commerce you ALWAYS pay more for better looking products. Always.

Having that said, what made me take that notebook instead of, say, a Dell or Asus product? Well, the specs. Pure and simple. What I was in the need was a notebook with:

  • Penryn Cpu, which is both fast and energy efficient (45nm, even better if the 3MB-chached version which consumes even less)
  • nVidia 8600 with at least 256MB of dedicated VRam, or if that was not available, an 8800 (actually the 8700 is being assembled with the old productive process, wich is way less efficient)
  • A good quality screen (possibly not with TN panel), with LED back-light in order to have better contrast and be less hungry on the battery
  • As a plus, my ideal notebook would have had a BTO option for a 7200RPM hard drive (even though capacity isn’t something I’m interested in as long as it’s greater than 60GB, an SSD option whould just be too much expensive)

I’ve studied all the possibile notebooks that could have met my standards, and actually there weren’t any at all. 😮

The old base MacBook Pro had led back-lit display, 8600 (but with just 128MB vram) and no penryn.. The dell XPSes had no led back-lit displays, nor the penryn; Toshiba alternatives were even worse. The only two possible candidates were the Acer 5920 (the top version) and the Asus M50v.

While the latter was a good solution all around (a very nice thing was the nVidia 9500.. DX10.1 with per-MRT blending, and such..) didn’t had a very good display (just 1280 without led back-lighting); the former was similar, even though with “just” the nVidia 8600 and similarly to the M50v, no LED display (with a nice resolution of 1440 though). Actually I was more interested in the ASUS solution just because Acer products seems “cheap” or “not-so-well-made”.

I sweared to myself: if Apple is not going to update their pro notebooks in a couple of days (I could hold on up to Tuesday-Wednesday), I was going to take the Asus’ one.

Fortunately Apple did the long awaited update and I took the base model, with a 7200RPM hard drive. Seeing the online reviews, I was also impressed with the display quality: it doesn’t seem to be a TN panel thanks to the high viewing angles and overall quality.

Now my shipment is in transit and I hope to put my hands on it on Tuesday or Wednesday at most. As it arrives, I’ll take some shoots and will discuss here the positive and negative aspects.

W00t!

Categories: Personal Tags: , , , , , ,