Jump to content

Disable depth testing on weapons


Olby
 Share

Recommended Posts

I am trying to make sure that "camera objects", such as weapons, never go through the level geometry. Back in the DarkBasic days there used to be a command to disable object's z-depth. I think the closest match in LE is the Depth Test setting in the material editor. In the image below I disabled depth test for both the shotgun and the hand's materials. Either or but the result is not what I expect. I need the model "to be on the top" of everything else while maintaining the visual integrity. Thanks.

 

post-4357-0-98743600-1452694111_thumb.jpg

Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)

Link to comment
Share on other sites

Seems to me like you'd need to set the min and max range of your cam (clipping), and use two cams, instead of one...one for your weapon which has a max view range of say 10, and another cam that renders everything else besides your weapon.

 

Not sure if LE has that option, but at least that's the way it's usually done.

 

You could also try by making the collision shapes for your walls a bit bigger, thus preventing your weapon to go inside the walls.

 

Or, you could use a raycast method, and when your character is at a certain range of a wall (or other object), make the arms retract (using an animation), so that the weapon doesn't go through.

 

Btw, loved DarkBasic Pro. Brings back good memories. smile.png

  • Upvote 1

 

ZBrush 4R7 64-bit - 3DCoat 4.5 BETA 12 - Fl Studio 12 64Bit - LE 3.2 Indie version - Truespace 7 - Blender 2.71 - iClone 5.51 Pro - iClone 3DXChange 5.51 pipeline - Kontakt 5 - Bryce 7 - UU3D Pro - Substance Designer/Painter - Shadermap 3 - PaintShop Photo Pro X7 - Hexagon - Audacity - Gimp 2.8 - Vue 2015 - Reaktor 5 - Guitar Rig 5 - Bitmap2Material 3

Link to comment
Share on other sites

You need a model shader that always draws in-front of everything else, but not in front of any other faces with the same shader.

 

How to do it? Beats me, ask Shadmar as I've been wondering the same thing.

  • Upvote 1

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

Sometimes I miss the simplicity of the fixed function pipeline. You had commands to do this and that. And now since I've never fully learned HLSL nevermind GLSL it is beyond me as well.

Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)

Link to comment
Share on other sites

When you have accurate lighting it introduces the possibilities of glitches you didn't know you could have. For example, even if you render the weapon in a second pass on top of the scene, the gun will get the shadow's wall on it when it goes through the wall. This can be observed in the game STALKER.

 

I would do a line pick and lower the weapon when you are up against a wall. That's the only realistic way to solve this.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

You can't solve this in a shader, the problem is.. the gun is not .. a model.. it's 3 models. Hand, cob, barrel (orso)..

I'd do as Josh says, or quickly switch the 3-model gun to a 1-model gun and turn off depth-test when near a wall.

  • Upvote 1

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

You can't solve this in a shader, the problem is.. the gun is not .. a model.. it's 3 models. Hand, cob, barrel (orso)..

I'd do as Josh says, or quickly switch the 3-model gun to a 1-model gun and turn off depth-test when near a wall.

 

The gun is a model, it just uses 3 different materials. If the view model was set up right, I think disabling depth test would be the answer then. Thanks for the info.

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

I would do a line pick and lower the weapon when you are up against a wall. That's the only realistic way to solve this.

As i suggested earlier.

It's not the most commonly used method, nor the only one to solve this problem, but it does add to the realism and it's not too difficult to do. smile.png

  • Upvote 2

 

ZBrush 4R7 64-bit - 3DCoat 4.5 BETA 12 - Fl Studio 12 64Bit - LE 3.2 Indie version - Truespace 7 - Blender 2.71 - iClone 5.51 Pro - iClone 3DXChange 5.51 pipeline - Kontakt 5 - Bryce 7 - UU3D Pro - Substance Designer/Painter - Shadermap 3 - PaintShop Photo Pro X7 - Hexagon - Audacity - Gimp 2.8 - Vue 2015 - Reaktor 5 - Guitar Rig 5 - Bitmap2Material 3

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...