Questions on Shield Shader on Wiki

I’m learning unity by making an asteroid style game and I’m at the point where I have the game working well and I’m trying to add special effects. I’m using the shield Shader 3.3 from the wiki but I ran into some issues.

  1. I have attached the shader to a sphere that surrounds my ship object. At runtime the shield is parented to the ship. *Both the ship and the shield have different tags. The shield works fine against bullets and other objects. *However the asteroid has very specific collision code that looks at the tag. Unfortunately, even though the shield has a different tag, at runtime it is taking the tag of it’s parent and not protecting against an asteroid impact. How do I fix this issue?

  2. Right now my shield effect is on full time and the effect is uniform across the entire sphere. I would like the shield to only become visible if it is hit and for only a region near the impact to flare up. How do I make this happen?

Thanks

Anyone?

I’m trying to make something that looks like this

http://en.memory-alpha.org/wiki/File:Voyager_shields.jpg

or

http://chrisvall.com/wp-content/uploads/2010/04/3_Star_Trek_Online_51.jpg

I manged to solve the first problem by using a layer setup and adding a ridgebody to the shield. However, I still can’t get a shield that looks like the images above and I described in number 2.

From your OP I wasn’t fully able to understand if your ‘shield’ is a separate object but if it is, it can be made visible and invisible using its mesh renderer.

So appropriate code involving the renderer and the relevant collider in your context should work.

I’m at best an unity amateur and only trying to help until someone more knowledgable than me comes along and reads your post.

Thanks, I actually have this part working. What I’m trying to figure out is how to do the energy flash across the shield starting from the impact point like in the images.

That would require some code. I guess you would have to determine the point of collision and then animate a mask (circular, expanding, aligned to the point of impact) for transparency then fade it out completely.

I have attached a video of doing just that in 3dsmax.

865333–32283–$shield_mask.zip (169 KB)

I like that concept now I just need to figure out to implement that. Do I need a second transparent sphere? I know how to get the impact point but if I use a sphere how do I position the texture on it to that point? How do I stretch a texture?

It seems like I could also use a circular plane and just stretch the scale but then it wouldn’t wrap around the sphere.

You don’t need a second sphere.

That’s the job of the coder. To look through the refs/his memory find the required components and implement the required code to make this happen. If I do it for you I would want to get paid :wink:

I’m the coder, and a pretty experienced one at C#, unfortunately I haven’t done anything on the 3D side except for XNA. If this was a commercial project I would be happy to pay:-) but it’s not and I would like to learn how myself.

I have done some more work and found that a projector kinda works for this purpose but not really. There must be a way to do this with a shader or a texture on the actual object.

In case anyone runs into the same issue. The answer is to use a projector with a additive projector shader from the wiki. The projector should move rapidly away from the impact point.

Planar mapping.