• 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 [SOLVED] (GMS 1.4) 3D Translucent textures

marasovec

Member
When I look from one side (upper pic)
When I look from the other side (bottom pic)

Is there a way to fix it?
 

marasovec

Member
Well then I guess I'll have to turn off d3d_set_hidden. It looks like the upper pic but at least it looks equally from both sides
 

Binsk

Member
It's not aGM issue. It's a common issue for any 3d rendering because of how the depth buffer works.

GameMaker uses forward rendering which means you will only be able to see the stuff BEHIND a translucent object if it is drawn first.

This is why it works one way and not the other. Disabling hidden just disables writing to the depth buffer, which will allow seeing the objects from both sides but one will be incorrectly drawn in front of the other.

Translucent objects are a complicated subject and unless you are willing to write some complicated rendering pipeline stuff I would use translucency as little as possible.
 

marasovec

Member
So, I made a script that solved my problem. I need to use more objects but it works. It basically disables sides that touch other walls
Code:
global.layer = 0;
for(var l = -6; l < 100; l++)
    {
    global.layer = l*8;
 
    instance_activate_object(obj_water);
    with(obj_water)
        {
        if z != global.layer instance_deactivate_object(id);
        }
 
    with(obj_water)
        {
        side1active = true;
        side2active = true;
        side3active = true;
        side4active = true;
     
        for(var i = 0; i < image_yscale; i++)
            {
            if collision_point(x-4, y+4+(i*8), obj_water, false, true)
                side4active = false;
            if collision_point(x+4+(image_xscale*8), y+4+(i*8), obj_water, false, true)
                side2active = false;
            }
        for(var i = 0; i < image_xscale; i++)
            {
            if collision_point(x+4+(i*8), y-4, obj_water, false, true)
                side1active = false;
            if collision_point(x+4+(i*8), y+4+(image_yscale*8), obj_water, false, true)
                side3active = false;
            }
        }
    }
instance_activate_object(obj_water);
 
Top