
Bumper is an application for prototyping simple normal maps. It uses basic geometric shapes and layers system to achieve more complex results. Internally, it’s based on Qt, Ogre 3D and QtOgre binding.
The application was made for my master thesis, to test new approach to normal map creation, so please forgive me its look & feel – it was rather a research project, some kind of test site to check few ideas. It was also designed with plugins in mind, the app is still statically linked, but you can add new objects by just implementing very simple interface.
Running:
Just run the ‘release/Bumper.exe’ file.
Basic concepts:
Objects
Object is a simple geometric shape that can be used on the scene. You can think about the object as a thing that protrudes from the flat surface, like a rivet head in old planes. Each object has its position, orientation, height and the border parameters. Objects can also use additional parameters, depending on their type, like radius for a sphere or number of corners for a polygon.
As we said that each object protrudes from the surface, so each of them need to have some height value. The height parameter represents the maximum height of an object – and it becomes lower along the object border.
Object border is the area, where object height changes from 0 to maximum value. The border size is described as the percentage of total object size. Each border can be set to one of 3 basic types:
Linear – represents flat, linear border. For example – when you create a Rectangle object and set its border to linear,100% you’ll get a pyramid shape.
Sinus – it’s just 1/4 of a sinus function, from -90deg to 90deg. It’s flat at the start and the end and more steep at the middle. You can use it when you don’t want any hard edges on your object.
Discrete – it’s just 0/1 value (meaning 0 or max_height). You can’t use it for normal-map creation as NMs need finite slope, but you can use it in height-map rendering to get sharp objects.
Using many objects you can mix them in different ways to create more complicated results.
Layers
At the bottom of the window there is a layers list. Here you can select, add or remove layers and change their order – because layers are computed from bottom to top.
You can also hide particular layer or disable it, so you can still see the layer but selection and edition is blocked.
Each object belongs to one layer and the layers and objects organization defines the way the texture will be rendered. More on this below.
Objects and Layers mixing
When you render a final texture the application runs through all pixels. For each pixel it collects all objects containing that pixel, and groups them by layer. Each layer is then computed separately to get its final height.
For each object in a given layer the object height for current point is computed. All resulting heights are then passed to a Layer Blend function, which is one of: max, min, add, avg, etc..
After computing every layer height the application will take first layer value and mix it with 2nd layer value, using 2nd layer Blend function. Then it takes next layer, and so on, until all layers are analyzed. The result of all those computations is a final height of a given point.
If you’re rendering a height-map the work is done right now, but for a normal-map the application will compute two additional points moved by a small delta from the main one, and compute surface steep using all three points.
Below are examples of correct usage of max and add blend functions:
Main part – right panel:
There are three tabs on the right that are inspired by the old 3D Studio interface:
Create – select new object type using list box and press “Create object” button to add it to the scene.
Modify – shows editable parameters for selected object, eg. border type and size.
Render – you can set resulting texture size, render mode (if you want to get height map or normal map), there are also buttons to render final image and save it.
Object edition:
Selecting objects works as you would expect for any similar application but there’s some tricky system to edit them.
Each object has this border that highlights when you hover it. Dragging this border will scale object in one direction. Dragging the corner where borders meet will scale object in both directions by the same amount.
At the center of the object there is a circle area used to move the object.
Entire area between the border and circle is used to rotate selected object.
Main view:
There’s a grid representing legal u,v coordinates in (0,1) range. Objects outside of this range are not repeated on the other side.
At the top you can select an image to be used as edition background. It’s meant to be used with diffuse channel, so you can match edited objects to the features on the texture.
Toolbar:
2D View – opens a preview of rendered 2D image
3D View – opens a 3D preview with selectable mesh and material, rendered by the Ogre engine.
Menu ‘Object’:
Move to layer list – selecting one of the layers moves current object into it. Usefull when you forget to select correct layer before creating a new object.
Delete – delete currently selected object.
3D Preview window:
At the top you can simply select displayed mesh and material used but the rest is not so simple.
Computer doesn’t know which texture is a normal map so you need to select it by hand. After selecting new material the tree control on the right will be filled with texture names used in the material. You need to select a normal map texture and click ‘Assign’ button.
You can also replace any other texture in selected material, so you can e.g. show the normal map as a diffuse channel or use height map as a specular map, etc.
Here is a popular normal map from the web, it’s often used to test new pixel shaders:
And its reconstruction in the application. I couldn’t recreate the torus object but the rest of the texture looks better now:
Get the source here: Bumper.zip