Cesium material/appearance system

I’m currently trying to create a custom shader for a custom primitive.
The primitive constructor needs an Appearance, so I started implemented my own, based on one of the existing Appearances.

So I looked for example at DebugApperance, and here’s the construction of the vertex shader code:
var vs =
‘attribute vec3 position3DHigh;\n’ +
‘attribute vec3 position3DLow;\n’ +
'attribute ’ + glslDatatype + ’ ’ + attributeName + ‘;\n’ +
'varying ’ + glslDatatype + ’ ’ + varyingName + ‘;\n’ +
‘void main()\n’ +
‘{\n’ +
‘vec4 p = czm_translateRelativeToEye(position3DHigh, position3DLow);\n’ +
varyingName + ’ = ’ + attributeName + ‘;\n’ +
‘gl_Position = czm_modelViewProjectionRelativeToEye * p;\n’ +
‘}’;

For starters, there’s things missing here, this is not a complete vertex shader. No uniforms defined, and it is using undefined functions.
Ok, of course somewhere, Cesium is concatenating the undefined stuff. I’m still trying to find where, if someone call orient me, it would be nice.
I found the file Renderer/createShaderSource.js, but this seems to just concat #defines and sources, and I dont see any extra source being added in the DebugAppearance besides that code snippet I posted.
I searched a bit I found out about AutomaticUniform class, this is probably the main responsible for generating that missing stuff, however I still do not know how this all works together.

So my question is, how to make an Appearance use a pure vertex/fragment shader without it including any of the Cesium builtin stuff?
Or the Appearance class is only expected to work with shader code managed by Cesium and as such, I need go to deeper and use something lower level?
If that’s necessary, it worries me because Primitives cannot render themselves, they only provide geometry and materials to Cesium (unless materials can bypass default matrices and attributes).

PS:I’m rendering something that is not related to the globe at all, so I want to provide my own modelview/project matrices and use floats instead of doubles for the position attribute.

If you want to do very low-level rendering, it is possible to use the renderer directly. For an example, EllipsoidPrimitive.js. Starting in b29, this part of the Cesium API is private so it may change in future versions.

As for the shader pipeline, see Primitive.js and ShaderProgram.js.

Patrick

I see, I had a quick skim through many of the primitives, but had not found anything resembling low level rendering.
Now I looked better at EllipsoidPrimitive, the commandList.push() seems to be what I want, as it seems to allow pushing arbitrary shaders and vertex arrays, thanks. In case I have more questions I’ll post here.