Skip to main content

Renderer

Renderer namespace with useful drawing functions ready for production.

tip

For optimal performance and better visual quality, please prefer using functions described on this page in your final production.

Functions

RGBA

Renderer.RGBA( r: number, g: number, b: number, a: number ) number

ArgumentTypeDescription
rnumberRed 0-255
gnumberGreen 0-255
bnumberBlue 0-255
anumberAlpha 0-255

Get proper color value


GetResolution

Renderer.GetResolution() Vector2

Get current game resolution


DrawCircleGlow

Renderer.DrawCircleGlow(
hash: number - integer,
position: Vector3,
radius: number,
colorData: ColorData,
options?: DrawCircleGlowOptions
) void

ArgumentTypeDescription
hashnumber - integerUnique fnv hash.
positionVector3Position.
radiusnumberRadius.
colorDataColorDataColorData struct.
options?DrawCircleGlowOptionsDrawing options. For default values see its page.

Draw fancy glow circle using shaders.

Example: Draw fancy animated sphere. This is overkill example of what can be achieved with these functions.
Callback.Bind(CallbackType.OnDraw, function()
for i = 1, 10, 1 do
local tbl = {
renderStage = Renderer.RenderStage.HUD, -- HUD instead of World, because we want to draw on top of grass, champions and structures.
isUsingDepth = false, -- This part of sphere is barely visible and blurred, we disable depth here to create effect of visibility when sphere rings go behind walls.
isUsingHeightMap = false, -- No need to project on the ground.
isCulling = false, -- False, because we need to render from both sides due to 3D rotation animation.
rotation = Math.Vector3((Game.GetTime() + i * 0.5 * 1) % (math.pi*2), (Game.GetTime() + i * 0.5 * 1) % (math.pi*2), (Game.GetTime() + i * 0.5 * 1) % (math.pi*2)), -- Animated 3D rotation
blurIn = 30,
blurOut = 30,
}
Renderer.DrawCircleGlow(Game.fnvhash("ExampleB_CircleGlowA" .. i), Game.localPlayer.position, 200 + math.sin(Game.GetTime()) * (50 + i*10) + (50 + i*10), Renderer.ColorData(Renderer.GradientType.Linear, 0x110000FF, 0x11FF0000, ((Game.GetTime()*2 + i) % (math.pi*2)) * 2), tbl)
end
for i = 1, 10, 1 do
local tbl = {
renderStage = Renderer.RenderStage.HUD,
isUsingDepth = true, -- This is the main part of sphere, it's crisp, but we want it to be hidden inside walls.
isUsingHeightMap = false,
isCulling = false,
rotation = Math.Vector3((Game.GetTime() + i * 0.5 * 1) % (math.pi*2), (Game.GetTime() + i * 0.5 * 1) % (math.pi*2), (Game.GetTime() + i * 0.5 * 1) % (math.pi*2)),
}
Renderer.DrawCircleGlow(Game.fnvhash("ExampleB_CircleGlowB" .. i), Game.localPlayer.position, 200 + math.sin(Game.GetTime()) * (50 + i*10) + (50 + i*10), Renderer.ColorData(Renderer.GradientType.Linear, 0x77FFFFFF, 0x77FF0000, ((Game.GetTime()*2 + i) % (math.pi*2)) * 2), tbl)
end
end)

DrawCircleMagical

Renderer.DrawCircleMagical(
hash: number - integer,
position: Vector3,
radius: number,
colorData: ColorData,
options?: BaseMeshDrawOptions
) void

ArgumentTypeDescription
hashnumber - integerUnique fnv hash.
positionVector3Position.
radiusnumberRadius.
colorDataColorDataColorData struct.
options?BaseMeshDrawOptionsDrawing options. For default values see its page.

Draw fancy magic circle using shaders.


DrawCirclePulse

Renderer.DrawCirclePulse(
hash: number - integer,
position: Vector3,
radius: number,
colorData: ColorData,
options?: DrawCirclePulseOptions
) void

ArgumentTypeDescription
hashnumber - integerUnique fnv hash.
positionVector3Position.
radiusnumberRadius.
colorDataColorDataColorData struct.
options?DrawCirclePulseOptionsDrawing options. For default values see its page.

Draw fancy pulse circle using shaders.


DrawCirclePulse2

Renderer.DrawCirclePulse2(
hash: number - integer,
position: Vector3,
radius: number,
colorData: ColorData,
options?: DrawCirclePulse2Options
) void

ArgumentTypeDescription
hashnumber - integerUnique fnv hash.
positionVector3Position.
radiusnumberRadius.
colorDataColorDataColorData struct.
options?DrawCirclePulse2OptionsDrawing options. For default values see its page.

Draw alternative fancy pulse circle using shaders.


DrawCircleShine

Renderer.DrawCircleShine(
hash: number - integer,
position: Vector3,
radius: number,
colorData: ColorData,
options?: DrawCircleShineOptions
) void

ArgumentTypeDescription
hashnumber - integerUnique fnv hash.
positionVector3Position.
radiusnumberRadius.
colorDataColorDataColorData struct.
options?DrawCircleShineOptionsDrawing options. For default values see its page.

Draw fancy pulse circle using shaders.


DrawCircleTarget

Renderer.DrawCircleTarget(
hash: number - integer,
position: Vector3,
radius: number,
colorData: ColorData,
options?: BaseMeshDrawOptions
) void

ArgumentTypeDescription
hashnumber - integerUnique fnv hash.
positionVector3Position.
radiusnumberRadius.
colorDataColorDataColorData struct.
options?BaseMeshDrawOptionsDrawing options. For default values see its page.

Draw fancy pulse circle using shaders.


DrawEffectCircle (Deprecated)

Renderer.DrawEffectCircle(
hash: number - integer,
position: Vector2,
radius: number,
colorInfo?: ColorInfo,
effectType?: EffectType
) void

ArgumentTypeDescription
hashnumber - integerUnique fnv hash.
positionVector2Position.
radiusnumberRadius.
colorInfo?ColorInfoColorInfo struct. White solid by default.
effectType?EffectTypeShader effect type. GlowingCircle by default.

Draw fancy shader circle.

caution

It is important to use unique fnvhash for this. Please use unique prefix when generating this hash.

danger

This function is deprecated and it's kept for backwards compatibility. Use other fancy drawing functions, such as DrawCircleX, DrawTextEx, DrawTexture, etc.

Example: Draw fancy shader circle around selected target.
local MyGlowingCircleHash = Game.fnvhash("Example_MyGlowingCircle") -- This must be unique hash per drawing. Use unique prefix.
local color = Renderer.ColorInfo.new(0xFFFFFFFF, 0xFF5555FF, Renderer.GradientType.Linear)
local radius = 100
Callback.Bind(CallbackType.OnDraw, function()
local tar = Game.GetSelectedTarget()
if tar and tar:IsValid() then
Renderer.DrawEffectCircle(MyGlowingCircleHash, tar.position2D, radius, color, Renderer.EffectType.MagicalCircle)
end
end)

DrawTextEx

Renderer.DrawTextEx(
hash: number - integer,
text: string,
position: Vector2,
colorData: ColorData,
options?: DrawTextOptions
) void

ArgumentTypeDescription
hashnumber - integerUnique fnv hash.
textstringText to be displayed.
positionVector2Position.
colorDataColorDataColorData struct.
options?DrawTextOptionsDrawing options. For default values see its page.

Draw text using our Renderer in 2D space (UI, HUD).


DrawTextEx

Renderer.DrawTextEx(
hash: number - integer,
text: string,
position: Vector3,
colorData: ColorData,
options?: DrawTextOptions
) void

ArgumentTypeDescription
hashnumber - integerUnique fnv hash.
textstringText to be displayed.
positionVector3Position.
colorDataColorDataColorData struct.
options?DrawTextOptionsDrawing options. For default values see its page.

Draw text using our Renderer in 3D space (Game World).


DrawTexture

Renderer.DrawTexture(
hash: number - integer,
textureHandle: number,
position: Vector2,
size: Vector2,
colorData: ColorData,
options?: DrawTextureOptions
) void

ArgumentTypeDescription
hashnumber - integerUnique fnv hash.
textureHandlenumberTexture handle.
positionVector2Position.
sizeVector2Size.
colorDataColorDataColorData struct.
options?DrawTextureOptionsDrawing options. For default values see its page.

Draw a texture (sprite) in 2D space (UI, HUD).

Example: Draw same sprite several times in specific order in 2D space.
local texHandle = Renderer.AddTexture("example.png") -- Make sure you have example.png in your script folder
Callback.Bind(CallbackType.OnDraw, function()
Renderer.DrawTexture(Game.fnvhash("DrawTexture2D_1"), texHandle, Math.Vector2(300, 300), Math.Vector2(200, 200),Renderer.ColorData(Renderer.GradientType.Linear, 0xFF00FFFF, 0xFFFF0000, (Game.GetTime()*2 % (math.pi*2)) * 2), {
sortOrder = 0
})
Renderer.DrawTexture(Game.fnvhash("DrawTexture2D_2"), texHandle, Math.Vector2(310, 310), Math.Vector2(200, 200), Renderer.ColorData(Renderer.GradientType.Linear, 0xFF0000FF, 0xFFFF0000, (Game.GetTime()*2 % (math.pi*2)) * 2), {
sortOrder = 1
})
Renderer.DrawTexture(Game.fnvhash("DrawTexture2D_3"), texHandle, Math.Vector2(320, 320), Math.Vector2(200, 200), Renderer.ColorData(Renderer.GradientType.Linear, 0xFFFF00FF, 0xFFFF0000, (Game.GetTime()*2 % (math.pi*2)) * 2), {
sortOrder = 2
})
end)

DrawTexture

Renderer.DrawTexture(
hash: number - integer,
textureHandle: number,
position: Vector3,
size: Vector2,
colorData: ColorData,
options?: DrawTextureOptions
) void

ArgumentTypeDescription
hashnumber - integerUnique fnv hash.
textureHandlenumberTexture handle.
positionVector3Position.
sizeVector2Size.
colorDataColorDataColorData struct.
options?DrawTextureOptionsDrawing options. For default values see its page.

Draw a texture (sprite) in 3D space (Game World).

Example: Draw sprite under our hero with animated gradient tint.
local texHandle = Renderer.AddTexture("example.png") -- Make sure you have example.png in your script folder
Callback.Bind(CallbackType.OnDraw, function()
Renderer.DrawTexture(
Game.fnvhash("DrawTexture3D"),
texHandle,
Math.Vector3(Game.localPlayer.position.X, Game.localPlayer.position.Y + 100, Game.localPlayer.position.Z),
Math.Vector2(400, 400),
Renderer.ColorData(Renderer.GradientType.Linear, 0xFF0000FF, 0xFFFF0000, (Game.GetTime()*2 % (math.pi*2)) * 2)
)
end)

AddTexture

Renderer.AddTexture( filePath: string - path ) number - handle

ArgumentTypeDescription
filePathstring - pathRelative path from your module.lua to the texture. Make sure to use double slash \\ instead of /.

Adds texture to DrawManager and returns unique texture handle.

danger

Make sure to use double slash \\ instead of /.
Although / will work during your development, it will not work in production script when you upload it to our server.