Topic: Z Depth!
Hi,
Is there a way to disable/enable it for an object whether through script or sdk?
Thanks.
Regards.
You are not logged in. Please login or register.
Hi,
Is there a way to disable/enable it for an object whether through script or sdk?
Thanks.
Regards.
Through sdk you can do everything, the difficulty is to do it before drawing an object.
But there is maybe a simpler way, what do you want to do ?
Exemple to disable zbuffer :
MRenderingContext * render = engine->getRenderingontext();
// you can clear zbuffer
render->clear(M_BUFFER_DEPTH);
// or disable depth test completly
render->disableDepthTest(); // re-enable by doing : render->enableDepthTest();
// or just disable writing to depth
render->setDepthMask(1); // re-enable by doing : render->setDepthMask(0);
That is how I am also doing.
But I only want to disable single object, not the whole level. Say, the gun, stop it to going through walls.
Thanks.
Regards.
personally, for the player gun in a fps, I would reduce the size of the gun to be sure it's less than the collision box and put it closer to the camera eye.
If you really don't want to change the size, you can do a separate layer like the GUI, and put the 3d gun in a separate scene that you render after the game scene.
Reducing the size will work fine but putting the gun on a separate layer might cause a problem. It won't get effected by the main scene lights I think.
If you want kindly add it as lua script for the a future release. There are some games which needs it.
Thanks.
Regards.
I'm not sure about adding an option to disable depth test for a single object, it might cause some problems, for a non-flat object, it will make the polygons of the objects penetrating themselves. It will produce the same problem with shadows, if the object was supposed to penetrate a wall, the wall shadow will still cut the object where he was supposed to penetrate the wall.
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 3 official extensions. Copyright © 2003–2009 PunBB.