Jump to content

UV Shader that scrolls multiple images?


Miika

Recommended Posts

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")

 

Link to comment
  • 2 weeks later...

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