Skip to main content
100%

Shading in Blender

✓ Published0🌍 Public
UUtopiah
Last edited Aug 10, 2017
Created on Aug 10, 2017

The example shows how to apply a custom green shader to the active object in Blender, replacing its material appearance with a flat color. It first switches the 3D viewport to material shading mode and sets the game settings to use GLSL for real-time rendering. The code then assigns a minimal GLSL fragment shader that outputs a fixed RGBA color to every material on the mesh. This demonstrates direct shader manipulation through Blender’s Python API, specifically using `bpy.context` to access the active object and viewport spaces, and `mat.getShader().setSource()` to inject the shader source.

AI-generated description

Similar vizzes