Hard Light Productions Forums
Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: Col. Fishguts on February 08, 2008, 10:11:37 am
-
Ok, let's say I have a custom fighter with its own shield mesh. Now the problem is that the shield hit effect behaves rather weird in some places. It seems that the effect gets mapped to some polys it's not supposed to, while omitting some polygons where it should be mapped instead (see picture). Or in some cases, when I shoot at one end of the shield some polygons on the other end of the shield light up slightly too. The shield itself works perfectly, no collision errors or somesuch, it's just the shield hit effect that's acting up.
(http://b5-project.com/img/misc/screen0141.jpg)
Since I first suspected it was the Max exporters fault, I converted the shield mesh to 3DS and the COB via TrueSpace, and then converted it with both PCS1.x and PCS2, but the result is always the same. So it's not a conversion error, but rather an error in the way the mesh is constructed, I'm suspecting something with the vertice/edge order of the mesh.
So I'm asking anybody who ever succesfully created a fully working shield mesh, what's the trick to get it behave normally ? I know it has to be triangulated, which mine is. So, something else ?
-
Ah, this looks like a fun problem. I'm trying to think now, did you weld all the vertices? Remember to assign smoothing groups? check the direction of normals? Have you tried deleting the offending faces and just recreate them?
I've never worked on a shield before, so I could be wrong. I have however ran into strange rendering errors like this before in Maya. Sometimes it's a polygon that needs to be flipped or recreated because something got screwed up. Another way to check is to do a SUB-D check on the mesh.
If it smooths out fine with no disconnected areas or strange holes, you're okay. If you do get holes, it has something to do with your normals orient ation for that face or group of faces.
-
That looks more like a UV mapping problem to me... :nervous:
-
...did you weld all the vertices? Remember to assign smoothing groups? check the direction of normals? Have you tried deleting the offending faces and just recreate them?
Yes, everything is welded. Smoothing has no influence on the shield mesh, neither does UV mapping. What I've observed is that if I do a mesh-smooth on the shield, all the newly inserted faces are causing problems, and when I delete them and weld the vertices the problem disappears on that face. That's why I suspect the vertex/edge order to be part of the problem.
-
post a 3ds of just the shield.
-
post a 3ds of just the shield.
Here: Clickety (http://b5-project.com/img/misc/shields.zip)
This contains the original shield I wanted to use, as well as a slightly poly-reduced version, which behaves a bit better, but still not as it should.
-
Some of the mesh wasn't connected to itself. - Don't know if this is is an issue for the Max plugin.
(modified mesh mirrored and welded)
[attachment deleted by ninja]
-
Some of the mesh wasn't connected to itself. - Don't know if this is is an issue for the Max plugin.
(modified mesh mirrored and welded)
Hmm, I used PCS2 to convert your mesh, and while it looks better than my attempts, the rendering errors are still there. Can you produce a correct shield from the mesh you posted ?
-
Seemed ok - Although I put the shield on an Apollo :nervous: - (PCS2d)
-
Could you post the POF ? If yours works correctly I could import the shield to my POF in PCS ;7
-
Let me know if it works. It was hard to test because the Apollo is totaly the wrong shape.
http://files.filefront.com/shield+fghtrzip/;9602219;/fileinfo.html (http://files.filefront.com/shield+fghtrzip/;9602219;/fileinfo.html)
-
Sadly it's ridden with the same bugs as my version. Especially on the front part much weirdness is going on:
(http://b5-project.com/img/misc/screen0143.jpg)
But thanks for you efforts anyway.
-
Could you test this shield for the problem
http://files.filefront.com/shield+azip/;9611665;/fileinfo.html (http://files.filefront.com/shield+azip/;9611665;/fileinfo.html)
It's basically going the other way - down to 80 poly
-
That one works nicely, although it's a tad too small.
Did you make that from scratch ? If yes, with what program ? Maybe the problem is with 3ds Max itself.
-
Aha, the plot thickens. I've also made a new one from scratch starting with GeoSphere of exactly 80 faces, and it also works.
Closer inspection of :v: fighter/bomber POFs reveals that they all have shield meshes of exactly 80 faces, coincidence ... I think not.
I'm suspecting that there's something hard-coded into the engine that assumes that the shield mesh has always 80 (or less) polygons, and that any excess polys are omitted from the shield effect rendering.
I also checked some other fan-made POFs, and one that I found with a shield mesh of more than 80 faces is Nico's HTL Ezechiel, and lo and behold: its shield also has rendering glitches when shot at. I think we need some insight from a coder.
-
hmm
#define SHIELD_HIT_SCALE 0.15f // Doubled on 12/23/97 by MK. Was overflowing. See todo item #924.
//#define MAX_SHIELD_HITS 20
#define MAX_TRIS_PER_HIT 40 // Number of triangles per shield hit, maximum.
#define MAX_SHIELD_HITS 20 // Maximum number of active shield hits.
#define MAX_SHIELD_TRI_BUFFER (MAX_SHIELD_HITS*MAX_TRIS_PER_HIT) //(MAX_SHIELD_HITS*20) // Persistent buffer of triangle comprising all active shield hits.
#define SHIELD_HIT_DURATION (3*F1_0/4) // Duration, in milliseconds, of shield hit effect
[edit]
i don't see any reason why there should be an 80-polygon thing going on.. i don't see anything in the code that should be causing that
-
#define MAX_TRIS_PER_HIT 40 // Number of triangles per shield hit, maximum.
Would this mean that only 40 triangles can be lit up at one time on a 500 poly shield mesh?
-
#define MAX_SHIELD_TRI_BUFFER (MAX_SHIELD_HITS*MAX_TRIS_PER_HIT) //(MAX_SHIELD_HITS*20) // Persistent buffer of triangle comprising all active shield hits.
This one also looks suspicous, especially since "//#define MAX_SHIELD_HITS 20" is commented out in the code bit above. Maybe MAX_SHIELD_HITS is defined somewhere else as 2, limiting the MAX_SHIELD_TRI_BUFFER to 80.
Alternatively, the problem could also lie in the part where the shield effect bitmap gets mapped to the shield mesh. I'm guessing that the engine dynamically generates UV coordinates for each hit effect. Maybe during this process, the engine assumes a maximum of 80 faces for the shield mesh.
-
Have a quick look at :v: freighter06
Shield 180 faces, bubble style - not form fitted to model.
-
Hm, you're right. But all the FS1 freighter POFs have those 180 poly bubble shield meshes. But ingame the freighters have neither a shield nor shield hit effects, so I guess the idea of shielded freighters was dropped during the development of FS1. The newer FS2 freighters don't have a shield mesh.
-
i think i know why they were doing specific number of polygons. I don't think the code that slaps the shield it effect texture onto the mesh compensates for size of polygons