| Author |
Message |
|
cdrwolfe
Combat Engineer
Joined: 18 Jul 2005, 01:00 Posts: 1001
|
Has anyone come across a neat way to implement ship shield effects, i.e actually 'Know' how it is implemented  in most games. Regards Wolfe
|
| 04 Dec 2008, 19:26 |
|
 |
|
Malvoisin
Fleet Admiral
Joined: 13 Nov 2006, 01:00 Posts: 2111 Location: Germany
|
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.
|
| 04 Dec 2008, 19:51 |
|
 |
|
Matress_of_evil
Evil Romulan Overlord of Evil - Now 100% Faster!
Joined: 02 Dec 2004, 01:00 Posts: 7392 Location: Returned to the previous place.
|
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: - 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!
|
| 04 Dec 2008, 19:53 |
|
 |
|
Malvoisin
Fleet Admiral
Joined: 13 Nov 2006, 01:00 Posts: 2111 Location: Germany
|
lol faster at the trigger 
|
| 04 Dec 2008, 19:54 |
|
 |
|
cdrwolfe
Combat Engineer
Joined: 18 Jul 2005, 01:00 Posts: 1001
|
it looks like i may have to use shaders :S where is Strings when you need him lol.
Regards Wolfe
|
| 04 Dec 2008, 21:09 |
|
 |
|
Malvoisin
Fleet Admiral
Joined: 13 Nov 2006, 01:00 Posts: 2111 Location: Germany
|
|
| 04 Dec 2008, 21:44 |
|
 |
|
cdrwolfe
Combat Engineer
Joined: 18 Jul 2005, 01:00 Posts: 1001
|
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
|
| 04 Dec 2008, 23:26 |
|
 |
|
Matress_of_evil
Evil Romulan Overlord of Evil - Now 100% Faster!
Joined: 02 Dec 2004, 01:00 Posts: 7392 Location: Returned to the previous place.
|
All that we ask is that the final result looks like that youtube video...or better. 
|
| 05 Dec 2008, 00:13 |
|
 |
|
cdrwolfe
Combat Engineer
Joined: 18 Jul 2005, 01:00 Posts: 1001
|
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
|
| 06 Dec 2008, 01:08 |
|
 |
|
Matress_of_evil
Evil Romulan Overlord of Evil - Now 100% Faster!
Joined: 02 Dec 2004, 01:00 Posts: 7392 Location: Returned to the previous place.
|
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.
Shield Effects.png [ 9.78 KiB | Viewed 20893 times ]
And this is what the shields look like ingame:
Shields.png [ 144.42 KiB | Viewed 20892 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. 
|
| 06 Dec 2008, 01:34 |
|
 |
|
Malvoisin
Fleet Admiral
Joined: 13 Nov 2006, 01:00 Posts: 2111 Location: Germany
|
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  ): http://bridgecommander.filefront.com/fi ... ures;79751it 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.htmlI don't know if this refracting texture thing is useful for us: http://www.interlopers.net/index.php?pa ... ls&id=7216
|
| 07 Dec 2008, 17:02 |
|
 |
|
TrashMan
Ship Engineer
Joined: 09 Jun 2005, 01:00 Posts: 334 Location: On the bridge of the USS Apocalypse
|
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.
_________________ - Modeler and Modder
- Vision of Escaflowne and Tolkien fan
|
| 07 Dec 2008, 17:25 |
|
 |
|
Malvoisin
Fleet Admiral
Joined: 13 Nov 2006, 01:00 Posts: 2111 Location: Germany
|
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)
|
| 07 Dec 2008, 17:32 |
|
 |
|
cdrwolfe
Combat Engineer
Joined: 18 Jul 2005, 01:00 Posts: 1001
|
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.htmlNow all i have to do is apply normailzed animated textures to the triangle it intersects and viola  I hope  . 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?
|
| 07 Dec 2008, 18:34 |
|
 |
|
captain_picard
Communications Officer
Joined: 21 Aug 2008, 16:59 Posts: 717 Location: On this multiverse: EU
|
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...
Attachments:
test.pdf [119.65 KiB]
Downloaded 382 times
_________________ "Never give up. Never surrender." -- Kenneth_of_Borg
"Seize the time, Meribor. Live now; make now always the most precious time. Now will never come again" -- Picard (The Inner Light)
|
| 07 Dec 2008, 19:14 |
|
 |
|
Matress_of_evil
Evil Romulan Overlord of Evil - Now 100% Faster!
Joined: 02 Dec 2004, 01:00 Posts: 7392 Location: Returned to the previous place.
|
*Matress looks at the solution.*
*Matresses brain melts. Maths was never his strong subject.*
|
| 07 Dec 2008, 19:51 |
|
 |
|
Malvoisin
Fleet Admiral
Joined: 13 Nov 2006, 01:00 Posts: 2111 Location: Germany
|
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  ), I only don't understand what the rho does in the formula. rho should be 1 in this case. rho usually describes densities of the material inside the ellipsoid when calculating intertia moments of the ellipsoid. Maybe ask him what he means with that. "The root in [0,1]"-part in his answer actually only refers to the fact that lambda will lie between 0 and 1 since our two points B and C lie in- and outside the ellipsoid so the intersection point lies somewhere in the middle. 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  . No seriously, what again is a1, a2 and b1, b2? we should solve for x=lambda*x1 + (1-lambda)*x2) , y=.. and then for lambda, not the general equation for x,y and z. Also, all numbers (x1,x2,y1,y2,z1,z2) are known so numerically, there's nothing we can gain here. it's just brute force calculating and a modern CPU does that in no-time  .
|
| 07 Dec 2008, 19:54 |
|
 |
|
captain_picard
Communications Officer
Joined: 21 Aug 2008, 16:59 Posts: 717 Location: On this multiverse: EU
|
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  . The solution is given in the form: {{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.
_________________ "Never give up. Never surrender." -- Kenneth_of_Borg
"Seize the time, Meribor. Live now; make now always the most precious time. Now will never come again" -- Picard (The Inner Light)
|
| 07 Dec 2008, 20:00 |
|
 |
|
Malvoisin
Fleet Admiral
Joined: 13 Nov 2006, 01:00 Posts: 2111 Location: Germany
|
alright, I know that program too  . only thing is you don't need this definition of a line (better one in this case is the point and the cross product of the two normal vectors of the planes) since you already have two points to connect with a line. these are given so we should use the lambda definition to get our lambda since otherwise we need to artificially create two planes to intersect along the line between the two points and that wouldn't be necessary I think  . now I understand the a1, a2,.. 's  . you give mathematica two general representations of your planes and tell him to find those points on the ellipsoid that match the plane equations, i.e. are on both planes. well, that is a little too much here in this case. Of course one could form 2 planes with that barymetric line representation we have and then your solution would be correct, but why the detour? 
|
| 07 Dec 2008, 20:09 |
|
 |
|
cdrwolfe
Combat Engineer
Joined: 18 Jul 2005, 01:00 Posts: 1001
|
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
|
| 07 Dec 2008, 22:29 |
|
 |
|
captain_picard
Communications Officer
Joined: 21 Aug 2008, 16:59 Posts: 717 Location: On this multiverse: EU
|
_________________ "Never give up. Never surrender." -- Kenneth_of_Borg
"Seize the time, Meribor. Live now; make now always the most precious time. Now will never come again" -- Picard (The Inner Light)
|
| 08 Dec 2008, 01:08 |
|
 |
|
cdrwolfe
Combat Engineer
Joined: 18 Jul 2005, 01:00 Posts: 1001
|
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
|
| 08 Dec 2008, 01:25 |
|
 |
|
Malvoisin
Fleet Admiral
Joined: 13 Nov 2006, 01:00 Posts: 2111 Location: Germany
|
pen&paper, pen&paper..  (no seriously, I'd recommend solving the equation to lambda on paper first and then it's just a one-liner in C# code to calculate lambda) 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  . You can use pythagoras to determine if a given point (a,b) is on the circle of radius sqrt(c^2)=c. If it fits the equation then yes, if a^2 + b^2 != c^2, then the point lies either inside or outside the circle with radius c. Now what you do above is simply calculating the lamdba needed to make a^2 + b^2 = c^2 (in simplified 2D case) whereby (a,b)=lambda*(x1,y1) + (1-lambda)*(x2,y2). This of course always works in the case where both points (x1,y1) and (x2,y2) lie in- and outside the circle (ellipsoid in 3D general case). In case both points lie outside the circle it can happen that the line does not intersect with the circle at all. You'll notice that when you get to take a sqrt of a negative number on the right side during calculation so there's only a complex solution to the equation.
|
| 08 Dec 2008, 08:00 |
|
 |
|
Malvoisin
Fleet Admiral
Joined: 13 Nov 2006, 01:00 Posts: 2111 Location: Germany
|
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  .
|
| 09 Dec 2008, 07:20 |
|
 |
|
3 0f 12
Crewman
Joined: 26 Jun 2008, 06:29 Posts: 42 Location: Ultramatrix 002
|
I must admit, this is beyond me, (borg synaptic processor explodes). But the effects are coming along nicely, nice job all.
_________________We are the Borg. Lower your shields and surrender your ships. Your biological and technological distinctiveness will be added to our own. Your culture will adapt to service us. RESISTANCE IS FUTILE." - Borg Collective  That doesn't mean I shouldn't be on your friend list.
Borg Quote of the Fortnight: "If only he had the chance of having an out-of-body experience, its truly perfection."
|
| 09 Dec 2008, 07:26 |
|
 |
|
Malvoisin
Fleet Admiral
Joined: 13 Nov 2006, 01:00 Posts: 2111 Location: Germany
|
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!
|
| 09 Dec 2008, 07:46 |
|
 |
|
Matress_of_evil
Evil Romulan Overlord of Evil - Now 100% Faster!
Joined: 02 Dec 2004, 01:00 Posts: 7392 Location: Returned to the previous place.
|
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...
|
| 09 Dec 2008, 09:56 |
|
 |
|
captain_picard
Communications Officer
Joined: 21 Aug 2008, 16:59 Posts: 717 Location: On this multiverse: EU
|
_________________ "Never give up. Never surrender." -- Kenneth_of_Borg
"Seize the time, Meribor. Live now; make now always the most precious time. Now will never come again" -- Picard (The Inner Light)
Last edited by captain_picard on 09 Dec 2008, 11:42, edited 1 time in total.
|
| 09 Dec 2008, 10:03 |
|
 |
|
cdrwolfe
Combat Engineer
Joined: 18 Jul 2005, 01:00 Posts: 1001
|
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
|
| 09 Dec 2008, 11:18 |
|
 |
|
Malvoisin
Fleet Admiral
Joined: 13 Nov 2006, 01:00 Posts: 2111 Location: Germany
|
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).
|
| 09 Dec 2008, 14:55 |
|
 |
|