I've been fiddling with it and now it's awesome.
I've tried it on weird (but vaguely spherical) shaped and it looks absolutely awesome. It looks like a glass shader!
Here's a shot:
Here's the code I used to do that:
make object cube 1, -10
load image "Brick.jpg", 1
texture object 1, 1
Cube = 3
for xPos = - 4 to 4 step 2
for yPos = - 4 to 4 step 2
for zPos = - 4 to 4 step 8
make object cube Cube, 1
position object Cube, xPos, yPos, zPos
inc Cube
next zPos
next yPos
next xPos
dim RealCamera#(4)
`make object sphere 2, 1
`scale object 2, 100, 100, 100
load object "Weird.x", 2
SetupStealthEffect()
SetStealthEffectOn( 2 )
xSpeed# = 0.025
zSpeed# = 0.01
ySpeed# = 0.03
sync on
do
MouseLook()
StealthEffect()
position camera RealCamera#(0), RealCamera#(1), RealCamera#(2)
point camera xPos#, yPos#, zPos#
xPos# = xPos# + xSpeed#
yPos# = yPos# + ySpeed#
zPos# = zPos# + zSpeed#
if xPos# > 4 and xSpeed# > 0 then xSpeed# = 0 - xSpeed#
if xPos# < -4 and xSpeed# < 0 then xSpeed# = 0 - xSpeed#
if yPos# > 4 and ySpeed# > 0 then ySpeed# = 0 - ySpeed#
if yPos# < -4 and ySpeed# < 0 then ySpeed# = 0 - ySpeed#
if zPos# > 3 and zSpeed# > 0 then zSpeed# = 0 - zSpeed#
if zPos# < -3 and zSpeed# < 0 then zSpeed# = 0 - zSpeed#
position object 2, xPos#, yPos#, zPos#
rotate object 2, object angle x(2) + 1, object angle y(2) + 1, object angle z(2) + 1
if upkey() = 1 then RealCamera#(1) = RealCamera#(1) + 0.1
if downkey() = 1 then RealCamera#(1) = RealCamera#(1) - 0.1
if spacekey() = 1
position object 2, rnd(8) - 4, rnd(8) - 4, rnd(8) - 4
endif
`Crosshair
circle 320, 240, 1
sync
loop
function MouseLook()
`Find the mouse movement
xMouseMove# = mousemovex()
yMouseMove# = mousemovey()
`Adjust the camera angles accordingly
RealCamera#(3) = RealCamera#(3) + yMouseMove# / 5
RealCamera#(4) = RealCamera#(4) + xMouseMove# / 5
endfunction
`>>>>>>>>>>>>>>>>>>>>> THESE ARE THE IMPORTANT FUNCTIONS <<<<<<<<<<<<<<<<<<<<<<<<<
function SetStealthEffectOn( ObjectNumber )
GhostingCamera#(5) = ObjectNumber
endfunction
function SetupStealthEffect()
make camera 8
set camera range 8, 0.5, 1000
set camera to image 8, 2000, 128, 128
dim GhostingCamera#(5)
` 0 - 2 ................... Positions
` 3 - 4 ................... Rotations
` GhostingCamera#(5) ...... Ghosted Object
endfunction
function StealthEffect()
`Point the Ghosting Camera at the real camera and grap the angles
xCamera# = camera position x()
yCamera# = camera position y()
zCamera# = camera position z()
point camera 8, xCamera#, yCamera#, zCamera#
GhostingCamera#(3) = camera angle x(8)
GhostingCamera#(4) = camera angle y(8)
`Flip the angles so it's pointing away from the main camera
GhostingCamera#(3) = wrapvalue( 0 - GhostingCamera#(3) )
GhostingCamera#(4) = wrapvalue( GhostingCamera#(4) + 180 )
`Position and rotate the Ghosting Camera
Object = GhostingCamera#(5)
xObject# = object position x( Object )
yObject# = object position y( Object )
zObject# = object position z( Object )
position camera 8, xObject#, yObject#, zObject#
rotate camera 8, GhostingCamera#(3), GhostingCamera#(4), 0
xDifference# = ( xObject# - GhostingCamera#(0) )
yDifference# = ( yObject# - GhostingCamera#(1) )
zDifference# = ( zObject# - GhostingCamera#(2) )
Distance# = sqrt( xDifference#^2 + yDifference#^2 + zDifference#^2 )
FOV# = 20 + ( 25 - Distance# )
if FOV# > 40 then FOV# = 40
set camera fov 8, FOV#
`Stealth the object!
set sphere mapping on Object, 2000
endfunction
Don't worry if that looks complicated. That's just to make it bounce around. All you really need is:
SetupStealthEffect()
make object sphere 2, 1
SetStealthEffectOn( 2 )
sync on
do
StealthEffect()
sync
loop
I've attached the model I used. You'll need a blank texture called
"White.jpg"
You really have to see it in action with the object spinning and bouncing. You don't need a 3D card for it to work (I don't have one).
EDIT____________________
Just another shot.
Check out how well it hides it: