self:apply_to_model

Client

Applies the shader's material to a model instance


Syntax

local status = self:apply_to_model(
    model
)

Parameters

TypeNameDescription
modelmodelModel instance to apply the shader material to — refer to core.model.create

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Apply a dissolve shader to a model
local entity = core.shader.create("assets/shaders/dissolve.glsl", core.shader.shader_mode.SPATIAL)
local model = core.model.create("assets/props/crate.glb")

entity:set_param("dissolve_amount", 0.0)
entity:apply_to_model(model)
Apply a toon-shading shader to a character model
local entity = core.shader.create("assets/shaders/toon.glsl", core.shader.shader_mode.SPATIAL)
local model = core.model.create("assets/characters/hero.glb")

entity:apply_to_model(model)

On this page