Archive

Author Archive

UnityDevelop with iTween syntax autocompletition!

January 3, 2012 Leave a comment

I’ve begun working with Unity, what a great piece of software! Sadly, the integrated script editor isn’t much help since it doesn’t have any autocompletition feature at all. I’ve found however a pretty useful (yet unfinished and unpolished) editor which supports it as well as many other little things that make our life a little bit better and easier.

iTween autocompletition

I’m talking about UnityDevelop, a script editor made by Flashbang Studios which is based on FlashDevelop by Mika Palmu and has been customized to better fit Unity development process. In order for UnityDevelop to work properly, you have to download the Unity 3.3 Classes and unzip them in “C:\Program Files\UnityDevelop\Classes”.

Then, you will need the Javascript representation of the iTween’s class structure. I’ve created it and made public for you to use it, so just grab it and enjoy! As with the Unity classes, just unzip in the same folder.

Β 

Carbon fiber stuff!

November 7, 2011 Leave a comment

I’ve begun working with carbon fiber composites! I find fascinating how just few grams of fibers can be so strong and stiff. Since I don’t have much time and space, I don’t think I’ll be able to make more than one or two pieces a year.. anyway I’ll try and post here my works. I’ve just created a new page where I’m going to put everything composite-related in there πŸ˜‰

The opening article is about a carbon/kevlar protection for a longboard.. happy reading!

My carbon/kevlar noseguard

How to count total lines of code in VS.NET

January 19, 2009 Leave a comment

I’ve found this little neat string that can be used in the VS.NET integrated Find and gives your current project / solution / file total line count:

^~(:Wh@//.+)~(:Wh@\{:Wh@)~(:Wh@\}:Wh@)~(:Wh@/#).+

To use it, just press CTRL+SHIFT+F, then select Use Regular Expressions and finally write the file extensions in which you want to count the lines of code. πŸ™‚

The results will be displayed at the Find result window‘s end.

Thanks go to GermΓ‘n Schuager for the tip.

Multiple OpenGL rendering contexts

July 16, 2008 4 comments

Hi all. Currently I’m working on a software which “should” have different OpenGL areas, each drawn in a different window or a more generic drawable surface (a panel, a group box, etc.. anything that has a window handle in practice).

But what I’m facing is demotivating me 😦

From what I’m reading, if you loose an OpenGL context, you also loose anything associated with it (textures, state changes, etc..):

This means that all the GL state is destroyed with it. This includes textures, among other things. More precisely, on Windows the textures are corrupted, whereas Linux handles it correctly.

Actually, in my application, I have different contexts and simply switch between them thanks to the wglMakeCurrent and everything works fine as long as I just render polygons with glColor.

But as I try to apply a texture (loaded with SDL_Image) nothing happens. So I tried to dump the texture raw data to a file and open it with PhotoShop but the resulting image is completely gray (205/255) 😐

I thought it could be the loosing-context problem mentioned above, so I tried to dump the texture as soon as I upload the data in it with glTexImage2D but I got the same gray image as before. Just to be sure I checked that SDL_Image was loading the texture correctly and that was the case…

I still have to check a couple of things… If you have some tips, please share them with me!

Bye

My brand new Nikon D60

May 17, 2008 Leave a comment

Hi there,

a few days ago I finally decided to get a reflex digital SLR. At first, I was undecided between Canon 400D and Nikon D40x. After reading online reviews, I ended up choosing the latter.

One of the “features” I most appreciated from the D40x was the grain noise at high ISOs. While the D40x produced a slightly noisier image, this kind of noise is almost monochromatic, like using an high sensitive film on a classic SLR; on the other hand, the 400D produces a more “colorfNoise Comparisonul” noise.

One day I was passing by a shop nearby my house and saw the D40x at a very competitive price (compared to several online shops), so I asked if it was possible to not get the 18-55mm kit and instead getting just the body with the nice 18-135mm lens. The main reason I didn’t wanted the kit was the lack of image stabilization.

After a bit of talks, the shopkeeper asked me if I was interested in the newer Nikon D60, which was due to arrive in his shop in a couple of days. The D60 kit includes two stabilized lenses, an AF-S 18-55mm VR and an AF-S 55-200mm VR ED. Intrigued for both the price AND the lenses, I decided to wait for the D60 so I could take a closer look at it.

While I was waiting for the camera to arrive, I read a couple of online reviews, expecially the one from dpreview.com, which helped me a lot deciding for what I was going to buy.

Infact, as the guy from the shop told me the camera was arrived, I went there almost convinced to take it. Once there, he explained me that the camera body had three-years warranty, while each lens had an extraordinary 4-years warranty! Amazed by the build quality, the body’ size and weight.. I ended up buying it πŸ™‚ .

In the days following I started enjoying the camera and, even beeing the very first time for me using a reflex, I was surprised by the results. You can see them too in my flickr page (I also bought the pro upgrade in flickr, so no more limitations with sets, image sizes, etc..).

I hope to rapidly increase my shooting expertise, I really like taking photos πŸ™‚

Bye!

Categories: Personal Tags: , , ,

The Wild Italy Expo’ 2008

May 11, 2008 Leave a comment

Hi there!

New photos have been added to my flickr.com account. This time are from the Wild Italy Expo’ 2008 edition. Hope you will enjoy them πŸ™‚ Bye!

PS: here’s the link to the set

Input / Output with GPUs

It has been a while since my last blog post. Anyway, talking with Junskyman about the Translucent Shadow Map technique, a problem aroused: how do the GPU handles data within textures?

Before dealing with this, it might be better starting with the basics: let’s then talk about Input / Output with GPUs.

When you define a texture, you also specify it’s Format, Internal Format and expecially it’s type:

glTexImage2D( target, level, iFormat, w, h, border, format, type, *data );

with the InternalFormat you basically define how many channels are being used in that texture, while format specifies the format of the input data defined in *data.

Type, however, tells the OpenGL pipeline how the data associated with the texture is to be treated.

From now on one could decide to work exclusively on GPU thanks to shaders, or instead allowing the CPU to handle some of the operations.

As for the CPU/GPU approach, usually getting data from GPU is done by glReadPixels(). It copies the texture data located in the VRam into an array. Pay attention that if the array’s type differs from texture’s type, will result in artifacts and wrong data being read. Usually, with floating point textures, there are no restrictions in the output values (they can be both positive or negative).

Integer texture type, instead, forces data to be converted from floating point (if that’s the case with original data stored in VRam) to Unsigned Integer. Negative or greater than 8bit values are simply clamped in 0 … 2^8 range.

The same thing applies with data processed using the shaders-only approach, but in this case are also normalized in -1.0 … 1.0 range. But, let’s say we want to transfer negative data using integer textures. In this case, we simply have to map the original values according to the following equation:

vec4 convData = origData * 0.5 + 0.5;

A weird thing happened while using RenderMonkey, however. In RM, even if you set texture type to GL_RGBA32F, assigning negative data results in clamping. Therefore, compacting data in 0.0 … 1.0 range and then scale it back to -1.0 … 1.0 range is mandatory.

In my past tutorial I made some changes to the source code, removing this conversion since it should not be needed in a real world application.

At the end, my advice is simple though: always pay attention to the range of values your data have at any time, and use fewer conversions as possible, since it always introduces errors.

Categories: OpenGL Tags: , , , ,