Hi everyone,

Yesterday I first started using shaders, and made some of my own. These are very basic.

Thus I made this small shader, that applies a cosine on the input color “Color”.

These is the .frag I used:

```
void main(){
//@input vec4 inColor The colour to alter
//@output vec4 outColor The colour output, used the cosine.
outColour = cos(inColor);
}
```

very basic, as you can see. I’m honestly not even sure if the cosine even works.

This is the .vert I used:

```
uniform mat4 g_WorldViewProjectionMatrix;
attribute vec3 inPosition;
void main(){
gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0);
}
```

I didn’t use shadernodes for the vertex shader, I got the code from some website with openGL examples.

And this is the shader node for the .frag:

```
ShaderNodeDefinitions{
ShaderNodeDefinition WeirdColours {
Type: Fragment
Shader GLSL100: Shaders/Testing/Simple/WeirdColors100.frag
Documentation{
This shader will use cos to alter colour,
@input vec4 inColor The colour to alter
@output vec4 outColor The colour output, used the cosine.
}
Input {
vec4 inColor
}
Output {
vec4 outColor
}
}
}
```

I stitched it all together in the matDef:

```
MaterialDef SimpleCos {
MaterialParameters {
Color Color
}
Technique {
WorldParameters {
WorldViewProjectionMatrix
}
VertexShader GLSL100: Shaders/vertexSimple.vert
FragmentShaderNodes {
ShaderNode WeirdColors {
Definition : WeirdColors : Shaders/Testing/Simple/WeirdColors.j3sn
InputMappings {
inColor = MatParam.Color
}
OutputMappings {
Global.color = outColor
}
}
}
}
}
```

However, when I apply this material on a Geometry, it gives me an exception:

java.lang.IllegalArgumentException: The requested technique Default is not available on material SimpleCos

followed by a lot of stacktracing, all starting with com.jme3.

Thus, I have 3 questions:

- Why do I get an IAException?
- Does the function cos(vec4) work?
- Does the function cos(float) work?

If any code is missing, feel free to ask for it.

EDIT:

btw, I eventually want to use the formula `0.5*cos((x-1)*3.15)+0.5`

instead of `cos(x)`

.

You can compare the 2 formulas here and see why.