.:HyPeX:. Posted February 10, 2016 Share Posted February 10, 2016 Well, for some reason my shaders wont have the colors assigned.. script: dY = -5.3499999046326 dX = -4.4745998382568 Colors = { {255,75,75}, {75,255,75}, {75,75,255}, {255,255,255}, {0,0,0}, {255,255,75}, {255,75,255} } Shaders = {} for i=1,#Colors do Shaders[i] = dxCreateShader("colorShader.fx") local r,g,b = unpack(Colors[i]) --local r,g,b = tostring(r),tostring(g),tostring(b) dxSetShaderValue(Shaders[i],"r",r,g,b,1) dxSetShaderValue(Shaders[i],"g",r,g,b,1) dxSetShaderValue(Shaders[i],"b",r,g,b,1) dxSetShaderValue(Shaders[i],"a",r,g,b,1) end function test() local x,y,z = getElementPosition(localPlayer) local x,y,z = x,y+5,z-1 for i=1, #Colors do local obj = createObject(1697,x + dX*(i-1),y,z,32,0,0) engineApplyShaderToWorldTexture ( Shaders[i], "solar_panel_1", obj ) end end addEventHandler('onClientResourceStart',resourceRoot,function() test() end) Shader: // // tex_names.fx // float Time : TIME; float4 r; float4 g; float4 b; float4 a; //----------------------------------------------------------------------------- // Techniques //----------------------------------------------------------------------------- technique tec0 { pass P0 { MaterialAmbient = r; MaterialDiffuse = g; MaterialEmissive = b; MaterialSpecular = a; AmbientMaterialSource = Material; DiffuseMaterialSource = Material; EmissiveMaterialSource = Material; SpecularMaterialSource = Material; ColorOp[0] = SELECTARG1; ColorArg1[0] = Diffuse; AlphaOp[0] = SELECTARG1; AlphaArg1[0] = Diffuse; Lighting = true; } } Result: (Even there's a cyan shader, but there is no cyan color made? wtf? http://imgur.com/sR3JyEx.png Link to comment
Sasu Posted February 11, 2016 Share Posted February 11, 2016 dxSetShaderValue(Shaders[i],"r",r) dxSetShaderValue(Shaders[i],"g",g) dxSetShaderValue(Shaders[i],"b",b) dxSetShaderValue(Shaders[i],"a",1) Link to comment
.:HyPeX:. Posted February 11, 2016 Author Share Posted February 11, 2016 dxSetShaderValue(Shaders[i],"r",r) dxSetShaderValue(Shaders[i],"g",g) dxSetShaderValue(Shaders[i],"b",b) dxSetShaderValue(Shaders[i],"a",1) Shader is float4, check Link to comment
Scripting Moderators Sarrum Posted February 11, 2016 Scripting Moderators Share Posted February 11, 2016 r,g,b = r/255,g/255,b/255 dxSetShaderValue(Shaders[i],"r",{r,g,b,1}) dxSetShaderValue(Shaders[i],"g",{0,0,0,1}) dxSetShaderValue(Shaders[i],"b",{0,0,0,1}) dxSetShaderValue(Shaders[i],"a",{0,0,0,1}) Link to comment
.:HyPeX:. Posted February 11, 2016 Author Share Posted February 11, 2016 r,g,b = r/255,g/255,b/255 dxSetShaderValue(Shaders[i],"r",{r,g,b,1}) dxSetShaderValue(Shaders[i],"g",{0,0,0,1}) dxSetShaderValue(Shaders[i],"b",{0,0,0,1}) dxSetShaderValue(Shaders[i],"a",{0,0,0,1}) Values are correctly set, so far discovered its some sort of shader issue, 255,0,0 RGB will be red, 255,75,75 will turn blank 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