Hisashimaru Posted April 27, 2012 Share Posted April 27, 2012 Hi, I'm trying to draw a weapon model using HUD, but I have a problem. My weapon model goes through walls. like this: 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? Quote Link to comment Share on other sites More sharing options...
Road Kill Kenny Posted April 27, 2012 Share Posted April 27, 2012 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 ) Quote 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 More sharing options...
Pixel Perfect Posted April 27, 2012 Share Posted April 27, 2012 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 1 Quote 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 More sharing options...
Hisashimaru Posted April 27, 2012 Author Share Posted April 27, 2012 Expand radius of controller is easy to solve, but I think this method cause other problem. How do I set ignore the z order? I tried edit material's zsort, depthtest parameter's, but it doesn't work... Quote Link to comment Share on other sites More sharing options...
Road Kill Kenny Posted April 27, 2012 Share Posted April 27, 2012 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 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. Quote 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 More sharing options...
Hisashimaru Posted April 28, 2012 Author Share Posted April 28, 2012 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! Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted April 30, 2012 Share Posted April 30, 2012 Third possible way: If the player's weapon is too close to an object, point it upwards so that you can't fire. Sort of like in Crysis 2. Quote Link to comment Share on other sites More sharing options...
ChrisV Posted April 30, 2012 Share Posted April 30, 2012 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. This way, I didn't need to change the radius size of the character controller. Quote My Artwork. 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 More sharing options...
njord Posted May 8, 2012 Share Posted May 8, 2012 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. Quote Link to comment Share on other sites More sharing options...
njord Posted May 8, 2012 Share Posted May 8, 2012 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" ??? 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.
Note: Your post will require moderator approval before it will be visible.