- Documentation
- Client functions
- engineApplyShaderToWorldTexture
Function
engineApplyShaderToWorldTexture
Replaces a San Andreas world texture with the given name with the shader's image. The name may contain * and ? (e.g. "vehiclegrunge*"). Without an element the replacement applies to all objects with that texture, including those loaded later; with an element (vehicle, object, ped) - only to it. The names of textures currently visible in the game are returned by engineGetVisibleTextureNames.
Syntax
bool engineApplyShaderToWorldTexture(element theShader, string textureName [, element targetElement = nil, bool appendLayers = true])Arguments
theShaderelement- A shader with its texture set.
textureNamestring- Texture name or pattern.
targetElementelement, optional = nil- A vehicle, object or ped.
appendLayersbool, optional = true- For compatibility with existing scripts.
Returns
true on success.
Example
local shader = dxCreateShader("texture gTexture; technique t { pass P0 { Texture[0] = gTexture; } }")
dxSetShaderValue(shader, "gTexture", dxCreateTexture("wrap.png"))
local car = getPedOccupiedVehicle(localPlayer)
if car then engineApplyShaderToWorldTexture(shader, "vehiclegrunge256", car) end
See also
engineRemoveShaderFromWorldTextureRemoves a texture replacement made withengineApplyShaderToWorldTexture- you must pass the same name pattern and the same element. The original game texture comes back.engineGetVisibleTextureNamesReturns the names of San Andreas textures currently loaded in the game (around the player), with an optional*and?filter. Helps find a texture name to replace: stand next to an object and print the list. The second argument (model) is ignored.dxCreateShaderCreates a shader from a resource .fx file or from code given as a string. In Trilogy Hub a shader performs texture replacement: the image set withdxSetShaderValueunder a texture parameter replaces the world textures chosen withengineApplyShaderToWorldTexture(e.g. custom billboards, signs on buildings, car wraps). The game material stays (lighting, reflections); only the image changes. Pixel and vertex effects from HLSL code are not executed.