Hi there, I’ve been working with some examples from the GLSL sandbox, specifically this one glsl.heroku.com/e#17926.2 and with other examples which have simple data everything goes fine, but as soon as I face with:
Does anyone knows how to assign this kind of value in the GLSL TOP, it is clear that the uniform variables should be assigned in the vector tab but what happen with the varying values?
varying variables are variables that are passed from the vertex shader into the pixel shader. Usually the main one you’d see in the GLSL TOP is gl_TexCoord[0] in GLSL 1.20 or vUV in GLSL 3.30+.
varying vec3 eyeVector;
These varying vectors necessary as they modify the pixel shader for refraction and chromatic dispersion effects.
I see on the TD GLSL Material documentation that there are various functions and matrices available. For instance, the TDLighting() function has access to:
worldSpaceNorm is the normalized world space normal
vertToCamVec is the normalized vector from the vertex position to the camera position.
Those seem to be the varying vectors that I need for my pixel shader, but I can’t find any examples and my attempts so far result in errors.
I think there’s probably a way I could turn these into shaders and use the TDInputs[I] to access them like varying vec3’s… But haven’t figured out how.
The Phong MAT has the ability to create a Shader from its settings which possibly is then self-explanatory on the things you are looking for. Just place a Phong MAT and on the “RGB” parameter page, click the “Output Shader…” pulse parameter at the bottom. This will create a GLSL MAT including the vertex and pixel shader with vectors like worldSpaceNorm defined.