#### Archived

This topic is now archived and is closed to further replies.

# Phasers on Shields effect?

This topic is 5160 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Can anyone give me some tips on getting that "phasers on shields" effect in a 3d game? What I have so far is a transparent sphere that I fade in then out. This is almost right, but it looks like the shot is hitting and enveloping the entire ship. I want only a part of the shield''s sphere to light up where the shot is hitting. Does that make sense? If not I can make some images of what I''m talking about.

##### Share on other sites
Try using only parts of textured spheres where each impact happens, if blended right it should look fine.

[edited by - Shane I am on October 16, 2003 5:23:20 PM]

##### Share on other sites
You could also fake it by turning off all lights except a point light at the spot where the phaser hits it, render the shield sphere, then do your normal rendering afterwards. Crank up the specular values REAL high to whatever color you want the glow to be on the light and use a blended texture.

---
http://www.gapingwolf.com

##### Share on other sites
Shane: Duh... Ok, now I feel so stupid! I made a "partial sphere" mesh and then just rotated it to the right position.

Thanks... I''ll be sure to post binaries asap (3d space shooter).

##### Share on other sites
Projected textures might look better.

##### Share on other sites
I did think about more "elegant" solutions, however we''re talking something that''s probably going to be no larger than 10-20 pixels on the screen. At the most, 40-50 pixels.

##### Share on other sites
quote:

Projected textures might look better.

Are you recommending using a textured QUAD rendered as a billboard at the point where the phaser intersection with the shield? If this is not the case, can you explain your implementation of a projected texture?

Understanding is a three edged sword...

[edited by - Sean Doherty on October 17, 2003 8:28:21 PM]

##### Share on other sites
Projective textures can be projected onto curved surfaces as well as quads. But, yeah, that would be overkill for this. Can''t wait to see the game!

##### Share on other sites
A spherical mesh with a funky texture on it. Make it dynamic, and when hit, modify the alpha values on the vertices to be opaque-ish near where it''s hit, and then fade off. Stronger hits would wrap more than tiny ones. Of course this might be overkill, but it''d look cool.

Stay Casual,

Ken
Drunken Hyena

##### Share on other sites
This is really easy to do, on your sphere the intensity of the effect is simply the dot product of the normal at that particular point and the vector of the phaser beam and clamp it at zero, if you want to concentrate it more square it or cube it.

This can be done the easiest in a vertex shader and a nicely tesseslated mesh

##### Share on other sites
quote:

A spherical mesh with a funky texture on it. Make it dynamic, and when hit, modify the alpha values on the vertices to be opaque-ish near where it's hit, and then fade off. Stronger hits would wrap more than tiny ones. Of course this might be overkill, but it'd look cool.

I have this solution implemented, but it is not quite working the way I would have expected. So far I have a target being enveloped by a sphere; and the D3DXVec3Dot product is being calculated for the vertices using the normalized laser vector and the each of the vertex normal. Using the output of the D3DXVec3Dot product I am able to calculate and set an opaque-ish color and alpha values where the laser hits the target, and then fade off. That said; I have two remaining problems to solve:

1) When the sphere that is enveloping the target is rotated, you can that there are actually two impact points being generated. The first point is at 0 degrees and the second is at 180 degrees. I have tried using the absolute values of the vectors to eliminate the second impact point with little no success thus far.

2) The target in the center of the sphere is not visible unless I render the target before the sphere or turn off the z-buffer? Maybe this is normal; or I could have something wrong with the alpha blending and alpha testing?

(Edit: It would seem that as long as the target is render prior to the sphere; and the sphere is rendered with D3DRS_ZENABLE state set to false then you are able to see the target properly through the sphere. Does it have to be this way?)

Any advice would be much appreciated.

// Phaser vector.D3DXVec3Normalize(&vecDotSource, &vecDotSource);// Vertice Normal.vecNormal = D3DXVECTOR3(vertices[count].fNormalX, vertices[count].fNormalY, vertices[count].fNormalZ);D3DXVec3Normalize(&vecNormal, &vecNormal);// Output used to set the color and the alpha of the vertex.fDotOutput = (float) D3DXVec3Dot(&vecDotSource, &vecNormal);

Understanding is a three edged sword...

[edited by - Sean Doherty on October 18, 2003 6:40:26 PM]

##### Share on other sites
quote:

When the sphere that is enveloping the target is rotated, you can that there are actually two impact points being generated. The first point is at 0 degrees and the second is at 180 degrees. I have tried using the absolute values of the vectors to eliminate the second impact point with little no success thus far.

1) The problem was caused by using the power of a negative Dot Product to calculate the color of the vertex.

2) Still experiencing some issues with the proper rendering order of 3D objects; especially objects where the state of D3DRS_ALPHABLENDENABLE is set to true? Would someone explain the proper rendering order?

Understanding is a three edged sword...

##### Share on other sites
I wouldn''t say that I am entirely happy with my Phaser implementation. That said; I would appreciate any advice on how I can improve the effect; or on an algorithm to automate the rendering order?

_______________________________________
Understanding is a three edged sword...

##### Share on other sites
Wow, game looks cool even from one screenshot The smaller sphear idea might look better for white star. This some alternate universe thing star trek vs b5? I''d like beta

Heh see why you have your sig as u do...

Who are you...What do you want...Who do you trust...

##### Share on other sites

I started this project as a top view shooter that I was planning to release as soon as possible. Since then, the project has started to evolve into a fully featured third person real time strategy game. At the present time, there is no schedule release date and many of the ideas and features are still being formed and tweaked. In fact lately it seems as though I have been removing more code than I have been writing in order to concentrate on certain effects; such as the phaser on shield effect and rendering. That said, perhaps I will post an updated screen shot when I am able to solve my some of these problems and reintegrate explosions, tweaked lighting, and the skybox.

Again, thank for your comments, and if anyone has any advice technical advice; especially in the area of lighting, the rendering order of objects, or ways to improve the special; it would be very much apprenticed.

_______________________________________
Understanding is a three edged sword...

##### Share on other sites
hmm, were did you get that whitestaar?

Bobboau, bringing you products that work... in theory

• ### Forum Statistics

• Total Topics
628682
• Total Posts
2984213

• 11
• 13
• 13
• 9
• 10