DanHR Posted November 18, 2018 Share Posted November 18, 2018 Is it possible to print text on textures so we can have, for example, numbers on shirts? Link to comment
Dimos7 Posted November 18, 2018 Share Posted November 18, 2018 i guess with photoshop or something like this maybe Link to comment
DanHR Posted November 18, 2018 Author Share Posted November 18, 2018 (edited) 1 hour ago, Dimos7 said: i guess with photoshop or something like this maybe Then it wont work as expected, let's say I want to print the username on the back of a shirt, I cant do that with photoshop because i have to create all the possible variables Edited November 18, 2018 by Threule Link to comment
Dimos7 Posted November 18, 2018 Share Posted November 18, 2018 Then i Guess you can use and take splane position dxDrawText getPedBonePosition Link to comment
Moderators IIYAMA Posted November 18, 2018 Moderators Share Posted November 18, 2018 5 hours ago, Threule said: Is it possible to print text on textures so we can have, for example, numbers on shirts? Text on a texture? https://wiki.multitheftauto.com/wiki/DxCreateRenderTarget Link to comment
DanHR Posted November 18, 2018 Author Share Posted November 18, 2018 3 minutes ago, IIYAMA said: Text on a texture? https://wiki.multitheftauto.com/wiki/DxCreateRenderTarget Do you have any image examples on this? Doesn't matter if its just writting poop on a house or something Link to comment
Moderators IIYAMA Posted November 18, 2018 Moderators Share Posted November 18, 2018 (edited) nope, not an example. But there are of course examples on wiki: https://wiki.multitheftauto.com/wiki/EngineApplyShaderToWorldTexture https://wiki.multitheftauto.com/wiki/DxCreateRenderTarget If you merge those wiki codes, you probably get some results. If you want to have some specific information about these functions, feel free to ask. But make sure to check wiki first X 10. ( one uncertainty ) If render target textures can't be used for shaders directly, then you can also copy them to another texture. https://wiki.multitheftauto.com/wiki/DxGetTexturePixels https://wiki.multitheftauto.com/wiki/DxCreateTexture All required wiki examples: addEventHandler("onClientResourceStart", resourceRoot, function() myRenderTarget = dxCreateRenderTarget( 80, 100 ) -- Create a render target texture which is 80 x 100 pixels end ) addEventHandler( "onClientRender", root, function() if myRenderTarget then dxSetRenderTarget( myRenderTarget ) -- Start drawing on myRenderTarget dxDrawText ( "Hello", 10, 20 ) -- Draw a message dxSetRenderTarget() -- Stop drawing on myRenderTarget dxDrawImage( 50, 50, 100, 100, myRenderTarget ) -- Now use myRenderTarget as a material and draw it lots of times dxDrawImage( 150, 350, 150, 100, myRenderTarget ) dxDrawImage( 250, 250, 100, 150, myRenderTarget ) dxDrawImage( 350, 30, 150, 150, myRenderTarget ) end end ) local myRenderTarget = dxCreateRenderTarget(500, 500, true) -- -- Function to draw text to our render target with '''modulate_add''' blend mode when the 'r' key is pressed -- function updateRenderTarget() dxSetRenderTarget(myRenderTarget, true) dxSetBlendMode("modulate_add") -- Set 'modulate_add' when drawing stuff on the render target dxDrawText("Testing "..getTickCount(), 0, 0, 0, 0, tocolor(255, 255, 255, 255), 2, "clear") dxSetBlendMode("blend") -- Restore default blending dxSetRenderTarget() -- Restore default render target end bindKey("r", "down", updateRenderTarget ) theTechnique = dxCreateShader("shader.fx") explosionTexture = dxCreateTexture( "tex/Explosion.png") function replaceEffect() engineApplyShaderToWorldTexture(theTechnique, "fireball6") dxSetShaderValue (theTechnique, "gTexture", explosionTexture) end addEventHandler("onClientResourceStart",resourceRoot,replaceEffect) Shader texture gTexture; technique TexReplace { pass P0 { Texture[0] = gTexture; } } Edited November 18, 2018 by IIYAMA 1 Link to comment
Geteco Posted November 18, 2018 Share Posted November 18, 2018 1 hour ago, IIYAMA said: Previous Page Next Page nope, not an example. But there are of course examples on wiki: https://wiki.multitheftauto.com/wiki/EngineApplyShaderToWorldTexture https://wiki.multitheftauto.com/wiki/DxCreateRenderTarget If you merge those wiki codes, you probably get some results. If you want to have some specific information about these functions, feel free to ask. But make sure to check wiki first X 10. ( one uncertainty ) If render target textures can't be used for shaders directly, then you can also copy them to another texture. https://wiki.multitheftauto.com/wiki/DxGetTexturePixels https://wiki.multitheftauto.com/wiki/DxCreateTexture All required wiki examples: addEventHandler("onClientResourceStart", resourceRoot, function() myRenderTarget = dxCreateRenderTarget( 80, 100 ) -- Create a render target texture which is 80 x 100 pixels end ) addEventHandler( "onClientRender", root, function() if myRenderTarget then dxSetRenderTarget( myRenderTarget ) -- Start drawing on myRenderTarget dxDrawText ( "Hello", 10, 20 ) -- Draw a message dxSetRenderTarget() -- Stop drawing on myRenderTarget dxDrawImage( 50, 50, 100, 100, myRenderTarget ) -- Now use myRenderTarget as a material and draw it lots of times dxDrawImage( 150, 350, 150, 100, myRenderTarget ) dxDrawImage( 250, 250, 100, 150, myRenderTarget ) dxDrawImage( 350, 30, 150, 150, myRenderTarget ) end end ) local myRenderTarget = dxCreateRenderTarget(500, 500, true) -- -- Function to draw text to our render target with '''modulate_add''' blend mode when the 'r' key is pressed -- function updateRenderTarget() dxSetRenderTarget(myRenderTarget, true) dxSetBlendMode("modulate_add") -- Set 'modulate_add' when drawing stuff on the render target dxDrawText("Testing "..getTickCount(), 0, 0, 0, 0, tocolor(255, 255, 255, 255), 2, "clear") dxSetBlendMode("blend") -- Restore default blending dxSetRenderTarget() -- Restore default render target end bindKey("r", "down", updateRenderTarget ) theTechnique = dxCreateShader("shader.fx") explosionTexture = dxCreateTexture( "tex/Explosion.png") function replaceEffect() engineApplyShaderToWorldTexture(theTechnique, "fireball6") dxSetShaderValue (theTechnique, "gTexture", explosionTexture) end addEventHandler("onClientResourceStart",resourceRoot,replaceEffect) Shader texture gTexture; technique TexReplace { pass P0 { Texture[0] = gTexture; } } Previous Page Next Page Today no one wanna try to code by yourself. They just ask for the code and done. Whatever. 1 Link to comment
Moderators IIYAMA Posted November 19, 2018 Moderators Share Posted November 19, 2018 7 hours ago, Geteco said: Today no one wanna try to code by yourself. They just ask for the code and done. Whatever. Why would I code something that is already there? People these days.... 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