View Full Version : 'Predator' Cloaking.

Johnny V
02-07-2005, 05:54 PM
I give up, I've search the message boards, googled for hours, asked LordHavoc but he never dumbs stuff down enough for me to understand so...

I give up. :p

I've been trying to implement the Predator style active camouflage (in Quake...) for a few days now and I can't seem to understand how the effect is done.

From what I can tell, is you copy the current frame buffer (or render to texture?) and use that for the texture on the object you wish to cloak, probably using sphere mapping.

I've been able to copy the frame buffer (although it's upside down. Ugghh :\) and I understand how to use sphere mapping, but simply applying the new texture to an existing model doesn't work.

Is the effect I'm going after doable with vanilla OpenGL (I'd rather stay away from extensions that earlier cards might not have, and I'm only using a Geforce2)?

If it is, what am I missing? Code is welcomed, but I'd rather just have someone explain it to me.

02-08-2005, 12:02 PM
Actually, this sounds all about right. Can you maybe post a screenshot of what you have and/or describe why you are unhappy about how it looks?

"doesn't work." is not all that informative ;)

Maybe you should also post a picture of what look you are after, as I can only very roughly imagine what you are trying to achieve.

Johnny V
02-08-2005, 04:34 PM
Ah, okay... what I'm looking for is an effect similar to the effect found in the game Halo when you pick up the active camoflauge power up, or from the movie "Predator" when the alien cloaks himself.

It's invisibility, but you can still see the figure, is the correct term 'refraction'?

I'm trying to find a screenshot of this effect but I'm having no luck, so far what I've been able to do is apply the copied framebuffer onto my model using texcoord's obtained by using gluProject:

gluProject(verts->v[0], verts->v[1], verts->v[2], modelMatrix, projMatrix, viewport, &winx, &winy, &winz);
tc_s = winx / 1024.0;
tc_t = winy / 512.0; Using this works, too well, you can't even see the model now because of the texture being applied perfectly.

I found this page through google, that's the sort of effect I'm aiming for: http://www.zpyder.co.uk/cloak.html

Johnny V
02-08-2005, 09:32 PM
I found this (http://i.boomtown.net/pics/1/4/7/66741/640x480.jpg) screenshot from the latest Splinter Cell game, that's the sort of thing I'm trying to do, all I need to know now is how they distort the image so it pops out from the background image, so you're not completely invisible.

02-08-2005, 11:14 PM
I see. Yes, this looks like refraction.

There are, depending on the quality you want to achieve and the speed you are willing to trade, different techniques/hacks to do this.

More in the lines of a cheap hack: Just 'zoom in' the background by offseting the vertices you pass to gluProject by their negated (maybe scaled somewhat) normals:

float f=-1.0;//Zoom Factor
gluProject(verts->v[0]+f*verts->n[0], verts->v[1]+f*verts->n[1], verts->v[2]+f*verts->n[2], modelMatrix, projMatrix, viewport, &winx, &winy, &winz);To fake a time dependent "warping" you could scale/rotate/... the normals (by some time dependent factor/angle/...).

A more high tech solution could be refraction mapping (there is an article in the book Game Programing Gems), altough it would be very difficult/slow to accurately intersect the refracted ray with general geometry (it is mainly used for simple containers of water.)

(Besides all this, also note that in the splinter cell screeny the main "visibility factor" is actually the shading and not the texturing.)

02-10-2005, 11:19 PM
Hehe, was just checking through who visited my site from where :D

If it's any help with the effect I did, I made it by:

taking screenshot of background.
Masking the picture of the predator so it's totally black
doing a selection on the predator and using a spherize effect, contracting the selection and spherizing again, a few times. This way it gives you the kind of bubble effect you see.

there is a guide on the net which I used. Of course, how much of it which would be useful in making a quake mod, I don't know. if you have any questions email me and let me know.