When programming a vertex shader, OpenGL creates for us some useful variables** … do you know if we have a kind of list of those created for us in Armory ?
(for example somewhere to read those variables that exist for us in Armory as input/output of a vertex shader ?)
Another example with “uniform mat4 WVP” which is to be compared with “gl_ModelViewProjectionMatrix” in OpenGl … another list too somewhere ?
** exemple with gl_Vertex Position du sommet; gl_Color Couleur du sommet; gl_Normal Normale du sommet; gl_MultiTexCoord Coordonnées de l’unité de texture; gl_SecondaryColor Couleur secondaire du sommet; gl_FogCoord …
@BlackGoku36 if I take the example of WVP , then effectively I find in this file
if (c.link == “_worldViewProjectionMatrix”) {
helpMat.setFrom(object.transform.worldUnpack);
helpMat.multmat(camera.V);
helpMat.multmat(camera.P);
m = helpMat; …
and then if we want to find a list of things like WVP … where can we make for this example then the link between WVP and worldViewProjectionMatrix ?
… maybe best answer could be in the make_attrib.py ** or in the make_decal.py where uniform are set like with “vert.add_uniform(‘mat4 WVP’, ‘_worldViewProjectionMatrix’)”
** ArmorySDK\armory\blender\arm\material\make_attrib.py and ArmorySDK\armory\blender\arm\material\make_decal.py
yes it’s a very interesting thing to have the possibilty to add new “uniform” to a shader, it seems that things like “WVP” are already available in Armory by default, and I was trying to set an exhaustiv list of what is already available by default, like what you can find when using OpenGL.
For your info, OpenGL implements an approximation of the derivatives I would like to use for the IA/Deep Learning/Neural Network, thus using the strength of the GPU to parallelize backpropagation in the Neural Network. (to improve this IA, Python and Armory 3d/Blender ). It’s available as fragment processing functions, only available in fragment shaders.
It will be more a training algorithm being within a statistical logic, for exemple to calculate the error and propagate it back to the earlier layers, not trying to get exact calculations, in order to maximize neural network learning rapidity … rather imagine now a neural network based on optical principles (incident wave and reflection) and you will see quite well what I trying to do with Armory and the shaders… I am exiting to see the first results
Another kind of things to list (or get link to in the source code), if we want to realize something with Texture2D, like retrieves texels from a texture, in OpenGL we use
How/where to find the equivalent thing with Armory … and maybe then set a preliminary list of useful things that’s help users on shaders … and sure that the best thing would be to have it as a glslArmory.json snippets file to use for Kode Studio
(similar to the one of Lewis Lepton usable for glsl in Kode Studio https://gist.github.com/lewislepton/8b17f56baa7f1790a70284e7520f9623)
PS: in reality the texture2D is now deprecated and replaced by textureLod … for those interested look at https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.1.40.pdf at the page 89
and you can read too that for the Fragment Shader Special Variables, the built-in special variables that are accessible from a fragment shader are intrinsically declared as follows:
in vec4 gl_FragCoord;
in bool gl_FrontFacing;
in float gl_ClipDistance[];
out vec4 gl_FragColor; // deprecated
out vec4 gl_FragData[gl_MaxDrawBuffers]; // deprecated
out float gl_FragDepth;
Thus according to the doc, both gl_FragColor and gl_FragData are deprecated; the preferred usage is to explicitly declare these outputs in the fragment shader using the out storage qualifier, thus doing the same in Armory … thus it could be cool to have this list of available or “have to do yourself in/out variable” list of variables for shaders and maintained thanks to @lubos when a new version of Armory is available.
This conversation helped me really a lot!! But the thing is that I’m pretty stuck at figuring out how the sampler2D works. My Question is “where is the texture location, where do I have to set the texture”. Im trying to set a reflection texture to an object through the fragment shader. I hope you can help me