I am trying to put together a PBR shader through GLSL for the Realtime OpenGL Viewport.
I am starting from scratch more or less since i havent seen one of these in SI yet but there are plenty of references and papers out there.
Anyway I have hit a road block. Basically the sample GLSL shaders are all using ftransform() to translate the vertices and show our meshes onscreen.
For me to be able to build a PBR shader without any restrictions I see that i can define #version 330 or even #version 450 core which is great it seems that both are supported but ftransform() is deprecated since i think version 140 which means that the user has the power to build the Model View Projection Matrix in c++ or i guess a script and then pass it as a uniform to the vertex shader at which point you would multiply the matrix by the position.xyz attribute which is provided by the Model/Mesh
Here is my code atm
#version 450
Vertex
Code: Select all
attribute vec3 position;
uniform mat4 mvpMatrix;
void main(void)
{
gl_Position = mvpMatrix * vec4(position, 1.0);
}
Code: Select all
out vec4 colorOut;
void main(void)
{
colorOut = vec4(1.0);
//gl_FragColor = vec4(1.0);
}
Now my question is. How do I for each object that has this material applied to it get the model, view & project matrices and multiply them either in a script/c++ or directly in the shader
Typically i am used to doing it prior in code and sending the resulting Matrix over.
Is this even possible in Softimage? Would I need to write some kind of plugin that would pass those values as a special render tree node?
Why am I even bothering? Well i use SI daily for work and It would be nice to preview my realtime shaders and how everything works before sending it onto the rendering engine. I know i could try this in a CG shader which may already send the values to the shader from some of the code I have looked at but for porting between SI and my target app GLSL would be the best option ^^
tl;dr: I need to get the multiplied result of the Model View Projection Matrices into a GLSL shader
Thanks for any help