• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

3D Drawing vertex with a transparent texture problem.

B

Big50000

Guest
Hello, I have a problem with drawing vertex with a transparent texture. It shows some of weird transparent texture rendering like this.
Screenshot_20171228_172640.png
Here is my code.
Code:
//3D System
d3d_start();
//draw_set_alpha_test(1);
//draw_set_alpha_test_ref_value(40);
texture_set_interpolation(1);
LS_create(); //lights
LS_set_ambience($b4b4b4);
LS_set_point_light(0,0,0,32,128,c_yellow);
LS_set_fog(0,c_white,0,256);

//shadow vertex
vformat=vertex_format_create(true,true,true);
global.vertexShadow=vertex_create_buffer();
vertex_begin(global.vertexShadow,vformat);
vertex_point_add(global.vertexShadow,-1,-1,0,0,0,-1,c_white,1.0,0,0);
vertex_point_add(global.vertexShadow,-1, 1,0,0,0,-1,c_white,1.0,0,1);
vertex_point_add(global.vertexShadow, 1,-1,0,0,0,-1,c_white,1.0,1,0);
vertex_point_add(global.vertexShadow,-1, 1,0,0,0,-1,c_white,1.0,0,1);
vertex_point_add(global.vertexShadow, 1,-1,0,0,0,-1,c_white,1.0,1,0);
vertex_point_add(global.vertexShadow, 1, 1,0,0,0,-1,c_white,1.0,1,1);
vertex_end(global.vertexShadow);
Code:
///game_render();
draw_set_color(c_white);

//light

//water

//render
d3d_set_projection_ext(
    0,
    0,
    16*global.class_height[global.player_classid[0]],
    global.player_objid[0].cam_x,
    global.player_objid[0].cam_y,
    global.player_objid[0].cam_z,
    0,
    0,
    1,
    75,
    16/9,
    1,
    64000
);

//shader
LS_set_nearest(0,0,0);
LS_set_lighting(1);

//objects
game_render_objects();

//Reset Shader
shader_reset();
Code:
///render_objects();

//Render all objects in scene.
with(objObject){
    if(global.class_model[class_id] > -1){
        //Model Matrix
        var rMatrix = matrix_build(
            x-global.player_objid[0].x,
            y-global.player_objid[0].y,
            z-global.player_objid[0].z + shadowFix, //shadow glitch fix
            xr + global.class_xr[class_id],
            yr + global.class_yr[class_id],
            zr + global.class_zr[class_id],
            xs * global.class_xs[class_id],
            ys * global.class_ys[class_id],
            zs * global.class_zs[class_id]
        );
        matrix_set(matrix_world,rMatrix);
        vertex_submit(global.model[global.class_model[class_id]],pr_trianglelist,background_get_texture(global.tex[global.class_tex[class_id]]));
    
        //Shadow Matrix
        var sMatrix = matrix_build(
            x-global.player_objid[0].x,
            y-global.player_objid[0].y,
            z-global.player_objid[0].z + shadowFix,  //shadow glitch fix
            xr + global.class_xr[class_id],
            yr + global.class_yr[class_id],
            zr + global.class_zr[class_id],
            global.class_xs[class_id] * 24 * xs * global.class_xs[class_id],
            global.class_ys[class_id] * 24 * ys * global.class_ys[class_id],
            global.class_zs[class_id] * 24 * zs * global.class_zs[class_id]
        );
        matrix_set(matrix_world,sMatrix);
        vertex_submit(global.vertexShadow,pr_trianglelist,background_get_texture(shadow_tex));
    }
}
d3d_transform_set_identity();

For my game, I'm using Xor's lighting shader and some of custom codes to load converted vertexes. (the box) I've tried any of fixes from the internet but no luck. How can I fix this? Please help me. :(

I'm using GM:S 1.4 (on Windows VM) and Ubuntu Linux.
 
Last edited by a moderator:
Top