READ ONLY Backup - Star Trek Fan Games http://botf2.square7.ch/oldforum/ |
|
Ship Shield Effects http://botf2.square7.ch/oldforum/viewtopic.php?f=9&t=2525 |
Page 1 of 2 |
Author: | cdrwolfe [ 04 Dec 2008, 19:26 ] |
Post subject: | Ship Shield Effects |
Has anyone come across a neat way to implement ship shield effects, i.e actually 'Know' how it is implemented ![]() Regards Wolfe |
Author: | Malvoisin [ 04 Dec 2008, 19:51 ] |
Post subject: | Re: Ship Shield Effects |
maybe you can ask this guy how he did it in XNA: http://www.youtube.com/watch?v=8Ewzn5umH7Q or google around using the terms he used on the youtube page. |
Author: | Matress_of_evil [ 04 Dec 2008, 19:53 ] |
Post subject: | Re: Ship Shield Effects |
I've got no idea, but I did a quick google for "creating shield effects in a game" and this is what I came up with: http://gmc.yoyogames.com/lofiversion/index.php/t401503.html http://www.allegro.cc/forums/thread/598123 http://uk.youtube.com/watch?v=8Ewzn5umH7Q - You might want to contact the guy that made this video, coz that's a really cool shield effect! It's not much, but I hope that helps. ![]() *Edit, damn, you beat me with that youtube vid Mal! |
Author: | Malvoisin [ 04 Dec 2008, 19:54 ] |
Post subject: | Re: Ship Shield Effects |
lol faster at the trigger ![]() |
Author: | cdrwolfe [ 04 Dec 2008, 21:09 ] |
Post subject: | Re: Ship Shield Effects |
it looks like i may have to use shaders :S where is Strings when you need him lol. Regards Wolfe |
Author: | Malvoisin [ 04 Dec 2008, 21:44 ] |
Post subject: | Re: Ship Shield Effects |
some related vids there: http://www.youtube.com/watch?v=IizSNbuZ ... re=related http://www.youtube.com/watch?v=h56EjzVP ... re=related Texture Creation: http://www.youtube.com/watch?v=r7H6HBZS ... re=related Looks like it's best done with a flattened sphere around the model, pretty much like the collision detection sphere. |
Author: | cdrwolfe [ 04 Dec 2008, 23:26 ] |
Post subject: | Re: Ship Shield Effects |
Hmm making a looping texture file shouldn't be a problem, I do it for the projectiles. No applying it to the sphere mesh at the correct position might be more troublesome. Regards Wolfe |
Author: | Matress_of_evil [ 05 Dec 2008, 00:13 ] |
Post subject: | Re: Ship Shield Effects |
All that we ask is that the final result looks like that youtube video...or better. ![]() ![]() |
Author: | cdrwolfe [ 06 Dec 2008, 01:08 ] |
Post subject: | Re: Ship Shield Effects |
Anyone feel confident enough to create a shield hit texture set which i can loop to recreate what looks like an hit on a shield? Regards Wolfe |
Author: | Matress_of_evil [ 06 Dec 2008, 01:34 ] |
Post subject: | Re: Ship Shield Effects |
I have no idea how it works, but i've attached part of the texture file that includes the shield effect from Starfleet Command 2. I think the top glow is the weapon hit effect whilst the rings are meant to be the shields arcs around the ship. Attachment: Shield Effects.png [ 9.78 KiB | Viewed 14023 times ] And this is what the shields look like ingame: Attachment: Shields.png [ 144.42 KiB | Viewed 14022 times ] I hope you'll find it useful, although I haven't got a clue how the game translates the image file into that effect in the game. ![]() |
Author: | Malvoisin [ 07 Dec 2008, 17:02 ] |
Post subject: | Re: Ship Shield Effects |
this texture set is from Bridge Commander (i.e. a fan-made new one for BC): http://files.filefront.com/new+phaser+a ... o.html/1/1 and some more shield textures for other empires' ships (they don't need to be looking the same do they ![]() it looks like in the series on the screenshots attached but I also do not know how it gets from the tga to the screenshot by the engine ![]() here's another texture creation tutorial for ds9 shields in lightwave: http://discovery.scifi-art.com/shields/index.html I don't know if this refracting texture thing is useful for us: http://www.interlopers.net/index.php?pa ... ls&id=7216 |
Author: | TrashMan [ 07 Dec 2008, 17:25 ] |
Post subject: | Re: Ship Shield Effects |
FS2 does it by having a shield mesh (usually a sphere, but it can be in other shapes too) that is invisible until hit by a weapon. It plays the shieldhit.ani on the impact position, mapped on the sphere...something like that. Looks good in-game. |
Author: | Malvoisin [ 07 Dec 2008, 17:32 ] |
Post subject: | Re: Ship Shield Effects |
FS2 is open-source, right? So it's just about downloading the code and checking the parts where the ani file is processed and hoping that it can converted into irrlicht..(along with the graphics and textures there) |
Author: | cdrwolfe [ 07 Dec 2008, 18:34 ] |
Post subject: | Re: Ship Shield Effects |
Got what seems to be the hardest part done today, which is displacing the beam endpoint to hit the shields and not the intended target hitpoint on the ship. Here is a debug pic ![]() ![]() If anyone likes maths and wants to solve the equation used to find an intersection on a ellipsoid from a line feel free ![]() http://www.mathhelpforum.com/math-help/ ... psoid.html Now all i have to do is apply normailzed animated textures to the triangle it intersects and viola ![]() ![]() Thanks for the texture links Malv i will take a look. Regards Wolfe p.s out of curiosity Malv was it you who worked with Finite Element Methods, Boundary Element Methods etc? |
Author: | captain_picard [ 07 Dec 2008, 19:14 ] | ||
Post subject: | Re: Ship Shield Effects | ||
Hi cdrwolfe, you can find the solution attached. However, as it is a bit complicated and I think it is best to do it numerically...
|
Author: | Matress_of_evil [ 07 Dec 2008, 19:51 ] |
Post subject: | Re: Ship Shield Effects |
*Matress looks at the solution.* *Matresses brain melts. Maths was never his strong subject.* ![]() |
Author: | Malvoisin [ 07 Dec 2008, 19:54 ] |
Post subject: | Re: Ship Shield Effects |
I did working with finite elements a good while ago but I don't think you really need femlab to solve this equation ![]() I followed the link you posted and the math behind it is quite basic actually (if you happen to have studied it and know what's going on ![]() As solution you need to take the positive root to get the first intersection point (there are two, the negative root gives you the exit-point so to say in contrast to the entry point of your ray). One calls such a quadratic equation to be of second order btw. lambda*x + (1-lambda)*y always gives you a point on the linear vector or geometric line between those two points x and y. you can test that pretty easily. if lambda=0 then you get y. if lambda=1 then x. Lambda=0.5 gives you (x+y)/2, the middle point between the two points. and so on and so on. There's not much behind that ![]() just solve to lambda. during that you'll get something like lambda^2(1/a^2 +1/b^2 + 1/c^2) + 2*lambda(x2/((x1-x2)*a^2) + y2/((y1-y2)*b^2) + z2/((z1-z2)*c^2)) = (1 - x2^2 - y2^2 - z2^2)/(x1-x2)*(y1-y2)*(z1-z2) which you can further solve by dividing through the factor at the lambda^2 part and then using good old school math to get it quadratic and get the solution. @picard: such things you do on classic paper ![]() ![]() |
Author: | captain_picard [ 07 Dec 2008, 20:00 ] |
Post subject: | Re: Ship Shield Effects |
Sorry, I should have explained it more ![]() This is the ellipsoid equation: x^2/a^2+y^2/b^2+z^2/c^2==1 This is the definition of a line in 3 dimensions (the intersection of 2 planes):x+a1 y+a2 z==a3 &x+b1 y+b2 z==b3 I used a program called Mathematica that can solve symbolically many kinds of equations ![]() ![]() ![]() {{x->...,y->...,z->...},{x->...,y->...,z->...}} where x,y,z are the coordinates of the point (there are 2 points since the ellipsoid is 2nd order. |
Author: | Malvoisin [ 07 Dec 2008, 20:09 ] |
Post subject: | Re: Ship Shield Effects |
alright, I know that program too ![]() ![]() now I understand the a1, a2,.. 's ![]() ![]() |
Author: | cdrwolfe [ 07 Dec 2008, 22:29 ] |
Post subject: | Re: Ship Shield Effects |
Hmm i'll take your word for it ![]() With regards to FEM, I'am currently working with microeletromechanical systems (MEMS) in which simulation of the geometric device and properties uses various techniques depending on the level of abstraction you want, of which finite element analysis / finite meshes is one. All about finding how much a beam bends or the effects of magnetism yadda yadda. Regards Wolfe |
Author: | captain_picard [ 08 Dec 2008, 01:08 ] |
Post subject: | Re: Ship Shield Effects |
Quote: but why the detour? ![]() ![]() Wolfe, in which language have you written your code? If it is in C, I could try and write a small routine that does what you want based on Mals algorithm. Cheers |
Author: | cdrwolfe [ 08 Dec 2008, 01:25 ] |
Post subject: | Re: Ship Shield Effects |
It is in C#, so practically the same ![]() If you want you could give some random numbers for each of A B and C and the ellipse and write it out step by step lol, but i imagine that might take awhile ![]() So far what i have working seems to be ok but I may have to go back to the hard core math method if possible. Regards Wolfe |
Author: | Malvoisin [ 08 Dec 2008, 08:00 ] |
Post subject: | Re: Ship Shield Effects |
pen&paper, pen&paper.. ![]() actually it's much less "hard core" math than you think: First, let's take out the third dimension (you'll see later on why this is not hurting anything). So the ellipsoid equation becomes an ellipse equation and looks like: x^2/a^2 + y^2/b^2 = 1 . Now let's take one special case and that's where a=b, then it gets to: x^2/a^2 + y^2/a^2 = 1. This is equal to: (x^2+y^2)/a^2=1 which is the same as x^2 + y^2 = a^2 . now let's just rename things (a little wildly I admit): a^2 + b^2 = c^2 . Now that does sound familiar, doesn't it? ![]() so actually the ellipsoid equation is simple pythagoras in the end ![]() |
Author: | Malvoisin [ 09 Dec 2008, 07:20 ] |
Post subject: | Re: Ship Shield Effects |
of course never forget to translate the ellipsoid centre into the coordinate system's origin, i.e. take the vector from the origin to the centre point A (i.e. A) and subtract it from points B and C when insert B and C into the lambda formula. So instead of B and C you take (B-A) and (C-A). Otherwise the formula only works in case where A=0 ![]() |
Author: | 3 0f 12 [ 09 Dec 2008, 07:26 ] |
Post subject: | Re: Ship Shield Effects |
I must admit, this is beyond me, (borg synaptic processor explodes). But the effects are coming along nicely, nice job all. |
Author: | Malvoisin [ 09 Dec 2008, 07:46 ] |
Post subject: | Re: Ship Shield Effects |
I also forgot you need to gram-schmidt orthonormalise (preserves norm of all vectors!) into the new vector space basis given by the vectors (a-A), (b-A) and (c-A) (yes, these are vectors at first, although in the ellipsoid formula, you take their norm and call it a, b and c). After that transform vector (B-A) and (C-A) into that new basis and calculate the formula. you need to do that cause your ellipsoid usually isn't oriented along the 3 main axes! |
Author: | Matress_of_evil [ 09 Dec 2008, 09:56 ] |
Post subject: | Re: Ship Shield Effects |
I vote we rename this thread the maths thread. People like me know to avoid it then. ![]() So get any screenies of the shield effects yet? Or combat system updates? It would be nice to put something about the combat system on the front page of the portal... |
Author: | captain_picard [ 09 Dec 2008, 10:03 ] |
Post subject: | Re: Ship Shield Effects |
Quote: I also forgot you need to gram-schmidt orthonormalise ![]() ![]() ![]() ![]() |
Author: | cdrwolfe [ 09 Dec 2008, 11:18 ] |
Post subject: | Re: Ship Shield Effects |
I have the shield effect, first pass 90% done, everything is generally set up but i need to get the shield hit textures to align to the normal of the triangle it intersects. At the moment it is just a flat plane. Still i'am shocked it was done this quickly (touch wood). Regards Wolfe |
Author: | Malvoisin [ 09 Dec 2008, 14:55 ] |
Post subject: | Re: Ship Shield Effects |
I'm not very familiar with the actual mapping of textures done in 3D engines. Maybe you can ask the ST:Excalibur guys how they did it (if they already implemented shields and the corresponding shield texture mapping). |
Page 1 of 2 | All times are UTC [ DST ] |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |