X ray images with blender?

I was wondering if it is possible to render “X-ray like” images in blender? That is an image where the color of an object is related to its thickness.

It is quite easy with sphere using a texture modifying the alpha value using the normal of the object as map input, but it doesn’t work with cube.

So anyone has an idea?

you can fake it as you said, with that method .
you could make an experiment backlighting everything with a white light and using translucency, then using the result as a mask for multiple renders that you composite in layers- not a one step process as you see.
afaik you can’t do this directly with blender’s material sytem. someone who knows yafray may tell you if you can create a yafray shader with these properties.

i did some years ago such images for a customer with lightwave, and recently rebuilt the effect in blender. it works nice on organic, curved objects, also cylinders and such. the effect is as you already found out - a blend texture mapped using NOR, with coordinates set to Z, Z, Z. you can let it affect alpha as well as emit to achieve the best results.

and the cube problem - well, i doubt a real cube would look any more interesting on a real X-ray photograph. the effect really relies on the geometry, incg and in real world.

no need for yafray, the internal renederer is pretty good for this task. if you want, i can try to find those old images and post them.


That would be great if you can post your images.

My problem is that I want to do an X-ray image of a box containing a shere, so I can’t avoid the “cube problem”.

I’m not sure if “yafray transparency” is sensitive to the thickness of the objects. And I don’t have access to yafray for the moment since I’m not root on my PC. So I have to use blender renderer.

So to create such an effect I only need the apropreate material?

Could you make a screenshot of the material window of that X-Ray material? Or could you post a link to a .blend file you created with X-ray materials?


i’m in a hurry right now, will post images/files this evening (CET)

I don’t think you have to rush yourself, don’t worry.

And Slikdigit, can you explain what kind of mask you think I should produce? I assume you think that I should hide the more thin part of the object after each render pass, but findint the “thinest part” is the main problem.

And translucency doesn’t seem to affect anything, so I don’t know how to use it.

i will try a quick test tonight.



Try this:


It’s made made by Carsten Wartmann, author of the german Blenderbook.


ok, here a couple:

note: this is licensed material i sold to my customer


Wao! That’s amazing. It seems to works perfectly with smooth objects. I’m going to give it a try. Thank you.

It’s made made by Carsten Wartmann, author of the german Blenderbook.


Well it is not exactly meant as x-ray, it is is trying to mimic a Raster Electron Microscope. :wink:


Yes but it can do the trick. There is a tutorial about it on Blenderman.org. I wanted to use it but the site is down.

WOW, those images are great! I’m going to have to try the material settings you suggested…

What they’re generally talking-about, Gentle Reader, is the fact that a “texture” in the CG world is really a sort of mathematical filtering mechanism. It enables inputs, such as the “normal” of an object (which way an arrow emerging from the front faces, in relation to the camera), to affect one-or-more outputs, which are characteristics of the image such as “alpha” (transparency). The effect is calculated in three dimensions, X Y Z, and you can “map” those three channels in interesting and useful ways, mostly by experimentation.

When you consider any object, such as the lamp, being X-rayed, what the X-ray beam would actually be measuring is its density: how much “air” vs. how much “object” the beam is actually passing through. Passing through a solid object attenuates the beam. But as far as I know there is no way to do that, at least not without some fancy programming.

But we can “cheat.” In the case of the thin, curved, lamp we know that the “sides” will appear to be a little denser, and we know that “sides” are where the normal-vector points away from the camera; it points to one side. It’s not accurate but it’s convincing and looks good. The trick won’t work for a cube because the entire face points to one side and the eye sees it as “strange, funky lighting,” like black-light on a 1960’s velvet poster, not “an X-ray.”

A more complicated solution would be to figure out each “layer” of the object from back to front and then merge, or “composite” them together into a single image. Also a “cheat.”

You’ve perfectly express the problem. And if you look at the lamp, you see that it can’t be an X-ray image, since the leg must be completly filled with iron (or plastic) and the it should be totaly with, except for its side. But it works perfectly, because we don’t use to see with X-ray.

I think that for the cube, maybe another trick can works. If you use a the negative image of a sphere blend texture (i.e. the center is black and goes to the with) to the front and the bottom of the cube and a blend texture from with to black for the side face, with the with side near the camera and the black for the part of the face the most distant from the camera, it could work. I’m going to try it.