Jump to content

Drawing HUD weapon model


Hisashimaru
 Share

Recommended Posts

Hi,

I'm trying to draw a weapon model using HUD, but I have a problem.

My weapon model goes through walls.

 

like this:

2rrx5ad.jpg

 

 

If I clear the depth buffer before drawing the weapon model, the model doesn't go through walls,

but this method can't use render lights because the depth buffer is already cleared.

 

Any solutions to fix this problem?

Link to comment
Share on other sites

If you are using the LE controller. Simply increase the radius of your controller so that it collides with walls before ur weapon goes through them. The default is only 0.4m.

 

TController CreateController( flt height, flt radius, flt stepheight=0.5f, flt maxslope=45, flt crouchheight=0 )

STS - Scarlet Thread Studios

AKA: Engineer Ken

 

Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now!

Link to comment
Share on other sites

I think you could also probably set the material on the weapon to ignore the z order and always draw over the top. Simply expanding the radius of the controller to encompass the weapon could cause other issues like the inability to fit through narrow door ways :)

  • Upvote 1

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Link to comment
Share on other sites

I think you could also probably set the material on the weapon to ignore the z order and always draw over the top. Simply expanding the radius of the controller to encompass the weapon could cause other issues like the inability to fit through narrow door ways wink.png

 

Yeh that could work I guess. Might look a bit odd tho. Not sure. Player probably won't notice

 

Either way judging by the picture you probably only need to increase it by a tiny bit to maybe 0.45.

 

Alternatively you could just make his arm a tiny bit further back. Does seem like its sticking out a fair way further than it needs to be.

STS - Scarlet Thread Studios

AKA: Engineer Ken

 

Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now!

Link to comment
Share on other sites

Yeh that could work I guess. Might look a bit odd tho. Not sure. Player probably won't notice

 

Either way judging by the picture you probably only need to increase it by a tiny bit to maybe 0.45.

 

Alternatively you could just make his arm a tiny bit further back. Does seem like its sticking out a fair way further than it needs to be.

I set the radius to 0.45. it's perfect size.

Your another trick does work too. I use both methods.

 

Thank you guys!

Link to comment
Share on other sites

I had the same problem with my gun and arm model. Adjusting the scale of the model and also changing the position of the model got rid of the issue. smile.png

This way, I didn't need to change the radius size of the character controller.

 

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

I tried to do the same thing for a "Gizmo 3D" model, so that each entity would have colored local axis arrows attached to its pivot, showing its relative orientation and position. But of course, I wanted Gizmo to be always visible just like in the Editor.

 

Disabling depthtest is not enough. You also have to force the material to be rendered "last".

 

Zsort=1 forces the object to be rendered last, but also it sorts these kind of objects before drawing, and makes them transparent. I have tested with a lot of objects instanced, if u use Zsort=1, it decreases the performance way faster than a Zsort=0 mat due to sorting.

 

Partial solution to your problem would be using a material like this :

 

texture0="abstract::blackwhite.dds"
color=1.0,1.0,1.0,1.0
depthmask=1
colormask=1
depthtest=0
castshadows=0
invisible=0
specular=0.5
gloss=0.5
bumpscale=0.5
zsort=1
cullface=0
overlay=0
blend=0
shader="abstract::mesh_diffuse.vert","abstract::mesh_diffuse.frag"

 

But you will have a semi transparent mat.

Any one knows how to fix that, I would be glad to know. My gizmos are transparent, i dont want them to be. I just want them to be always visible.

Link to comment
Share on other sites

In other words, I am asking how to show a gun in your hand properly, not penetrating other objects or walls, without any tricks like scaling/positioning, but by using "depthtest disabling" and "rendering last" ???

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...