xyz
ok
i tried this

POSITION = PROJECTION_MATRIX * MODELVIEW_MATRIX * vec4(VERTEX.xy, 1.0,1.0);

doesnt work.

i know i shouldnt have upgraded

  • xyz replied to this.

    the weapons are visible in front of the sky tho

    but not before other geometry

    DJMaesen Also

    POSITION.z = mix(POSITION.z, 1.0, 0.997);

    visible now but no fov and depth issues

    • xyz replied to this.

      DJMaesen What happens if you do:

      POSITION.z = mix(POSITION.z, 1.0, 1.0-0.997);

        DJMaesen The problem is likely with those projection matrix interventions as well but I'm not smart enough to solve it off the top of my head. A quick thing to try: use reciprocal value for [1][1] or for both [1][1] and [0][0].

          xyz
          doesnt work

          this does work but i dont know if its a good solution

          shader_type spatial;
          render_mode blend_mix,depth_draw_always,cull_back,diffuse_burley,specular_schlick_ggx;
          
          
          uniform sampler2D texture_albedo : source_color,filter_linear_mipmap,repeat_enable;
          uniform sampler2D t: hint_screen_texture;
          uniform float roughness = 1.0;
          uniform sampler2D texture_metallic : hint_default_white,filter_linear_mipmap,repeat_enable;
          uniform sampler2D texture_roughness : hint_roughness_gray,filter_linear_mipmap,repeat_enable;
          
          uniform float metallic = 0.5;
          uniform sampler2D texture_normal : hint_roughness_normal,filter_linear_mipmap,repeat_enable;
          
          
          
          uniform float FOV = 40.0;
          
          void vertex() {
          	texture(t, UV);
          
          
          	float onetanfov = 1.0 / tan(0.5 * (FOV * PI / 180.0));
          	float aspect = VIEWPORT_SIZE.x / VIEWPORT_SIZE.y;
          	PROJECTION_MATRIX[1][1]= -onetanfov;
          	PROJECTION_MATRIX[0][0] = onetanfov / aspect;
          	
          }
          
          void fragment(){
          	DEPTH = FRAGCOORD.z * 5.0;
          	vec2 base_uv = UV;
          	vec4 albedo_tex = texture(texture_albedo,base_uv);
          	ALBEDO = albedo_tex.rgb;
          	vec4 metallic_texture_channel =vec4(0.333333,0.333333,0.333333,0.0);
          	float metallic_tex = dot(texture(texture_metallic,base_uv),metallic_texture_channel);
          	METALLIC = metallic_tex * metallic;
          	vec4 roughness_texture_channel = vec4(0.333333,0.333333,0.333333,0.0);
          	float roughness_tex = dot(texture(texture_roughness,base_uv),roughness_texture_channel);
          	ROUGHNESS = roughness_tex * roughness;
          	SPECULAR = 0.5;
          	NORMAL_MAP = texture(texture_normal,base_uv).rgb;
          
          }
          a month later

          DJMaesen I don't know if this is too late, I also got a problem with this, the weapon was invisible.
          after some trial and error I managed to fix it.
          the problem is with this line:
          POSITION.z = mix(POSITION.z, 0, 0.997);

          I fixed it by adjusting the values:
          POSITION.z = mix(POSITION.z, 0.07, 0.99);
          pure 0.0 is too low and clips the camera.

            2 months later