saindd Posted April 15, 2015 Share Posted April 15, 2015 I have noticed that Torque uses quite a different approach when the weapon is near a wall. The weapon "collides" with the wall and is pushed back. While this is a nice approach, is it possible to use the traditional culling mask? Quote Link to comment Share on other sites More sharing options...
andrewmac Posted April 15, 2015 Share Posted April 15, 2015 Could you elaborate on this idea? I've never heard of a culling mask before, so I googled it and found this video from Unity: Could you explain how this concept would be applied to the issue you're experiencing? Quote Link to comment Share on other sites More sharing options...
saindd Posted April 15, 2015 Author Share Posted April 15, 2015 Basically, you render twice: once without the weapon and then with it. Then just merge, with the weapon being with high priority. So it doesn't go through walls. Quote Link to comment Share on other sites More sharing options...
JeffR Posted April 16, 2015 Share Posted April 16, 2015 So rather than the weapon being pushed back, you just want it to be rendered over everything else in the scene to avoid clipping? Quote Link to comment Share on other sites More sharing options...
saindd Posted April 16, 2015 Author Share Posted April 16, 2015 Yes. Quote Link to comment Share on other sites More sharing options...
buckmaster Posted April 19, 2015 Share Posted April 19, 2015 This is what other engines tend to do AFAIK - render weapons on top of everything else. It becomes especially obvious when you stand near a wall and your gun shadow goes all funny. Quote Link to comment Share on other sites More sharing options...
andrewmac Posted April 20, 2015 Share Posted April 20, 2015 I'm pretty sure it already does this. I can't think of any examples where the gun doesn't render over things. The only difference is with T3D it pushes the weapon back as you get close to a wall. I haven't tested it, but I believe the only code doing this is this:https://github.com/GarageGames/Torque3D/blob/development/Engine/source/T3D/shapeImage.cpp#L2155-L2189Be advised though, that removing that bit will let you shoot through a wall. Once you move the muzzle into the wall the muzzle starting point will be past the wall and your bullet will start after the wall. I think this can be avoided by just approaching the problem from here:https://github.com/GarageGames/Torque3D/blob/development/Engine/source/T3D/shapeImage.cpp#L1807-L1811As far as I can tell removing that bit would prevent the rendered muzzle vector from being corrected for collision, but still leave the actual muzzle vector corrected. There is a chance drawing the weapon is depth tested ( I didn't look ), resulting in the weapon being clipped by the wall you're walking into, this can be avoid by turning off depth testing in the stateblock for the shape image. Quote Link to comment Share on other sites More sharing options...
chriscalef Posted April 21, 2015 Share Posted April 21, 2015 +1 for this thread. I've always hated Torque's behavior but never enough to look into alternatives. Quote Link to comment Share on other sites More sharing options...
saindd Posted April 22, 2015 Author Share Posted April 22, 2015 Thanks a lot for the detailed help, andrewmac. It's a great start! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.