Culling mask for weapons

Materials, textures, lighting, postfx
9 posts Page 1 of 1
saindd
Posts: 220
Joined: Wed Apr 15, 2015 3:20 am
by saindd » Wed Apr 15, 2015 5:35 am
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?
andrewmac
Posts: 295
Joined: Tue Feb 03, 2015 9:45 pm
 
by andrewmac » Wed Apr 15, 2015 3:42 pm
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:

https://www.youtube.com/watch?v=iYaOkbC58W4

Could you explain how this concept would be applied to the issue you're experiencing?
saindd
Posts: 220
Joined: Wed Apr 15, 2015 3:20 am
by saindd » Thu Apr 16, 2015 1:54 am
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.
JeffR
Steering Committee
Steering Committee
Posts: 858
Joined: Tue Feb 03, 2015 9:49 pm
 
by JeffR » Thu Apr 16, 2015 4:38 am
So rather than the weapon being pushed back, you just want it to be rendered over everything else in the scene to avoid clipping?
saindd
Posts: 220
Joined: Wed Apr 15, 2015 3:20 am
by saindd » Thu Apr 16, 2015 4:57 am
Yes.
buckmaster
Steering Committee
Steering Committee
Posts: 321
Joined: Thu Feb 05, 2015 1:02 am
by buckmaster » Sun Apr 19, 2015 5:17 am
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.
andrewmac
Posts: 295
Joined: Tue Feb 03, 2015 9:45 pm
 
by andrewmac » Mon Apr 20, 2015 3:25 pm
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 ... 2155-L2189

Be 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 ... 1807-L1811

As 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.
chriscalef
Posts: 377
Joined: Mon Feb 09, 2015 7:48 pm
by chriscalef » Tue Apr 21, 2015 5:09 am
+1 for this thread. I've always hated Torque's behavior but never enough to look into alternatives.
saindd
Posts: 220
Joined: Wed Apr 15, 2015 3:20 am
by saindd » Thu Apr 23, 2015 12:13 am
Thanks a lot for the detailed help, andrewmac. It's a great start!
9 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests