TheBull Posted August 29, 2015 Share Posted August 29, 2015 Helloo,I made a texture load script by looking to (engineApplyShaderToWorldTexture) in the wiki,but somehow it doesn't load the texture i want to load,it just becomes a clean white hydra,not customized or not even the original one,could you guys help me? Here is the client.lua : myShader = dxCreateShader( "replace.fx" ) engineApplyShaderToWorldTexture( myShader, "hydrabody256" ) ----------------------------------------------------------------- myShader = dxCreateShader( "replace.fx" ) engineApplyShaderToWorldTexture( myShader, "hydradecal" ) Link to comment
UserToDelete Posted August 29, 2015 Share Posted August 29, 2015 i think you need to load TXD and DFF too, if not, can be bug in shader Link to comment
Castillo Posted August 29, 2015 Share Posted August 29, 2015 Where is the texture...? Link to comment
TheBull Posted August 29, 2015 Author Share Posted August 29, 2015 do you mean this? texture gTexture; technique hello { pass P0 { Texture[0] = gTexture; } } Link to comment
pa3ck Posted August 29, 2015 Share Posted August 29, 2015 engineApplyShaderToWorldTexture ( element shader, string textureName [, element targetElement = nil, bool appendLayers = true ] ) You forgot about the texture file. Link to comment
Castillo Posted August 29, 2015 Share Posted August 29, 2015 do you mean this? texture gTexture; technique hello { pass P0 { Texture[0] = gTexture; } } This is the shader, where's the texture you are providing to the shader to use? Link to comment
TheBull Posted August 31, 2015 Author Share Posted August 31, 2015 hydrabody256 : http://postimg.org/image/95lduq92b/ hydradecal : http://postimg.org/image/fjcb3yewl/ Link to comment
JR10 Posted August 31, 2015 Share Posted August 31, 2015 dxSetShaderValue dxSetShaderValue(shader, 'texture0', TEXTURE) Link to comment
TheBull Posted August 31, 2015 Author Share Posted August 31, 2015 dxSetShaderValue dxSetShaderValue(shader, 'texture0', TEXTURE) Not working , the error : bad argument @ 'dxSetShaderValue' [Expected material at argument 1,got nil. Link to comment
JR10 Posted August 31, 2015 Share Posted August 31, 2015 You need to replace each argument. This is just the basic syntax. Link to comment
TheBull Posted August 31, 2015 Author Share Posted August 31, 2015 i made it like this : dxSetShaderValue(replace.fx, 'texture0', hydrabody256.png) and got this error : attempt to index global 'replace' (a nil value) Link to comment
JR10 Posted August 31, 2015 Share Posted August 31, 2015 I suggest you start reading more Lua tutorials. The first argument is the shader you created, in this case it's 'myShader'. The third one is a texture, can be an image or a texture element created with dxCreateTexture. You need to specify a texture to replace the existing (GTA's default) one. dxSetShaderValue(myShader, 'gTexture', TEXTURE If you didn't understand that then we probably can't help you. Link to comment
TheBull Posted August 31, 2015 Author Share Posted August 31, 2015 I know what do you mean,but i dont even get any errors addEventHandler ( "onClientResourceStart", resourceRoot, function ( ) local texture = dxCreateTexture ( "images/hydrabody256.jpg", "dxt5" ) local shader = dxCreateShader ( "texture.fx" ) dxSetShaderValue ( shader, "gTexture", texture ) engineApplyShaderToWorldTexture ( shader, "hydrabody256" ) end ) 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