Jump to content

Z-fighting when replacing a texture


J.S.

Recommended Posts

I'm using a modified version of Jesseunit's realistic night shader which I've adapted to apply the night effect to textures which are also replaced within the same shader. In the resource, the original night shader is applied to the majority of textures as normal. When it's necessary to replace a texture, the original night shader is then removed from the element and the modified shader is applied, thereby replacing the texture while retaining the night effect.

However, I'm getting a significant amount of z-fighting with the replaced textures

Here is an example: I've replaced this sign (one of the signs used in the airport) using the shader

This is how it's supposed to look - http://puu.sh/72TvB.jpg

However, when I move the camera angle, parts of the back piece of the sign (which is submerged inside the wall) begin to show up - http://puu.sh/72Tv9.jpg

Eventually, the entire back piece shows up - http://puu.sh/72Tud.jpg

Here is the source of the shader I'm using to replace the texture - http://pastebin.com/E9vTv6Nd

Any suggestions?

Link to comment

You're also getting a significant amount of FPS loss with this second pass (avoid that as much as You can). I'd suggest sticking with the old night_shader. group the textures you need to remove in a table. Here is an example of the tables i use in my night_fade script

local removeList = { 
"",                         -- unnamed 
"basketball2","skybox_tex", "flashlight_*",-- other 
"muzzle_texture*",-- guns 
"font*","radar*","sitem16","snipercrosshair",-- hud 
"siterocket","cameracrosshair",-- hud 
"fireba*","wjet6",-- flame 
"vehiclegeneric256","vehicleshatter128",-- vehicles 
"*shad*",-- shadows 
"coronastar","coronamoon","coronaringa", 
"coronaheadlightline",-- coronas 
"lunar",-- moon 
"tx*",-- grass effect 
"cj_w_grad",-- checkpoint texture 
 "*cloud*",-- clouds 
"*smoke*",-- smoke 
"sphere_cj",-- nitro heat haze mask 
"particle*",-- particle skid and maybe others 
"water*","newaterfal1_256", 
"boatwake*","splash_up","carsplash_*", -- splash 
"gensplash","wjet4","bubbles","blood*", -- splash 
"fist","*icon","headlight*", 
"unnamed",   
"sl_dtwinlights*","nitwin01_la","sfnite*","shad_exp", 
"vgsn_nl_strip","blueshade*", 
                    } 
  
local reApplyList = { 
"ws_tunnelwall2smoked", "shadover_law", 
"greenshade_64", "greenshade2_64", "venshade*",  
"blueshade2_64", 
} 

1.Apply to all "*"

2.remove the shader from texture in removeList

3.Reapply the shader to texture in reApplyList

https://wiki.multitheftauto.com/wiki/En ... rldTexture

https://wiki.multitheftauto.com/wiki/En ... rldTexture

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...