Tag: graphics

Entries for tag "graphics", ordered from most recent. Entry count: 40.

Uwaga! Informacje na tej stronie mają ponad 3 lata. Nadal je udostępniam, ale prawdopodobnie nie odzwierciedlają one mojej aktualnej wiedzy ani przekonań.

Pages: > 1 2 3 4 5 >

21:24
Fri
22
Oct 2010

Blender 2.5 - Programming Export Plugin

Today I've been familiarizing myself with Blender 2.5. This new version is still in Beta stage, but as far as I can see everything is aleady in place and the program works OK. I only had to solve one problem at the beginning - my Blender was crashing at startup, because it was looking for PYTHONPATH environmental variable and thus trying to use old version of Python language that I had installed, while new Blender needs Python 3.1. The solution is to clear this environmental variable so Blender can use its bundled Python distribution. I've created a batch script to do this, called "Run Blender.bat":

set PYTHONPATH=
"c:\Program Files\Blender Foundation\Blender\blender.exe"

Many changes have been made in new new Blender version. Fundamental concepts stay the same, so we still have Object Mode, Edit Mode, select objects with right mouse button, grab with G, rotate with R and scale with S. User interface is still nonstandard with all its non-overlapping and non-modal philosophy. But they introduced some new features and made quite big changes to the interface, so it took me some time to play around and discover where is everything now and how it works. Readings on this topic I'd recommend are the new manual for Blender 2.5 and especially Blender 2.5 Changes - a document that highlights what's new.

The function that I've spend much time searching for was showing normals, so in case you also need this and can't find it: 1. You must be in Edit Mode 2. Click on the small (+) symbol in the right-top corner of the 3D View to expand a panel with some parameters 3. In this panel, look for Mesh Display / Normals section and select the checkboxes you want.

When it comes to writing plugins, Python API has been completely redesigned. Information about it can be found in Introduction, Manual and finally Reference. I couldn't find any article about writing export plugin for Blender 2.5, but basing on the information I could find and the source code of the existing plugins I've managed to code one. Here it is: io_export_json.py. It exports some of the data (scenes, objects, meshes, vertices, faces, edges, normals, texture coordinates, vertex colors) in JSON format.

BTW do you know any good program to view JSON documents as a tree? The best I've found so far is JSON Viewer, but it's not ideal. For example, it can't open files so the document has to be pasted via the clipboard.

Blender keeps Python plugins in the user's directory. In my Windows 7 it is C:\Users\%MY_LOGIN%\AppData\Roaming\Blender Foundation\Blender\2.54\scripts\addons. To start using new plugin, you have to:

  1. Copy the .py file to this directory.
  2. Restart Blender or hit F8 to reaload scripts.
  3. Go to File / User Preferences
  4. Navigate to Add-Ons tab.
  5. Find the add-on you want to use. You can filter add-ons by type with buttons on the left.
  6. Select checkbox next to the add-on.
  7. It should now be available in File / Export menu.

Comments (2) | Tags: blender graphics | Author: Adam Sawicki | Share

19:55
Sun
01
Aug 2010

How to Equally Blend Multiple Images in GIMP

During my today's walk on Warsaw I took many different photos. Some of them were series of photos of a road from exactly same place, with a purpose of merging them together into a single photo. My idea was to just average the color of each pixel, so it should be like:

out = 1/4 * (img[0] + img[1] + img[2] + img[3])

But how to do this in GIMP? There is no such filter AFAIK. An obvious solution is to use blending - Mode and Opacity settings for layers - but it turns out to be not so simple. Each layer blends with a merged image from beneath it, so instead of average formula above we have to refer to a formula for blending (linear interpolation), which is:

out[i] = t[i] * img[i] + (1-t[i]) * out[i+1]

Where:
i is a layer index 0..(n-1), indexed from the topmost layer,
t[i] is Opacity parameter for layer i.

After expanding it for 4 layers, the formula becomes:

out =
t[0] * img0 + (1-t[0]) * (
  t[1] * img1 + (1-t[1]) * (
    t[2] * img2 + (1-t[2]) * (
      t[3] * img3 + (1-t[3]) * 0
    )
  )
)

Finally, after doing some math with pen and paper, I calculated that to equally blend (average) n images in GIMP, you should:

For example, I have 5 photos so I give them Opacity: 20, 25, 33, 50, 100. Here is the result: an image that could be called "Road of Ghosts" :)

By the way, I've found a website where panorama photos can be uploaded for free and interactively viewed using just Flash. Here is my profile: reg | Panogio.

Comments (0) | Tags: gallery graphics | Author: Adam Sawicki | Share

20:59
Mon
05
Jul 2010

Color Names in .NET - CheatSheet

Some color values used in computer science have their names, like "Red" (#FF0000) or "Navy" (#000080). You probably know them if you've written anything in HTML. But there are more of them than just several most popular ones, made of values 0x00, 0x80 and 0xFF. I've prepared (or rather, to be honest, copied from MSDN Library) a table of color names available in .NET standard library, as static variables in System.Drawing.Color, System.Drawing.Pens and System.Drawing.Brushes classes. Here is my "Color Names in .NET" CheatSheet:

Color_Names_in_DotNet.pdf
Color_Names_in_DotNet.odt

Comments (2) | Tags: rendering graphics .net | Author: Adam Sawicki | Share

11:51
Sat
03
Jul 2010

Tiny Planet

Tiny Planet is an interesting effect to be made from a photo or drawing. I saw it for the first time at Wojciech Toman's devlog. Here are some tiny planets made by me recently:

Warsaw - Chomiczówka:

My house:

To make a tiny planet, you have to first take a 360 degrees panorama photo of some landscape. For stiching photos into single panoramic one I recommend free application from Microsoft Research called Microsoft Image Composite Editor (ICE). Of course there are many others availble. Then the process involves some manual graphics work and/or smart usage of some filters, where the crucial one is converting image to polar coordinates. In GIMP you can find the appropriate menu command in Filters / Distorts / Polar Coordinates.

The biggest question when making such images appears to be how to fill the inside and the outside of the circle forming surface of the planet. Do you have any ideas better than the ones I used here?

Comments (0) | Tags: gallery graphics | Author: Adam Sawicki | Share

20:57
Fri
21
Aug 2009

Beautiful Wallpapers on Flickr

Yesterday I've found Flickr profile of Reciprocity - Alan Jaras - a research scientist and microscopist playing with photography of caustics and other light effects. Of course it's all the matter of taste, but for me his photos are really amazing. They look so abstract and so natural at the same time. Just look at the galleries Taming Light, Bending Light and Twisting Light. I think it wouldn't be easy to procedurally generate such images. Also check out his Favourites for more unusual images.

Comments (0) | Tags: graphics web | Author: Adam Sawicki | Share

18:26
Thu
11
Jun 2009

Dithering i inny postprocessing

Dziś dalej bawiłem się w pisanie efektów postprocessingu. Szczególnie zainteresował mnie Dithering. Ta technika była stosowana do polepszania jakości obrazów w czasach, kiedy komputery dysponowały ograniczoną liczbą dostępnych kolorów. W szerszym kontekście Dithering oznacza celowe wprowadzanie szumów do sygnału celem zniwelowania nieprzyjemnego efektu powstającego w wyniku kwantyzacji do pewnej, małej liczby możliwych wartości (np. tylko kilka bitów na składowe RGB piksela czy próbkę dźwięku).

Dzisiejszy DirectX już nawet nie obsługuje palet, ale pomyślałem sobie, że napisanie takiego efektu renderowanego w czasie rzeczywistym za pomocą shaderów to będzie ciekawa część poznawania zagadnień związanych z tematem efektów pełnoekranowych i Non-Photorealistic Rendering.

Zasada działania takiego efektu jest stosunkowo prosta. Jeśli w kodzie shadera HLSL mamy dany kolor piksela Color.rgb, to możemy zmniejszyć precyzję każdego kanału do tylko 2, 3, 4 itd... możliwych wartości (g_DownsamplingFactor) za pomocą takiej operacji:

float Bias = 0.5;
Color.rgb = floor(Color.rgb * g_DownsamplingFactor + Bias) /
  g_DownsamplingFactor;

To 0.5 służy do zaokrąglenia części ułamkowej, zamiast jej obcięcia. Jeśli teraz to przesunięcie 0.5 zastąpimy przesunięciem losowym w zakresie 0..1 (bez wartości skrajnych), to otrzymamy Dithering. Oto efekt:

Read full entry > | Comments (0) | Tags: graphics rendering tools | Author: Adam Sawicki | Share

23:03
Tue
02
Jun 2009

Zabawy z GIMP-em #1 - Bloom

Wiadomo, że programista to nie grafik - talentu artystycznego mieć nie musi. Ale warto umieć obsługiwać jakiś program graficzny, bo jego wykorzystanie bywa przydatne i całkiem ciekawe. Na przykład za pomocą GIMP-a możemy "statycznie" uzyskiwać efekty, które na co dzień kodujemy w czasie rzeczywistym, na GPU i za pomocą wszelkich zaawansowanych technik koderskich.

Jako przykład weźmy "słynny" efekt Bloom. Do jego wykonania posłuży darmowy GIMP. Mamy zdjęcie (Warszawa, centrum handlowe Złote Tarasy):

Duplikujemy jego warstwę (Layer / Duplicate Layer). Tą warstwę wyższą przekształcamy za pomocą krzywej (Color / Curves) tak, żeby wybrać tylko jasne obszary:

Potem tą warstwę mocno rozmywamy za pomocą Filter / Gaussian Blur:

Wreszcie przestawiamy tryb warstwy (Mode w panelu Layers) na addytywny (Addition) i Bloom gotowy - wszystko świeci! :D

Comments (1) | Tags: graphics tools rendering | Author: Adam Sawicki | Share

22:31
Fri
30
Jan 2009

Skąd brać ikonki?

MarekM25 poruszył ostatnio na naszym forum ciekawy temat: Skąd brać ikonki na przyciski do swoich programów?. Pośród odpowiedzi znalazły się darmowe galerie ładnych ikon: Silk Icons, Tango Icon Gallery, a także nie lada niespodzianka - paczka ikon dołączana do Visual Studio (niestety nie w wersji Express), schowana głęboko i spakowana w pliku VS2008ImageLibrary.zip.

VS2008ImageLibrary.zip

Przy okazji warto wspomnieć o stronie Ajaxload, na której można sobie wygenerować i ściągnąć animowane, obracające się kółeczko popularne ostatnio do oznaczania ładowania czegoś w tle. Znacie jeszcze inne tego typu zasoby?

Ajaxload

Comments (1) | Tags: web gui graphics | Author: Adam Sawicki | Share

Pages: > 1 2 3 4 5 >

STAT NO AD [Stat] [Admin] [STAT NO AD] [pub] [Mirror] Copyright © 2004-2017 Adam Sawicki
Copyright © 2004-2017 Adam Sawicki