Make your own free website on
Shaders in Sunflow

Sunflow Shaders



Below is an example of what the janino shader block like

shader {
   name shadername
   type janino


What the janino shader does, is compile user scripted shaders. It takes the code withing the 'code' tags and compiles it into a shader. Of course, knoladge of Java would be needed for this.

So here I've collected some shaders that experianced users have coded.

Triangle Wireframe---Christopher Kulla (fpsunflower)

shader {
   name triangle_wire
   type janino
import org.sunflow.core.RenderState;
import org.sunflow.image.Color;
import org.sunflow.math.Vector3;

private Color lineColor = new Color(0.05f, 0.05f, 0.05f);
private Color fillColor = new Color(0.95f, 0.95f, 0.95f);
private float width = 0.02f;

public Color getRadiance(RenderState state) {
   float cos = 1 - (float) Math.pow(1 - Math.abs(, state.getRay().getDirection())), 5);
   float u = state.getU();
   float v = state.getV();
   float w = 1 - u - v;
   return ((u < width || v < width || w < width) ? lineColor : fillColor).copy().mul(cos);

public void scatterPhoton(RenderState state, Color power) {}


override triangle_wire true

Orange text - Sets the colour of the lines

Green text - Sets the overall colour.

Cyan text - Sets line width.

Purple text - This isn't really part of the shader, but it tells sunflow to use the shader "triangle_wire" on all objects. "trianlge_wire" can be adjusted to whatever the shader name happens to be. This line is optional.

< Back