Hello,

Here's a "little" blender test I've been playing with lately.

Results of the test


Click image for larger version. 

Name:	px_decal_test.jpg 
Views:	13 
Size:	159.0 KB 
ID:	520655


Click image for larger version. 

Name:	px_decal_test_viewport.jpg 
Views:	6 
Size:	209.2 KB 
ID:	520656

Blend file: http://xard.mbnet.fi/blenderartists/px_decal_test_dist.blend


Background information

I needed faster way to create and place recessed details to meshes than using empties for texture mapping coordinates and manually adding all the decal textures and texture mapping nodes one by one to the base material.

Using transparent faces wrapped near to the base geometry can look virtually the same without any need to use empties or UV mapping for placement or modifiying the base material. While there are limitations and drawbacks using wrapped mesh decals they are faster to add, setup and modify than the traditional blender way of adding decals.

Completely flat decals like stickers and painted text are pretty straightforward to do.

If the decal contains any recessed or extruded geometry things get more complicated. A heightmap and normalmap are then needed and a way to render the decal geometry.

Extruded decals can be done nicely with micro displacement using experimental blender featureset. Downside is that the displaced geometry doesnít work for chiseled / recessed decals at all as the geometry sinks beneath the base mesh.

Unfortunately I didnít find any easy and fast ways to mask transparent holes to the base mesh material where the decals are so I had to look for alternative ways around it.


Sources

I looked for cycles parallax mapping nodes and I did find one implementation:
https://blenderartists.org/forum/showthread.php?314083-Cycles-parallax-step-mapping-with-nodes

It works but I wasnít completely satisfied with the result using my own textures.

Then I found this blender game engine parallax mapping node setup:
https://blenderartists.org/forum/sho...de-shader-v1-1

The result is what Iím looking for and I decided to port the node setup to cycles using bits and pieces from both parallax implementations.

There are downsides to parallax mapping like result looking weird at steep angles and no shadows for details. However the result was good enough for now.


Textures

All the parallax mapping decals have various value mapping textures:


  • Depth
  • AO
  • Curvature
  • Alpha
  • Normal map
  • Id



The Depth, AO, Curvature and Alpha are combined as one 16-bit png file to save about 50% of the space. (shortened to DACA)

The Normal map is a 16-bit png and the Id is a half float exr image using direct IndexOB output. Currently the IndexOB output doesnít have antialiasing, but it didnít have that much of an inpact for the quality of the result.


Usage

When placing decals you need to be careful that the decals donít overlap or they will have weird z-fighting artifacts.

As long as the UV map bindings are in correct orientation you can rotate your decals as you please and the result is good. However when mirroring geometery you need use the mirror U or V depending from the case or the normal maps will be rendered incorrectly by either X or Y axis due to the nature of normal maps.


Creation

I created a separate baker blend (not included in here) file which can be used to create recessed or flat decals by using camera animation to switch between decals. The baker produces all the decal map files from standard geometry and is compatible with the upcoming bevel noe.

The baker has also a material creation script to speed up setting new decals. Linking the node groups from the baker blend file makes modifying the decals for multiple blend files at once easier.