engineApplyShaderToWorldTexture
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function applies a shader to one or more world textures.
The resource shader_tex_names can help in finding the names of world textures. When replacing the texture for a ped using the CJ skin, set textureName to "CJ" The shader inherits the render states of the original when it is drawn, so texture stage 0 will already be set to the original texture. When using with a 'ped', ensure you have set 'ped' or 'all' in the elementTypes when calling dxCreateShader CJ body parts textures can be replaced by using: "cj_ped_head", "cj_ped_hat", "cj_ped_torso", "cj_ped_legs", "cj_ped_feet", "cj_ped_glasses", "cj_ped_necklace", "cj_ped_watch" and "cj_ped_extra1". Latest version of shader_tex_names will show what is being used.
OOP Syntax Help! I don't understand this!
- Method: shader:applyToWorldTexture(...)
Syntax
bool engineApplyShaderToWorldTexture ( element shader, string textureName, [ element targetElement = nil, bool appendLayers = true ] )Required Arguments
- shader: The shader which is to be applied
- textureName: The name of the world texture to apply the shader to. Wildcard matching e.g. "ro?ds*" can be used to apply to more than one texture at a time.
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.
- targetElement (default: nil): The element to restrict applying the shader to. If this is not set the shader will be applied to everything using the texture name. Valid element types for targetElement are vehicles , objects and peds .
- appendLayers (default: true): allows two or more layered shaders to be applied in the same texture. You may want to modify the DepthBias in the technique pass to avoid Z-fighting artifacts when using this.
Returns
- bool: value
Returns true if the shader was successfully applied, false otherwise.
Code Examples
This example will replace the texture of a group of common explosions (grenades, rockets, etc) with a custom explosion effect
theTechnique = dxCreateShader("shader.fx")explosionTexture = dxCreateTexture( "tex/Explosion.png")
function replaceEffect() engineApplyShaderToWorldTexture(theTechnique, "fireball6") dxSetShaderValue (theTechnique, "gTexture", explosionTexture)endaddEventHandler("onClientResourceStart", resourceRoot, replaceEffect)See Also
Engine Functions
- engineAddClothingModel
- engineAddClothingTXD
- engineAddImage
- engineApplyShaderToWorldTexture
- engineFreeModel
- engineFreeTXD
- engineGetModelFlags
- engineGetModelIDFromName
- engineGetModelLODDistance
- engineGetModelNameFromID
- engineGetModelPhysicalPropertiesGroup
- engineGetModelTextureNames
- engineGetModelTextures
- engineGetModelTXDID
- engineGetModelVisibleTime
- engineGetObjectGroupPhysicalProperty
- engineGetPoolCapacity
- engineGetPoolDefaultCapacity
- engineGetPoolUsedCapacity
- engineGetSurfaceProperties
- engineGetVisibleTextureNames
- engineImageGetFile
- engineImageGetFiles
- engineImageGetFilesCount
- engineImageLinkDFF
- engineImageLinkTXD
- engineImportTXD
- engineLoadCOL
- engineLoadDFF
- engineLoadIFP
- engineLoadIMG
- engineLoadTXD
- enginePreloadWorldArea
- engineRemoveImage
- engineRemoveShaderFromWorldTexture
- engineReplaceAnimation
- engineReplaceCOL
- engineReplaceModel
- engineRequestModel
- engineRequestTXD
- engineResetModelFlags
- engineResetModelLODDistance
- engineResetModelTXDID
- engineResetSurfaceProperties
- engineRestoreAnimation
- engineRestoreCOL
- engineRestoreDFFImage
- engineRestoreModel
- engineRestoreModelPhysicalPropertiesGroup
- engineRestoreObjectGroupPhysicalProperties
- engineRestoreTXDImage
- engineRestreamWorld
- engineSetAsynchronousLoading
- engineSetModelFlag
- engineSetModelFlags
- engineSetModelLODDistance
- engineSetModelPhysicalPropertiesGroup
- engineSetModelTXDID
- engineSetModelVisibleTime
- engineSetObjectGroupPhysicalProperty
- engineSetPoolCapacity
- engineSetSurfaceProperties
- engineStreamingFreeUpMemory
- engineStreamingGetBufferSize
- engineStreamingGetMemorySize
- engineStreamingGetModelLoadState
- engineStreamingGetUsedMemory
- engineStreamingReleaseModel
- engineStreamingRequestModel
- engineStreamingRestoreBufferSize
- engineStreamingRestoreMemorySize
- engineStreamingSetBufferSize
- engineStreamingSetMemorySize
- engineStreamingSetModelCacheLimits