ShaderCollection#
plupy.data.shaders: look up shader handles, create built-in shaders or author Lit/Unlit Slang shaders. Materials reference these handles through material.props["material.shader"]. Shader graphs are edited in Nodes.
class ShaderCollection(DataCollection)Inherits DataCollection: its members are documented there.
Usage and examples
new#
new(name: str, *, surface_model: str='lit') -> ShaderCreates an independent shader from a built-in surface model in one undoable edit. Use lit, unlit, strands, transmission, liquid, streaks or volume; unknown models raise PlupyError. This creates a shader definition, not a material or scene object.
new_slang#
new_slang(name: str, *, source: str, parameters: list[dict], surface_model: str='unlit', render_mode: str='opaque', wind: bool=False) -> ShaderCreates a Lit, Unlit, Liquid or Volume Slang shader with exposed parameters and a render mode in one undoable edit. render_mode is opaque (default), cutout or transparent. Lit uses LitSurface Surface(SurfacePoint p) initialized with DefaultLitSurface(p). Unlit opaque retains float3 SurfaceColor(SurfacePoint p); Unlit cutout/transparent uses UnlitSurface Surface(SurfacePoint p) and DefaultUnlitSurface(p). Coverage outputs are alpha and alphaClip (cutout only). See the material manual; parameters is a list of declarations described on Shader.set_code. Invalid declarations raise PlupyError without creating data. Slang compilation happens when the shader is loaded for preview/export; compiler errors appear in editor diagnostics. wind=True (Lit only) sways vertices with a bounded stem shear — the stem ID is floor(uv.y), sway grows from none windHeight below the mesh origin to full windHeight above it — and requires Number parameters named windStrength (sway amplitude, mesh units) and windHeight; windStrength 0 holds still.
Related types#
DataCollection · PlupyError · Shader · Use · edit
Source#
- _live.py:251