depth = (room_width-x)+(room_height-y)It works, but not from different view points

How I can fix that? I will give credits in my game
Posted 08 December 2011 - 07:47 AM
depth = (room_width-x)+(room_height-y)It works, but not from different view points

Posted 08 December 2011 - 03:25 PM
var cam_pos_x; var cam_pos_y; var cam_pos_z; // set these variables to the position of the camera var cam_dist_sq; cam_dist_sq = (cam_pos_x - x) * (cam_pos_x - x) + (cam_pos_y - y) * (cam_pos_y - y) + (cam_pos_z - z) * (cam_pos_z - z); depth = cam_dist; // or depth = round(cam_dist); or something
Posted 09 December 2011 - 03:24 AM
d3d_set_zwriteenable(false); //glowing object draw code d3d_set_zwriteenable(true);It really only works on objects that don't have a clearly defined shape, like the one in the screenshot, because it orders the faces incorrectly but removes the artifacts.
Edited by jsorgeagames, 09 December 2011 - 03:24 AM.
Posted 09 December 2011 - 09:24 PM
If you're using GM8.1.139, you can fake the depth ordering:
d3d_set_zwriteenable(false); //glowing object draw code d3d_set_zwriteenable(true);It really only works on objects that don't have a clearly defined shape, like the one in the screenshot, because it orders the faces incorrectly but removes the artifacts.
Edited by ean, 09 December 2011 - 09:27 PM.
Posted 09 December 2011 - 11:51 PM
A common approach is to set the depth using the distance from the camera position, so far away objects are drawn first, then nearer ones, so blending will work correctly.
var cam_pos_x; var cam_pos_y; var cam_pos_z; // set these variables to the position of the camera var cam_dist_sq; cam_dist_sq = (cam_pos_x - x) * (cam_pos_x - x) + (cam_pos_y - y) * (cam_pos_y - y) + (cam_pos_z - z) * (cam_pos_z - z); depth = cam_dist; // or depth = round(cam_dist); or something
Posted 10 December 2011 - 07:03 AM
I do know that the function is not listed in the help file. I am on the beta channel so it might be an unstable-update-only function.No such function exists, I checked to make sure I have the latest update in the stable channel too. Am I supposed to update to the latest unstable version? (I'm not going to if I do.) In the list of updates it says D3D_ZWRITEENABLE but that doesn't do anything.
Posted 11 December 2011 - 01:02 AM
0 members, 0 guests, 0 anonymous users