Showing results for 
Search instead for 
Did you mean: 

Z-Fighting And Gear controller (unity)

Level 4
I am building a first person shooter for gear vr, that allows freedom of movement with the touchpad on the controller. Everything is looking awesome so far but i would like to avoid future headaches at submission, so I am exploring 2 options for the issue of the weapons... as there is freedom of movement, strange things happen when you move close to walls or other objects. As i see it i have 2 options both with a unique set of problems.

Option 1: (my favorite so far) 2 cameras, 1 to render the gun and ammo counter, drawn on top. Is this allowed? I read in the documentation that apps will be rejected if there is obvious z-fighting, and with this option the gun has no collider and can technically at times be behind a wall but drawn on top.

I would much prefer to use this solution, but will the z fighting be an issue, and is a HUD camera allowed? so far it does not seem to affect performance.

Option 2: Mesh colider on my weapon: Definitely no z fighting here, but with the freedom of movement i feel game play is clunky, as if you are close to a wall, rotating the controller will "push" the player away from the wall, and even worse rotating a larger weapon towards the floor will push the player up.

Thoughts? anybody run into similar issues? would love to hear from occulus staff about The z fighting issue! Thanks!


Level 4
ZFighting refers to geometry constantly fighting producing obvious artifacts, not necessarily geometry penetrating or geometry not making sense. This is the type of z fighting we look for:


That would get flagged as z fighting. 

If your gun renders on top of the wall without any visual artifacts it will not be flagged as z fighting.

Traditionally, guns are rendered with a different projection matrix to prevent them from clipping trough walls, which the 2 camera setup kind of mimics. I feel like this may look off stereoscopically as both eyes would see the gun from the same angle? Since there is only one camera rendering the gun... I could be wrong on this, i have not tried it. I'd be interested to see your results.

Level 4
Thanks for your feedback! I think I understand Z fighting now. Dont have any artifacts like that in my project, however as for my method of drawing the gun, please take a peek at the image below. I had to use a screen recorder app to get the stereo view, not sure if you can tell, but in world space, the gun is actually behind this wall, but drawn on top, as you can see in the top image.

It looks natural in the game, however if you get really close to a corner and shut one eye, you can definatly get a hint of the perspective trickery, as anything extremely close to the face may reveal to keen eyes that the gun is drawn on top.

Do you think this will be an issue submitting to the oculus store?