---
title: Make a custom render mode
product: SpeedTree Modeler
version: '10'
latest_version: '10'
status: This page documents version 10. The latest version is 10.
canonical: https://docs.unity.com/en-us/speedtree-modeler/10/make-a-custom-render-mode
latest_url: https://docs.unity.com/en-us/speedtree-modeler/10/make-a-custom-render-mode.md
last_updated: 2026-11-19
generated_at: 2026-11-19T15:05:46.968Z
locale: en-us
---

# Make a custom render mode

> Work with a script to edit render modes or create your own.

Get started with the file structure and a custom example.

Refer to [Render modes](./render-modes.md) for information about the built-in render modes.

## Structure

Each render mode is basically a piece of the shader used when rendering. These are all stored in \<app install>/render\_modes/\*.fx. On MacOS, you will need to show the package contents to find them. This directory can have a hierarchy of folders, and you can control the order using underscores '\_'.

At the top of the file, you have the option of defining one or more of the following options, depending on what you need to do in the render mode. By default, the background is controlled by the tree window settings and tonemapping and conversion to sRGB color space is done. You may override any of these.

```hlsl
#define OVERRIDE_BACKGROUND float3(1.0, 1.0, 1.0)
#define DISABLE_TONEMAPPING
#define DISABLE_SRGB
```

Each file contains a single function definition that takes a SRenderModeInput as input, which describes everything about the material and lighting environment, plus includes some extra information about the geometry.

```hlsl
struct SRenderModeInput
{
    // material values
    float3        m_vColor;
    float        m_fOpacity;
    float3        m_vNormal;
    float        m_fGloss;
    float3        m_vSpecularColor;
    float        m_fMetallic;
    float3        m_vSubsurfaceColor;
    float        m_fSubsurfaceAmount;
    float        m_fAmbientOcclusion;
    float        m_fHeight;
    float3         m_vCustom;
    float3         m_vCustom2;
    
    bool        m_bTwoSided;
    
    // lighting info
    float3        m_vLightDirection;
    float3        m_vLightColor;
    float        m_fShadow;
    
    // camera info
    float3        m_vCameraPosition;
    float3        m_vCameraDirection;
    float4x4            m_mInverseWorldView;
    
    // vertex info (interpolated)
    float3        m_vVertexPosition;
    float3        m_vVertexNormal;
    float3        m_vVertexBinormal;
    float3        m_vVertexTangent;
    float2        m_vVertexUV;
    float4        m_vVertexColor;
    float4        m_vWind;
    float        m_fWindRipple;
    
    // extra
    float        m_fScreenDepth;
    bool        m_bFrontFace;
};

```

The function also must completely fill out a SRenderModeOutput to return.

```hlsl
struct SRenderModeOutput
{
    float3        m_vColor;
    float        m_fOpacity;
};
```

## Custom example

As an example of what you can do with a render mode, this one will render the front of a leaf with the Custom map channel and the back with the Custom2 map channel set up in the material, while also maintaining the opacity.

This shader function should be saved into a file with the .fx extension somewhere in the render\_mode directory and then chosen in the tree window.

```hlsl
SRenderModeOutput RenderMode(SRenderModeInput sInput)
{
    SRenderModeOutput sOutput;
    
    if (sInput.m_bFrontFace)
    {
        sOutput.m_vColor = sInput.m_vCustom;
    }
    else
    {
        sOutput.m_vColor = sInput.m_vCustom2;
    }
    
    sOutput.m_fOpacity = sInput.m_fOpacity;
    return sOutput;
}
```

And this will be the result:

![A custom render mode output tree.](/api/media?file=speedtree-modeler/10/media/images/custom_rendermode.png)
