Monday, September 23, 2013

Forester Pro

September 23, 2013

I've spent a lot of time over the last few days building trees in blender using Sapling, texture mapping them and exporting them into UDK. Although the results looked nice, it required a lot of work.

I started digging around and found "Forester Pro". This gem of a program costs $20. You get a bunch of standard trees to start with and can buy additional packs for $10 each. That is dirt cheap considering the cost of 3D studio max stuff.

At first I was skeptical. I figured I wouldn't have the control I needed to get the vertexes down to a reasonable amount. I was wrong.

Within 30 minutes I had created a tree with about 500 faces that imported smoothly into UDK:

In another 15 minutes I had a forest of birch and maple trees I was able to walk around in:

It also automatically generated 2 LOD models and can build in animation. I don't know exactly how to enable the animation or LODs yet but I think with a bit of effort I'll have that nailed down tomorrow.

Saturday, September 21, 2013

Photoshop -> Blender -> UDK Workflow

September 21st, 2013

Over the last few months I've learned a ton about blender and UDK and thought I'd pull it all together in a concise 3 part tutorial series. This series will show you how to take an image you find on the web and work it all the way to the point of an object in UDK. I don't skip any steps in the production of the texture, blender object and UDK material/objects.

This video covers:
1. finding the texture on the web
2. creating the texture in photoshop
3. creating an alpha channel for see-thru windows

This video covers:
1. creating the object in blender
2. mapping the texture onto the object
3. creating a clipping region for the object

This video covers:
1. loading the texture into UDK as a material that uses the alpha channel
2. loading the object into UDK using the material
3. fine tuning the size of the object
4. adding the object into a UDK game and walking around it

Wednesday, September 11, 2013

Creating a seamless texture

September 11th, 2013

If you do any 3D work you will eventually find yourself needing to add your own textures. For these textures to work well in your 3D environment they will need to be seamless. Fortunately this is not difficult to do.

My tutorial does require you to have photoshop. I will try to keep it simple and not skip any steps.

Step 1 : take your photo. This is an image take from the Hennepin Avenue Bridge in Minneapolis. It is surprisingly difficult to find spots to get overhead shots of streets and grass.

I am going to focus on creating a semi-dead grass texture from this image. Here is my selection:

If I expand my image to have 4 copies of it you can see the seam issue. We need to eliminate these seams.

Fortunately Photoshop has the perfect filter for the job. It is called the offset filter. What it does is takes the corner of the image and moves it towards the center.

Our objective is to move the corner exactly into the center. To do this you need to look at the current size of your image and divide it by 2. My image was 1562x1562 pixels. I need to move the corner 781 pixels down and the right.

This shows you what happened:

The center of your image is now the edge and the edges are now running horizontally and vertically into the center. Now you just need to fix the center area to not have a seam and you are good.

We are going to use the clone tool:

Update (July 22nd, 2014): ------------------------------------------
I've built a lot of seamless textures since I did this posting and one thing is very important: Use a hard clone, not a soft/blurred clone. 

Sometimes if the image has a lot of lighting transitions I will cut it down to half size and copy it vertically (transform: flip vertical) and copy it horizontally (transform: flip horizontal). Then you just need to remove the mirrored look to the image which can be a lot easier than fixing the lighting differences.

To use the clone tool you press the alt key on top of where you want to clone from (the red circles in this image) and the left click. This will set the clone position. Then click on the area you want to clone onto and you can start cloning. You will need to experiment based on what your seam looks like

Once you are done clone out any obvious noise. In the above image I cloned out those white specs.

I always sharpen my images. The best filter to use is the smart sharpen tool.

The amount and radius will vary based on the size and make up of your image.

To get your texture to work within UDK you need to have the image be square and be a multiple of 2. I picked the closest smaller value from my image size (1024 x 1024). I may not use this size in the final game but I have kept the largest quality image I could.

Here is the final image for you:

Monday, September 9, 2013

Landscaping for UDK

September 9th, 2013

The first part of my level design earlier in the summer went very well. I can pretty much build anything I want in blender, map textures onto it and import it into UDK. It gave me a false sense of progress. Then I started doing landscaping. Yea... that isn't going so well.

I have spent a LOT of time creating a landscape for my level. I have several unique difficulties to overcome:
1. My landscape is next to a highway surrounded by buildings, roads a river, etc... This isn't some woodsy scene that I can cook up a complex texture to resolve. It is urban
2. My scene can be viewed from a height of 22 stories. This means it needs to look realistic from a great height in all directions.
3. The part of my scene the player can walk around in needs to be at least a quarter mile in all directions.

Combine all that together and you have a noob landscaping nightmare.

I am going to detail all the different things I've learned about landscaping. I will likely need to use some of this information in the future and most of it is uber counter-intuitive so I will detail the steps for each approach.

Here are my current approaches:

1. Flat satellite imagery:
Grab the satellite imagery in a several mile radius from my scene, cut them into 2048x2048 squares and map them onto large squares.

> it looks awesome from 22 stories up, like you are on a plane.

> it looks horrible close up
> there is no height to the landscape

2. Hand built landscaping height
Take the satellite square where my scene lives and build a landscape that fits it. Not squares but cut terrain to match the image.

> it looks a lot better

> clipping is a bitch.
> since the image is not a grid of squares, it inevitably looks crappy in UDK. I tried this several times. Unhappy results every time.

3. Use a height map with blender
I created a height map in photoshop (which I will detail later), shrunk it to 100x100 and used it as a displacement modifier in blender. Then I unwrapped it onto a texture of the satellite square It was based on.

> This looked pretty darn good.

> blender can't handle large grids well. Anything over 100x100 made it get very unhappy (slow).
> unwrapping the texture did not go well. Instead of a square grid mapped perfectly onto the texture it becomes a warped area. It is somewhat close but there is no fixing it when you have 10,000 squares.
> when the grid is imported into UDK, certain faces are not rendered. I've seen this before and I can usually correct it but adding additional faces. That isn't possible with a modifier since it is adding the height in code.
> no clipping. Again, that would suck adding manual clipping for landscaping

4. Use UDK's landscape tool
Use a specific size heightmap to import into the UDK landscape tool. Then you add your materials and paint onto the landscape.

> it has perfect clipping
> Very fast game performance
> High level of detail

> Does not blend well into surrounding satellite imagery.
> uber large flat landscapes require perfect textures. Mine are seamless but you can still see patterns
> Landscaping provide great detail BUT stuff urban like sidewalks and roads don't really work.
> textures are broken into squares. A diagonal path is going to look blockish

End Analysis:
I think the only viable route is the UDK landscape. I will need to ditch the satellite imagery and dynamically generate homes/streets/trees in the distance.