# Substance Painter Shader Guide part 2. – Adding to custom structure.

By implementing Alexa LogC converters (El 1000) inside the Substance Painter Shader, we will learn how to build a structure and directly declare the data type using the structure.

Usually, you can think of LogC as Alexa LogC.

In fact, this post is not intended to very deeper into LogC.
For a deeper understanding based on the above, take a look at the pdf file above.
Let’s see if we can add a shader that converts linear spatial information to LogC space in Substance Painter again.

There are five LogC parameters.
You need 7 parameter values, Cut and a to f.
Let’s define this as a structure.

```//-------- LogC Color Conversion --------------------------------------//
//: param custom { "default": false, "label": "LogC" }
uniform bool b_logC;

struct ParamsLogC
{
float cut;
float a, b, c, d, e, f;
};
```

We defined a variable of type Bool as b_logC, and added a: param custom and bound it in a pair.
You can now turn it on and off in the shader inspector.
Let’s create a user-defined data type defined with a specific constant.

```const ParamsLogC LogC =
{
0.011361, // cut
5.555556, // a
0.047996, // b
0.244161, // c
0.386036, // d
5.301883, // e
0.092819  // f
};
```

ParamsLogC structure was used as data type.
The log10 () function is used for the final transformation calculation, but there is no log10 () math function in the Substance Painter shader library.
Let’s make it yourself.

```float log10(float x)
{
float o;
o = (1 / log(10)) * log(x);
return o;
}

```

Create a LinearToLogC_Precise () function.
This part referred to ConvertToLog.shader of Unity3D URP.

```float LinearToLogC_Precise(float x)
{
float o;
if (x > LogC.cut)
o = LogC.c * log10(LogC.a * x + LogC.b) + LogC.d;
else
o = LogC.e * x + LogC.f;
return o;
}

```

Let’s apply it to diffColor.

```if(b_logC)
{
diffColor.xyz = vec3(LinearToLogC_Precise(diffColor.x), LinearToLogC_Precise(diffColor.y) ,  LinearToLogC_Precise(diffColor.z));
}

```