GLSL Iridescent mat beginner question / compiling error

Hi,

i’m trying to write/copy my first GLSL shader and followed this tutorial to create an iridescent glsl mat:
(it’s in japanese, i don’t speak japanese)

alltd. org/magical-color-with-glsl-part1-touchdesigner-tutorial/

and wrote this code:
pastebin. com/fT9bfaqE

I’m getting these 2 compiling errors on line 114:

0(114) : error C7011: implicit cast from “float” to “vec3”
0(114) : error C1103: too few parameters in function call

Not exactly sure what i’m doing wrong, the tutorial is a bit older but if u could point me into the right direction i’d be forever grateful.

I’ve uploaded the .toe here:
www.file. io/Ll6g/download/H30fnWBDEzf5

Any help appreciated, thanks in advance <3

I’ve managed to fix the first error by setting “uFresStrg” to vec3 instead of float but the second error still persists; the line in question goes as follows:

outcol.rgb += IridLighting(pos, normal, camPos, viewVec, lightPos, lightCol, uFresStrg, uIridStrg);

The whole paragraph is:

vec3 pos = iVert.worldSpacePos.xyz;
vec3 camPos = uTDMats[iVert.cameraIndex].camInverse[3].xyz;
for(int i = 0; i < TD_NUM_LIGHTS; i++)
{
	vec3 lightPos = uTDLights[i].position.xyz;
	vec3 lightDir = uTDLights[i].direction;
	vec3 lightCol = uTDLights[i].diffuse;
	outcol.rgb += IridLighting(pos, normal, camPos, viewVec, lightPos, lightCol, uFresStrg, uIridStrg);
}

Hi there,

It seems you forgot to add the lightDir parameter to your IridLighting() function call. It should be positioned between lightPos and lightCol as described in the function specification:

vec3 IridLighting(vec3 pos, vec3 norm, vec3 camPos, vec3 viewVec, vec3 lightPos, vec3 lightDir, vec3 lightCol, float fresStrg, float iridStrg)

Hope this helps.

cheers,
tim

2 Likes

Man, you’re a hawk!

That fixed it, thanks @timgerritsen

1 Like