Monday, October 26, 2015

Having fun with a Maze generator

As a programming exercise, I had to write a maze generator.

I got caught up having some fun with it.

Fancy Colors
Rainbow colors :D
Generation
Whoa
Exploration.

Written in pure C++. Man this is fun.

Tuesday, August 11, 2015

How to extract a good color texture from an imperfect picture


In ideal conditions, you want to photograph a texture from a flat surface on an overcast day, with no indirect light. However, conditions are not always ideal, sometimes the weather isn't in your favor, or you're shooting in an environment where imperfect light is just unavoidable. All is not lost in those cases, but before we can save those pretty pictures we need to get a better understanding of what we actually want from those images.

The basic information a photo holds is for each pixel a red, green and blue value. But we need to be less naive about splitting up the information.

Lets take a look at our picture. It shows a damaged wooden wall, but it's not usable as-is. The lightsource is clearly located to the right of the photo, an causes a massive gradient from right to left.

This gradient we want to loose, but we want to keep the detail texture and the color information.

 The following steps can be taken in any photo manipulation software, I'm using GIMP for this example.

STEP 1


Because the photographed surface was not parallel with the camera, it appears a little skewed.
Photoshop has a handy tool for this, called perspective warp (make sure to place the corners exactly on the corners of the shape, then click "auto warp to horizontal and vertical")

You can also do it with gimp, by using the Perspective tool, but this is a little less handy.
Now crop your picture to size.

STEP 2


Make a DUPLICATE LAYER and desaturated it.


STEP 3

We're going to blur the hell out of it, but before we do, we need to get rid of any value information that is naturally significantly brighter or darker than the rest. In this case the wall socket and a little black border below it. This only works if the areas are relatively small and are relatively unaffected by the ambient light)


We do this by picking a surrounding value and just painting over it. It doesn't have to be precise at all.

STEP 4


Now we blur it, until all the detail texture is completely gone, but the ambient light remains.


STEP 5

Then we invert it, and use the "curves" tool to adjust the image further. The bottom left node should be moved to the left part of the histogram, and the top right node should be moved to the right end of the histogram. Another middle node is added, and this one is placed at y=128 (exactly in the middle) and x at the center of mass of the histogram. You can eyeball this.


The previously bright patches should now appear black, and the dark patches white. The average color should be around grey.

STEP 6

Now we set the blend mode to overlay.


STEP 7


Ew! Look at that patch of weird orange. Let's analyze the saturation of this image.



We can see a natural gradient from bottom to top in the image, probably from the dust buildup and rot. The red patch in the top right corner, however, is an artifact.

We can do this by duplicating the layer and setting the blend mode to color
Because the saturation of an image does not contain much important detail information, we can easily manipulate it. Try blurring this layer, you'll see that not much changes. Don't keep the blur though.

Use your clone stamp tool to clone parts of the image that have the saturation the affected part should have. Beware of white or black spots, like holes and paint spots, because they will show up as grey or very saturated parts in the image.



REFLECTION


And there we have it! Your final color texture. Other adjustments might be required (like making it tile, patching up or removing the socket, etc)

It's always important to understand what it is you're trying to achieve, and what values you have to change to get to that goal. If you understand this, you will learn to recognize all sorts of problems and you will understand how to fix them. Also, don't be shy to experiment with other software, use the right tool for the right job.


Original | Final

Thursday, July 9, 2015

USSR Otshel'nik


This underwater vehicle was modeled after an assignment I did, where I had to make a 2D modelsheet. Here it is:



I modeled the thing in high-poly first, and then baked it down into a low resolution mesh, made for sketchfab. It was all done in Blender3D, using GIMP to make the textures. All textures, except for the sand and rocks, are composed of textures I shot myself. Have a look at the thing in 3D here:



360° panorama pictures for reference purposes.


THE REQUIREMENTS


For me, reference images just don't cut it when I'm trying to capture the atmosphere of an environment. They work when you're capturing details and individual objects, but they don't quite take you back to that one particular place...

I mean, it's like you're there



After having stumbled upon a few very unique places I wasn't quite supposed to be, I set out to find a way to capture the general atmosphere of an environment while still preserving detail, quickly.

The answer was obvious: 360 degree panoramas, where you can look all around you, and zoom in and out.

In this article I'll explore some methods of achieving these panoramas, look at different software and give some tips and tricks.

I was looking for a run'n'gun style method, no expensive setups, valid in all situations.


THE METHODS

If you want to have perfect 360 degree panormas, and you have the budget, there's really only one option: you buy a rig. There's simple tripod mounts, and there's portable setups that carry multiple DSLR's with fisheyes that let you take a panorama in one click.

I was looking for something that was a little simpler.

smartphone: 

 pros: 
-small equipment
-easy to use

 cons: 
-slow (depending on model)
-mediocre results 


If you have a smartphone, there's various apps that allow you to use the accelerometer in your phone to guide you in taking your photosphere.

(c) google
In all of googles examples it works fine, but it becomes very tricky to use when you are confined to a small space. It works well in big halls or open space, but not in rooms.

This is of course because if parallax.

If your second image is taken from a slightly different position than the first, foreground and background elements might appear in different positions relative to one another. The program is unable to stitch the photos together. or will do so poorly.

These kind of artifacts are the result:


You're extra prone to getting these kind of parallax errors when you're standing with your legs closed holding a phone close to your face swirling around.



dslr:

 pros: 
- good results
- lots of flexibility in post

 cons: 
- slow
- demanding process


from video:

 pros: 
- fast
- easy

 cons: 
- unpredictable results
- hard to make changes

You can also create a panorama from a video.
I don't really recommend it, but it's okay-ish for personal use, and it's relatively fast.

Microsoft has some software called Image Composite Editor.

It can give some really good results, but it's highly unpredictable
All you do is drop in the video and let the software do it's thing. After that, you have no more control over it.

You can change the projection and crop it, but other than that you have little control.

TIPS

 sfpviewer

I found a cool little tool online for viewing your panoramas, it's called FSPviewer and can be downloaded here:

http://www.fsoft.it/FSPViewer/

horizon

Make sure the horizon is always at 50% of the height of your image, else your image is going to look warped.

THE RESULTS