Tuesday, April 29, 2014

Creating an embossed watermark

I recently heard a talk about watermarking your images and different ways to add your copyright information without it being easily removed. I'm not the best at that currently, though I typically try to add something that doesn't detract too much from the image. I also don't sell any work currently, so I'm not too terribly fussed about holding everything close yet, although I understand its importance.

But it got me thinking that it would be nice to have a way to embed a little signature in the 3D environment itself. Just like a potter or sculptor can use a little stamp to mark their signature in clay, it would be cool to easily add my own signature to 3D sculpts or rendered scenes.

First I created in illustrator a graphic signature. I was inspired by greek patterns and asian characters. I might play with this idea more, but for now here it is.

I exported from illustrator as a png. I used 512x512 but that might be overkill. Bringing it into Illustrator, I added some space around the edges since the export cropped right to the art. Just a small amount of space is really necessary (not as much as above), because then I blurred the edges a bit, perhaps 1-2 pixel Gaussian blur, which will result in a slight bevel. Then you can use the image to make a stamp in various applications.

I don't actually have ZBrush installed here, so I can't guarantee these steps will work perfectly.
Invert the image so that the surrounding area is black. I believe by default black has no effect on the surface and white is maximum effect. You can experiment with different sizes and 8-bit and 16-bit images to see what gives the best result.  It seems like ZBrush alphas are generally psd files.
Then bring the image into ZBrush as an alpha and apply it with a DragRect brush. Hold ctrl to cut the alpha into the surface instead of bringing it out.

Similar to ZBrush, export the inverted image and add it to your list of stencils. Choose the imprint sculpt tool and select your stencil. Adjust the position and size of the stencil and then make sure your brush size is larger than the whole stencil. Set the strength to an appropriate amount (m) and paint once over the stencil. You now have a lovely embossed signature.

Adding the signature as a displacement map is a little trickier. There are probably many good ways to do this, but the following is how I ended up getting the result I wanted.
First in Photoshop set your background to exactly mid grey and leave the signature area as black. Export as an image, and in Maya create a displacement node and plug your image file into it (file.outAlpha > displacementNode.displacement). Leave the scale as 1 in the displacement node. Plug the displacement node into the shading group of whatever shader is on your object (displacementNode.displacement > myShader1SG.displacementShader).
Check Alpha Is Luminance in the file node. In order to make sure that the middle grey keeps the rest of the surface at the same depth you must correct the alpha values. Create an expression that sets the Alpha Offset to -0.5 times the Alpha Gain (file1.alphaOffset = file1.alphaGain*-0.5;). You can now play with the Alpha Gain to get the right depth (try a value around 0.05). Also make sure the Default Color is black, the Color Gain is white, and the Color Offset is black (It seems weird that the default color would be black while the surrounding color in the texture itself is mid-grey, but it seems to only work if that's the case).
You may have to tweak the place2dTexture Coverage and Translate Frame to place the image in the right position, depending on the UVs. I experimented with adding multiple UV sets to lay out some new UVs to get the texture in the right spot, but unfortunately it seems like displacement maps can't work with alternate UV sets. I suppose you could create a new UV set for your regular textures and use map1 as your "signature" set.
You can also add a separate color for the embossing: just add a new texture or shader and set up a layered texture or shader. Use the outColor from a new black and white copy of the image as the transparency for your regular texture, and might as well use the same place2Dtexture for that B&W image too. You can also add Ambient Occlusion to the mix by creating a surface shader, plugging a mib_amb_occlusion node into the color, and putting the displacement node into the shading group for the AO SS. You will need at least two AO surface shaders, one for everything that doesn't have a displacement map, and one for each object that does. I've included an image of the shading network, to hopefully illustrate what's going on.

Finally, it's a good idea to create a mentalrayDisplacementApproximation with the mental ray Approximation Editor to increase the quality of the displacement. Increase the U and V subdivisions to smooth out the result.

Happy Embossing!

PS I just looked it up and apparently if it's sunk into the surface, it's debossing. Apologies.

Monday, April 28, 2014

Random Molecular Motion

Here are a few visualizations of a random molecular walk and binding event that we showed to some undergraduate science students. They were pretty clever about understanding and interpreting the motion, but it's still difficult to tell whether they are able to translate that to the rest of their understanding of molecular biology. Unfortunately because of the high complexity and speed, the vimeo compression does a poor job of displaying the motion even in HD. Apologies for this. I contacted the vimeo staff and they are not able to push the compression settings as far as I'd like because delivery apparently slows down.


Monday, April 7, 2014

More bricks and plates

A bit more work on some more basic lego pieces:

Not too much interesting stuff, but still having fun.