Closed Arsakes closed 8 years ago
Hi,
these aren't documented anywhere right now, but you can look at the source code to see what's defined:
Of course if you're writing your own RenderPass you can define any uniforms that you want, but these are the ones that get supplied to the shader during the built in scene render pass.
Great thanks, modelViewMatrixN
is transpose of an inverse of modelView - right?
Also have a question which is maybe slighlty out of scope, how can I check which version of shading language (opengl es) I'm using?
Yeah they're the vertex normal versions of the matrices, so inverted transpose.
About the version, it should always be the same since WebGL 1.0 is the only supported API right now. It's basically OpenGL ES 2.0 and GLSL ES 1.0. But you can check this by creating a webgl context and reading out the version constants:
var canvas = document.createElement("canvas");
var gl = canvas.getContext("webgl");
gl.VERSION
gl.SHADING_LANGUAGE_VERSION
edit: sorry I misunderstood the first question, you're right they're the inverted transpose
FYI, just remembered there are a few more uniforms set in the forward render pass which is what kicks off the scene render passes. So these should be available in your shader too:
systemUniforms["viewMatrix"] = c_worldToViewMatrix;
systemUniforms["viewInverseMatrix"] = c_viewToWorldMatrix;
systemUniforms["projectionMatrix"] = c_projectionMatrix;
systemUniforms["cameraPosition"] = scene.getActiveView().getWorldSpacePosition();
systemUniforms["coords"] = [target.width, target.height, 1];
Great! Thanks those are precisely uniforms I've needed. For future: Can I set my own arbitrary global uniforms and pass them to shader each frame? (By global I mean accessible from every shader - not the ones set per material like: ambientIntensity etc.)
Where can I find the list of uniforms defined for xml3d shaders? Surely some of them are predefined.
To be precise: I'm looking for inversion of modelView matrix. It would be great if I could bypass computing it in shader.