JeViCo Posted September 15, 2018 Share Posted September 15, 2018 (edited) Hello everyone. I met 1 problem ~5 minutes ago. When player spawns, shader creates and applies on ped's texture (custom skin texture) dxCreateShader ( "shad.fx", 0, 0, false, "ped" ) Then i add image on as dxSetShaderValue material <--- everything OK here and i can see this texture. If i teleport somewhere using default freeroam resource/hit the marker (it changes my dimension), this texture disappeares. i use gTexture(source material) + my texture + alpha blending. Edited September 15, 2018 by JeViCo Link to comment
JeViCo Posted September 16, 2018 Author Share Posted September 16, 2018 oops i described it wrong. Image doesn't disappear. If i spawn, i can apply image on shader and everything OK. BUT If i spawn and then i step on marker (change my dimension) or teleport somewhere using default freeroam resource, image doesn't apply then for some reason. So i'm trying to find out the source of problem Link to comment
MIKI785 Posted September 16, 2018 Share Posted September 16, 2018 How do you apply the shader? Link to comment
JeViCo Posted September 16, 2018 Author Share Posted September 16, 2018 (edited) 3 hours ago, MIKI785 said: How do you apply the shader? texNames = {"jbib_diff_007_k_uni"} -- custom skin texture name streamedPlayers = {} addEvent("setClientStuff",true) addEventHandler("setClientStuff",getRootElement(),function() local p = source --if not getElementData(p,"player:loaded.clothing") then table.insert(streamedPlayers,p) fx[p] = dxCreateShader ( "shad.fx", 0, 0, false, "ped" ) for _, t in pairs(texNames) do engineApplyShaderToWorldTexture(fx[p],t,p) end rt[p] = dxCreateRenderTarget(512,512,true) dxSetShaderValue(fx[p],"tex",rt[p]) -- variable defined in shader so everything OK --end end) Edited September 16, 2018 by JeViCo Link to comment
ميدوح Posted September 16, 2018 Share Posted September 16, 2018 28 minutes ago, JeViCo said: texNames = {"jbib_diff_007_k_uni"} -- custom skin texture name streamedPlayers = {} addEvent("setClientStuff",true) addEventHandler("setClientStuff",getRootElement(),function() local p = source --if not getElementData(p,"player:loaded.clothing") then table.insert(streamedPlayers,p) fx[p] = dxCreateShader ( "shad.fx", 0, 0, false, "ped" ) for _, t in pairs(texNames) do engineApplyShaderToWorldTexture(fx[p],t,p) end rt[p] = dxCreateRenderTarget(512,512,true) dxSetShaderValue(fx[p],"tex",rt[p]) -- variable defined in shader so everything OK --end end) + engineGetModelTextureNames( t ) Link to comment
JeViCo Posted September 16, 2018 Author Share Posted September 16, 2018 4 minutes ago, medo7 said: + engineGetModelTextureNames( t ) i've already gotten "jbib_diff_007_k_uni" from this function 1 Link to comment
JeViCo Posted September 16, 2018 Author Share Posted September 16, 2018 GUYS i found the problem but i have no idea how to fix it. I create render targets using this rt[p] = dxCreateRenderTarget(512,512,true) -- p - player variable If i hit any marker or teleport somewhere, this rendertarget disappears/removes etc. I used this code addCommandHandler("fff",function() print(tostring(rt[localPlayer])) print("test") end) and got this result: Any suggestions? Link to comment
Hoffmann Posted September 18, 2018 Share Posted September 18, 2018 On 16/09/2018 at 22:40, JeViCo said: GUYS i found the problem but i have no idea how to fix it. I create render targets using this rt[p] = dxCreateRenderTarget(512,512,true) -- p - player variable If i hit any marker or teleport somewhere, this rendertarget disappears/removes etc. I used this code addCommandHandler("fff",function() print(tostring(rt[localPlayer])) print("test") end) and got this result: Any suggestions? Is render target destroyed every time onClientMarkerHit event is triggered? Did you test it with new markers? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now