Sunday, June 30, 2013

[Blender] Modeling A Football In One Minute

This is a quick tutorial about modeling a football (aka soccer ball) in blender. It'll take roughly 1 minute to finish the model. Low poly, baking maps, setting up a simple material might take another 2 minutes.


First of all add an Icosphere object with 1 subdivision, set the size to whatever you like (mine's 12).




Go into edit mode and use bevel (CTRL+B). Make sure to check "vertex only" and set the offset to a value of your choice.
Assign 2 different maerials to the pentagon (black)  and hexagon (white) shapes.




Afterwards use another bevel command on the whole object. Set the offset to a very low value now, this is only needed to keep the penta/hex shapes when adding subdivisions later on.
Switch to Face select mode and invert the selection (CTRL+I). Use extrude individual with a high offset value, this should be ~4-8 times larger like you want the final result to look like.


Change the pivot point from median point to individual origins and scale up the penta/hex polys slightly to minimize the space in between. Afterwards extrude again but only scale down the faces, don't apply an offset.





Go to object mode and add a subdivision surface modifier with at least 2-3 subdivision.
For the final step add a Cast modifier. Keep the cast type (Sphere), and increase the factor to something like 0.75-0.85.
Higher extrude offset values from the step before allows to set the factor to a higher level and therefore turns the simple icosphere more into a perfect sphere shape.





For the low poly model redo the first step. Add an icosphere of the same size and use a bevel command with the same settings.
A simple tennis ball unwrap works quite well here and should give you 2 'rectangular' UV islands.



Switch to edit object mode and apply a subdivision surface modifier with just one simple (not catmull clark) subdivision. Afterwards add and apply a Cast modifier (sphere type).



Scale up the low poly model until it matches the high poly. Bake normal and texture maps.


Saturday, June 8, 2013

UDK Low-Res / Low-Color-Depth Post Process

After my latest toying with UDK I ended up with a post process that simulates low resolution and color depth.
The material allows to define a downsample factor as well as the amount of colors per R,G,B channel. In addition there is a conversion similar to sRGB<->RGB which makes it possible to affect light and dark areas equally by the loss of color.



Note how these screens are at 1600x900px, though the effective resolution is just 1/4 or 1/8 of that.




Material


Thursday, May 23, 2013

[UDK] Reconstruct Normals from Depth

This is a UDK material to re-construct (view space) normals from scene depth. 





Unfortunately the depth buffer suffers from serious precision errors in DX9 mode which limits the use of this technique quite a lot. For post process effects like SSAO or SSGI it might be best practice to combine 'depth only' approaches with 'normals from depth'.

DX9:

DX11:


A blur pass after reconstructing the normals helps to reduce artifacts but also lowers the precision, espacially for fine details and across object edges.


Saturday, May 11, 2013

Normal Maps: Replacing The Blue Channel (UDK/UE3)

The idea of discarding the blue channel of a normal map to get some free texture space is not new by any means. However, every now and then threads appear where people seem to struggle to get the result look like they want it to be. There are also some tutorials giving misleading informations.


What for?

The main reason to abuse the normalmap blue channel is that you get a greyscale map for free (in terms of memory), e.g. specular/height/emissive/variation etc. This will cut down the memory footprint or/and amount of texture lookups, depending on your setup, preferences, workflow.
A special technique where an extra texture channel is very beneficial is gradient mapping as described here: http://artisaverb.info/DitchingDiffuse.html


Texture and Material Setup

First of all create a tangent space normal map as usual (make sure it is normalized). Then replace the blue channel with a greyscale map of your choice and save the texture.
On UDK import make sure to set the compression to TC_Default. This will ensure a good quality for the blue channel (TC_Normalmap is radical on this part).
After importing the texture you need to uncheck "SRGB" in the texture properties (keep this in mind for the texture creation of the blue channel map).
Besides it is necessary to transfer the normal map from [0,1] to [-1,1] range. This can be done by changing the "Unpack Min" values for the red and green channel from 0 to -1. This setting does not have an instant effect, but can be triggered by applying changes to the material in which the texture is being sampled.



The material setup is pretty simple. Add a component mask node to mask off the blue channel and plug this into a DeriveNormalZ node to reconstruct the missing normal map channel.
Use the blue channel for whatever it is intented to. In my example it holds and ambient occlusion/cavity map which simply gets multiplied by the diffuse map.



Old UE3 builds might neither offer the unpack max/min options nor the DeriveNormalZ node. For those you can to do the [0,1] -> [-1,1] conversion (x*2-1) as well as the z component derivation (z=sqrt(1-(x²+y²)) manually in the material: