.:HyPeX:. Posted August 18, 2013 Posted August 18, 2013 Hey guys I've done so far an implementantion of the UV_Scripted shader from the wiki on a map with an image, but, i want to know if it is possible to make it for ALL the objects under that category (billboard) to have that effect. Else i could just add various object under the line of creating... Eg: -- Create object with model 4729 (billboard) createObject ( 4729, 1850, -4370, 10, 0, 0, 22 ) createObject ( 4729, 1850, -4380, 10, 0, 0, 22 ) createObject ( 4729, 1850, -4390, 10, 0, 0, 22 ) My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
Castillo Posted August 18, 2013 Posted August 18, 2013 Well, you can just replace the texture, since specifing a element is optional. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
.:HyPeX:. Posted August 18, 2013 Author Posted August 18, 2013 Well, you can just replace the texture, since specifing a element is optional. Yes, but i'm not sure how to do it with the DxDraw the UV scripted shader has. My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
Castillo Posted August 18, 2013 Posted August 18, 2013 Post your shader script ( not the .FX file, the lua file ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
.:HyPeX:. Posted August 18, 2013 Author Posted August 18, 2013 -- -- c_uv_scripted.lua -- local myShader local startTickCount addEventHandler( "onClientResourceStart", resourceRoot, function() -- Version check if getVersion ().sortable < "1.1.0" then outputChatBox( "Resource is not compatible with this client." ) return end -- Create shader myShader, tec = dxCreateShader ( "uv_scripted.fx" ) -- Create texture and add to shader local myTexture = dxCreateTexture ( "images/env3.bmp" ); dxSetShaderValue ( myShader, "CUSTOMTEX0", myTexture ); if not myShader then outputChatBox( "Could not create shader. Please use debugscript 3" ) else outputChatBox( "Using technique " .. tec ) -- Apply to world texture engineApplyShaderToWorldTexture ( myShader, "bobo_2" ) -- Create object with model 4729 (billboard) createObject ( 4729, 1843, -4385, 477, 0, 0, 22 ) -- Begin updates for UV animation startTickCount = getTickCount() addEventHandler( "onClientRender", root, updateUVs ) end end ) ------------------------------------------------------ -- Update ------------------------------------------------------ function updateUVs() -- Valide shader to save bazillions of warnings if not isElement( myShader ) then return end -- Calc how many seconds have passed since uv anim started local secondsElapsed = ( getTickCount() - startTickCount ) / 1000 -- Calc section (0-6) and time (0-1) within the section local timeLooped = ( secondsElapsed / 2 ) % 6 local section = math.floor ( timeLooped ) local time = timeLooped % 1 -- Figure out what uv anims to do local bScrollLeft = section == 0 or section == 3 or section == 4 or section == 6 local bWobbleRotate = section == 1 or section == 3 or section == 5 or section == 6 local bGoneAllZoomy = section == 2 or section == 4 or section == 5 or section == 6 local u,v = 0, 0 local angle = 0 local scale = 1 -- Do uv anims if bScrollLeft then u = time end if bWobbleRotate then angle = math.sin(time/2*6.28)/4 end if bGoneAllZoomy then scale = math.cos(time*6.28) * 0.5 + 0.5 end -- Apply uv anims dxSetShaderValue ( myShader, "gUVPosition", u,v ); dxSetShaderValue ( myShader, "gUVRotAngle", angle ); dxSetShaderValue ( myShader, "gUVScale", scale, scale ); end My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
.:HyPeX:. Posted August 25, 2013 Author Posted August 25, 2013 Bump, any idea? My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
HunT Posted August 26, 2013 Posted August 26, 2013 Make the object before engineApplyShaderToWorldTexture objectShader = createObject engineApplyShaderToWorldTexture ( myShader, "bobo_2",objectShader ) @Huntone_
.:HyPeX:. Posted August 27, 2013 Author Posted August 27, 2013 Make the object before engineApplyShaderToWorldTexture objectShader = createObject engineApplyShaderToWorldTexture ( myShader, "bobo_2",objectShader ) Thanks! My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
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