Preventing weapon from going through walls?

Started by cellis, January 22, 2018, 03:00:54

Previous topic - Next topic

cellis

Does anyone know how can i prevent my FPS weapon from going through walls? Is a there a layered rendering system that i can put in place?


CoDi

a) Render the scene first, then clear the depth buffer, then render the weapon model. Clearing the depth buffer should be fairly cheap nowadays.

b) You may be able to divide the depth buffer range, at the cost of precision. For example, map the weapon model to use the first 10% of the depth buffer, and let the scene use the remaining 90%. Might need careful tweaking to minimize Z fighting.