FlyingSpoon Posted July 13, 2017 Share Posted July 13, 2017 tinted.fx technique car_tint_window { pass P0 { DepthBias = 0.0000; AlphaBlendEnable = FALSE; SrcBlend = SRCALPHA; DestBlend = INVSRCALPHA; } } // fallback method technique fallback { pass P0 { // do normal drawing } } tinted.lua local theShader = dxCreateShader("tinted.fx", 1, 200, true) function tintedWindows() for k,vehicles in ipairs(getElementsByType("vehicle")) do if getElementData(vehicles, "tinted") == true then engineApplyShaderToWorldTexture(theShader, "vehiclegeneric256", vehicles) engineApplyShaderToWorldTexture(theShader, "hotdog92glass128", vehicles) engineApplyShaderToWorldTexture(theShader, "okoshko", vehicles) else engineRemoveShaderFromWorldTexture(theShader, "vehiclegeneric256", vehicles) engineRemoveShaderFromWorldTexture(theShader, "hotdog92glass128", vehicles) engineRemoveShaderFromWorldTexture(theShader, "okoshko", vehicles) end end end Right now the tint colour is black, how can I change it into another colour? Link to comment
Simple0x47 Posted July 14, 2017 Share Posted July 14, 2017 The shader hasn't got any color definition, so that's the reason why it's black. You could use another method by using DxCreateTexture. Link to comment
FlyingSpoon Posted July 14, 2017 Author Share Posted July 14, 2017 How would I do that? Link to comment
TRtam Posted July 18, 2017 Share Posted July 18, 2017 I don't know anything of .fx but viewing this https://wiki.multitheftauto.com/wiki/Shader_examples#Texture_name i can create the .fx of what you need. Here is the .fx and the .lua: float4 Color; technique car_window_tint { pass P0 { MaterialAmbient = Color; MaterialDiffuse = Color; MaterialEmissive = Color; MaterialSpecular = Color; } } local theShader = dxCreateShader("tinted.fx", 1,200, true) dxSetShaderValue(theShader, "Color", 255/255,0/255,0/255,50/255) -- Here is the Red,Green,Blue and Alpha. All need to be from 0 to 1 that is why i divide for 255 function tintedWindows() for k,vehicles in ipairs(getElementsByType("vehicle")) do if getElementData(vehicles, "tinted") == true then engineApplyShaderToWorldTexture(theShader, "vehiclegeneric256", vehicles) engineApplyShaderToWorldTexture(theShader, "hotdog92glass128", vehicles) engineApplyShaderToWorldTexture(theShader, "okoshko", vehicles) else engineRemoveShaderFromWorldTexture(theShader, "vehiclegeneric256", vehicles) engineRemoveShaderFromWorldTexture(theShader, "hotdog92glass128", vehicles) engineRemoveShaderFromWorldTexture(theShader, "okoshko", vehicles) end end end Sorry for the basic english. :v Link to comment
Simple0x47 Posted July 18, 2017 Share Posted July 18, 2017 16 minutes ago, saygoodbye said: I don't know anything of .fx but viewing this https://wiki.multitheftauto.com/wiki/Shader_examples#Texture_name i can create the .fx of what you need. Here is the .fx and the .lua: float4 Color; technique car_window_tint { pass P0 { MaterialAmbient = Color; MaterialDiffuse = Color; MaterialEmissive = Color; MaterialSpecular = Color; } } local theShader = dxCreateShader("tinted.fx", 1,200, true) dxSetShaderValue(theShader, "Color", 255/255,0/255,0/255,50/255) -- Here is the Red,Green,Blue and Alpha. All need to be from 0 to 1 that is why i divide for 255 function tintedWindows() for k,vehicles in ipairs(getElementsByType("vehicle")) do if getElementData(vehicles, "tinted") == true then engineApplyShaderToWorldTexture(theShader, "vehiclegeneric256", vehicles) engineApplyShaderToWorldTexture(theShader, "hotdog92glass128", vehicles) engineApplyShaderToWorldTexture(theShader, "okoshko", vehicles) else engineRemoveShaderFromWorldTexture(theShader, "vehiclegeneric256", vehicles) engineRemoveShaderFromWorldTexture(theShader, "hotdog92glass128", vehicles) engineRemoveShaderFromWorldTexture(theShader, "okoshko", vehicles) end end end Sorry for the basic english. :v Another person that uses :v, >:v Link to comment
DORTEY Posted Friday at 11:58 Share Posted Friday at 11:58 (edited) EDIT: already solved. Edited 22 hours ago by DORTEY 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