Jump to content

Sensitive dxCreateShader (peds)


JeViCo

Recommended Posts

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 by JeViCo
Link to comment

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
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 by JeViCo
Link to comment
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

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:

Okdq8wxcTbmYVJmx2BCxnw.png

Any suggestions?

Link to comment
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:

Okdq8wxcTbmYVJmx2BCxnw.png

Any suggestions?

Is render target destroyed every time onClientMarkerHit event is triggered? Did you test it with new markers?

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...