PDA

View Full Version : x-ray rendering



leman_nc
01-15-2004, 12:54 AM
I would like to obtain a x-ray rendering of a scene with any kind of objetcs. The problem is that the using of the blending doesn't allow to differenciate the thicknessses of the objects (more the object is thick in a given direction view, more the intensity of the x-ray is high).

Does anybody already solved this problem using only OpengGL functions (zbuffer, fog, ...) ?

dorbie
01-15-2004, 03:51 AM
You can use fog for color and subtract frontface color from backface color.

You can also use texgen in eyespace, perhaps even bounding objects with the texture matrix for more precisionl. Extended range may be a problem since it will be difficult to clamp so you may want to render underbright and do some post processing on the scene.

This very recent thread also discusses similar concepts.
http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/011296.html

Jan
01-15-2004, 06:36 AM
AFAIK thatīs something like volume-rendering (volumetric fog, volumetric light, etc.).

You could google for that (i know that there is a really good article on gamasutra.com).

Jan.

clunis_immensus
01-27-2004, 12:53 AM
Originally posted by leman_nc:
The problem is that the using of the blending doesn't allow to differenciate the thicknessses of the objects (more the object is thick in a given direction view, more the intensity of the x-ray is high).
...


Actually blending (more precisely, "compositing") does allow you to do what you want. Have you tried using glBlendFunc with SRC_ALPHA, ONE_MINUS_SOURCE_ALPHA ? Render the 3D-textured polygons back-to-front, always slicing across the viewing axis. (more the object is thick in a given direction view, more the samples and more the opacity accumulation).

Karthik

leman_nc
04-05-2004, 09:18 PM
How can I subtract frontface color from backface color by using fog for color ?

harsman
04-05-2004, 10:48 PM
Read this (http://download.nvidia.com/developer/presentations/GDC_2004/GDC_2004_TranslucentAnimatedObjects.pdf)

leman_nc
04-06-2004, 03:04 AM
Thanks Harsman,

The GDC seems really what I am looking for. But, there is no way to avoid the using of DirectX to have a real-time x-ray rendering effect?

harsman
04-06-2004, 04:33 AM
There's no need to use DirectX. The presentation is pretty advanced though, so you might not be familliar with how to do it in OpenGL. Do you have any more specific questions?

Oh and the GDC isn't the name of the technique, it's short for Game Developers Conference, that's where the presentation was given.

leman_nc
04-06-2004, 04:53 AM
OK, I've just simplified GDC for not saying Game Developers Conference ... ;)

But you're right for the first thing. I'm not familiar with how to do that in OpenGL. I look for the version of Pixel Shaders, it's why I was directed on the DirectX.

OK, I would like to know how to compute the thickness of the object (in the GDC link, the slides "Rendering Thickness per Pixel"). I hope it is not a mathematical computation for each pixel, because it should be a very time consuming for a real-time rendering technique.

Regards.

harsman
04-06-2004, 07:58 AM
Well what you need to compute to get the thickness per pixel is the sum of all back face distances - the sum of all front face distances.

You can do this in several ways:

Set up texgen and a 1D texture to map distance to alpha. Set the colour to white. Render all back faces with additive blending and then all front faces with subtractive. This will have very bad precision but it is fairly easy to set up.

For better precision render RGB-encoded depth for front faces into one texture, F, and back faces into another, B. Then you can bind these two textures and in your fragment shader compute B-F to get the thickness per pixel. You can use this as a texture coordinate in a 1D colour texture or use it with some scattering math to get the effect you want. This requires more powerful hardware than the earlier technique but looks much better.

By the way, this has been discussed before so you will probably get some tips from searching on "x-ray" and "volume fog" in these forums.

Jan
04-06-2004, 08:25 AM
Originally posted by Jan2000:
AFAIK thatīs something like volume-rendering (volumetric fog, volumetric light, etc.).

You could google for that (i know that there is a really good article on gamasutra.com).

Jan.I really donīt like to quote myself.
Jan.

jwatte
04-06-2004, 09:57 AM
If you want a quick and cheesy hack that's good enough for games, you can make the assumption that facing angles are "thick" and glancing angles are "thin".

Then use NORMAL_MAP texgen, and use a cube map (or 1D texture, even) where it's full-bright when pointing towards the viewer, and falls off when pointing away. Do this in ONE,ONE blend mode for additive, X-ray rendering.

This is very similar to having a point light at the camera, and doing per-pixel lighting.