JonathanGranskg Posted January 6, 2014 Share Posted January 6, 2014 Hey, I'm getting a syntax error. "...:16:24: Error 1088: Syntax error, unexpected identifier, expecting ´}´." The error is on the line where I create the matrix and it gives me this error when I try to grab a component of a vector and put it in the matrix. What I want is in the comment. If I replace "Vt.x" with 1 it compiles perfectly. Here's the code: #pragma hint map image#pragma label map "Normal Map"#pragma label amp "Amplitude"surface normalMapTest(float amp = 0.1; string map = "";){ vector Nn = normalize(N); vector tex, newN; // normal map if (map != ""){ tex = texture(map)*2 - {1,1,1}; vector Vs = normalize((dPds * Dv(t)) - (dPdt * Du(t))); vector Vt = normalize(cross(Nn, Vs)); Vs = normalize(cross(Vt, Nn)); matrix m = { {Vt.x,0,0}, {0,1,0}, {0,0,1} }; //{{Vt.x, Vt.y, Vt.z}, {Vs.x, Vs.y, Vs.z}, {Nn.x, Nn.y, Nn.z}}; newN = normalize(tex * m); } else { newN = Nn; } F = diffuse(newN);} Oh and if you see any other errors, please tell me. I wanted to do this as an exercise in VEX Shader Writing. Cheers, Jonathan Quote Link to comment Share on other sites More sharing options...
symek Posted January 6, 2014 Share Posted January 6, 2014 use set(): matrix3 m = set(Vt.x, Vt.y, Vt.z, Vs.x, Vs.y, Vs.z, Nn.x, Nn.y, Nn.z); Quote Link to comment Share on other sites More sharing options...
JonathanGranskg Posted January 6, 2014 Author Share Posted January 6, 2014 use set(): matrix3 m = set(Vt.x, Vt.y, Vt.z, Vs.x, Vs.y, Vs.z, Nn.x, Nn.y, Nn.z); Yep, it worked. Thanks for the quick answer! Quote Link to comment Share on other sites More sharing options...
danylyon Posted January 14, 2014 Share Posted January 14, 2014 I'm not 100% sure what you're doing with the matrix (Haven't used a matrix for normal maps yet). But be sure to change the Normal in object space. N is in camera space. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.