Skip to main content
GameDev.net gamedev.net
🔒 Locked

Semi-cloaking effect?

Started by Cypher19 Jan 20, 2004 at 7:12 PM 2 replies 500+ views
Original Post
Cypher19
Cypher19
I'm trying to get a semi-cloak effect for a game I'm making, and experimented with the sphere/cubemap samples in the DX9SDK. With the spheremap sample, I've been able to get EXTREMELY close to the effect I'm looking for. In fact, I managed to get the actual effect by changing the a line in the shader from: //Compute camera-space reflection vector ... "add r1, r1, r1\n" ... to: "add r1, -r1, r1\n" Now, the effect looks great, (actually, give it a look and see what you think!) but I've got two problems with it: 1) When you look towards a certain point, specifically near the doors, the image gets...screwy. Now, I'm sure that's because the direction of the camera or something gets REALLLLLLY close to zero, and that's no problem because since the game has a primarily isometric view, I can have that direction be away from the camera. 2) It's not dynamic. I went through the code and saw that the shader is referring to a pre-made texture. How could I make it dynamic so that things moving around would be seen through the cloak? [edited by - cypher19 on January 20, 2004 8:12:52 PM]
Palidine
Palidine
hrm, is there anyway to combine the stencil buffer with turning off z-checking? the idea is to render your cloaked units to the screen after the static world and mark on the stencil buffer which pixels belong to that unit. then you could draw the other dynamic objects and have them ignore the z-buffer in regions occupied by the cloaked unit. you''d have to sort the rest of the dynamic objects and draw them in back to front order to prevent erronious dynamic object overdraw in those regions.

this is sounding very inelegant right now, so there''s gotta be a better way to do this. but maybe it can be a seed for someone else''s idea?

i guess you could always re-render the texture for the env map each frame and include the dyn objects on it. i have no idea how expensive that would be though...

-me
Cypher19
Cypher19
"re-render the texture for the env map each frame and include the dyn objects on it."

Wouldn''t that be the simplest way? It''d only involve a 2nd render because for all of the other cloaked units couldn''t I use the same env map?
Palidine
Palidine
yeah, you could definitely use the same texture. you''d just have to look up how to render to a texture. from conversations here on gamedev, i believe that is pretty trivial with the DirectX API. or probably you already have the code at the beginning of whatever code you used to make the env map to begin with.

-me

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.