Miika Posted November 18, 2017 Posted November 18, 2017 Hello! I have small script that replaces texture with image using shader and scrolls it from left to right. But i would like that there would be more images scrolling, example: coca cola ad, mcdonalds ad, etc... Would it be possible? I'm quite bad with shaders.. Shader: // // Example shader - uv_scroll.fx // /////////////////////////////////////////////////////////////////////////////// //Global variables /////////////////////////////////////////////////////////////////////////////// float gTime : TIME; /////////////////////////////////////////////////////////////////////////////// // Functions /////////////////////////////////////////////////////////////////////////////// //------------------------------------------- // Returns UV anim transform //------------------------------------------- float3x3 getTextureTransform () { float posU = -fmod( gTime/8 ,1 ); // Scroll Right float posV = 0; return float3x3( 1, 0, 0, 0, 1, 0, posU, posV, 1 ); } /////////////////////////////////////////////////////////////////////////////// // Techniques /////////////////////////////////////////////////////////////////////////////// texture Tex0; technique simple { pass P0 { Texture[0] = Tex0; // Set the UV thingy TextureTransform[0] = getTextureTransform (); // Enable UV thingy TextureTransformFlags[0] = Count2; } } Client-sided script: shader = dxCreateShader("shader.fx") coce = dxCreateTexture("bobo_3.png") dxSetShaderValue(shader, "Tex0", coce) engineApplyShaderToWorldTexture( shader, "buymorejeans") Real motorbike backflip / frontflip script: https://forum.mtasa.com/viewtopic.php?f=108&t=98191
Moderators IIYAMA Posted November 19, 2017 Moderators Posted November 19, 2017 (edited) Use a render target to merge multiple images. https://wiki.multitheftauto.com/wiki/DxCreateRenderTarget Edited November 19, 2017 by IIYAMA 1 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Ren_712 Posted December 3, 2017 Posted December 3, 2017 you can use material3D_flipbook or material3D_blinds classes https://community.multitheftauto.com/index.php?p=resources&s=details&id=13314 so you don't need to apply shader to world texture but line mateiral. I make shaders .. mainly. My community resources I'll do some custom stuff, I'm open for cooperation.
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