My next project: CGF - Compilable Graph Format
by Lukas Joergensen · 01/10/2014 (4:39 am) · 9 comments
May I present.. CGF!
So I've created a prototype for my next project, the Compilable Graph Format. Pretty generalized name, but hey it covers it!
First of all I want to thank the creator of Graph, LogicalError, my own UI sort of sucked, so I'm glad I found this great free library.
So what is CGF? CGF is a visual coding/scripting system, used to draw your code in a visual graph format and then compile it to a file.
My first project will be compiling .hlsl files, which I'm already moving steadily forward with.
This is an example file compiled by the program:
uniform sampler2D Var0 : register({REGISTER_NUM});
struct ConnData
{
float4 Var1 : POSITION;
float2 Var2 : TEXCOORD0;
float2 Var3 : TEXCOORD1;
float2 Var4 : TEXCOORD2;
float2 Var5 : TEXCOORD3;
float3 Var6 : TEXCOORD4;
};
float4 main(ConnData IN) : COLOR0
{
const float3 Var7 = {0,0,1};
const float3 Var8 = {0,1,0};
float4 Var10 = lerp(Var7,Var8,{VALUE}});
float4 Var12 = lerp(Var0,Var10,{VALUE}});
}As you can see some fields still need to be parsed properly, but we're getting there!But can this only be used for .hlsl files?
No, I intend to refactor all the .hlsl specific code out of the program, and all nodes are added through dynamically loaded modules, so you can extend the program with all the nodes you want.Lastly I'm going to generalize the UI enough for it to be usable with most languages.
So the steps needed to add a new output language is these:
- Write a compiler, that implements the Compiler interface.
- Write some libraries with module classes that implement the IModule interface. (Each module represents one type of nodes).
- Copy the new dll's to the "modules" and the "compilers" folders.
So obligatory video of my latest prototype:
Current feature list:
- Save/load system
- Dynamic run-time loading of modules (i.e. nodes)
- WIP .hlsl output
About the author
IPS Bundle available at: https://www.winterleafentertainment.com/Products/IPS.aspx
#3
01/10/2014 (9:35 am)
That's really awesome. That's definatly the future for game engines. Looking forward to read more about it!
#4
Hopefully you can look at other engines that have some similar features with there visual scripting/ graph editors like cry engine or unreal. I'm happy and will be following your progress.
01/10/2014 (12:44 pm)
Lukas great idea..I'm glad to see someone actually doing this for T3D.Hopefully you can look at other engines that have some similar features with there visual scripting/ graph editors like cry engine or unreal. I'm happy and will be following your progress.
#5
Unfortunately I'm hitting that "How do shaders actually work in T3D?" road block lol!
Expect a bunch of shader-related forum threads from me in the future!
Edit: I just successfully exported a PostFX that colors the whole screen a single color.. Thats progress I think!
01/10/2014 (1:48 pm)
It's great there is some interest in this!Unfortunately I'm hitting that "How do shaders actually work in T3D?" road block lol!
Expect a bunch of shader-related forum threads from me in the future!
Edit: I just successfully exported a PostFX that colors the whole screen a single color.. Thats progress I think!
struct ConnData
{
float4 Var0 : POSITION;
float2 Var1 : TEXCOORD0;
float2 Var2 : TEXCOORD1;
float2 Var3 : TEXCOORD2;
float2 Var4 : TEXCOORD3;
float3 Var5 : TEXCOORD4;
};
float4 main(ConnData IN) : COLOR0
{
const float3 Var6 = {0,0,0};
const float3 Var7 = {0,0,0};
float4 Var9 = lerp(float4(Var7, 1),float4(Var6, 1),0.5);
return Var9;
}
#6
How far are you planning to go with this? I essentially had the same idea, but using Blender's pynodes interface as basis. I'm not planning to venture into Torque territory any time soon though. My first goal is to set it up as parallel array processing platform, and expand from there.
01/11/2014 (1:16 pm)
Blimey. Just a week ago I started looking into Torque, hoping to find projects like this. Wasn't expecting to find much, but earlier I found Robert Fritzen's thread in the forums and now this. Very exciting! I briefly responded there about my past works and experiences with node systems (just 2 hours after you posted this). I probably would have instead responded to you had I noticed this earlier, so take a look.How far are you planning to go with this? I essentially had the same idea, but using Blender's pynodes interface as basis. I'm not planning to venture into Torque territory any time soon though. My first goal is to set it up as parallel array processing platform, and expand from there.
#7
Well initially I'm just going for a simple UI that can do HLSL shaders, (beginning with PostFx shaders as they are the simplest imo).
I've had some though on expanding above that, making a C# compiler as well (but that is not in T3D scope, that is for our [WLE] engine "OMNI"), I have some ideas for featuring live-debugging visualization.
However one of the ideas I had for supporting arbitrarily complex systems, is to create a "function" node which has some input and some output which you can "step" into or "step" out of and it works like a completely clean graph (with the option of saving it for reuse) a lot like groups in blender.
01/11/2014 (1:31 pm)
@AnttonWell initially I'm just going for a simple UI that can do HLSL shaders, (beginning with PostFx shaders as they are the simplest imo).
I've had some though on expanding above that, making a C# compiler as well (but that is not in T3D scope, that is for our [WLE] engine "OMNI"), I have some ideas for featuring live-debugging visualization.
However one of the ideas I had for supporting arbitrarily complex systems, is to create a "function" node which has some input and some output which you can "step" into or "step" out of and it works like a completely clean graph (with the option of saving it for reuse) a lot like groups in blender.
#8
04/04/2014 (1:18 pm)
That's very cool Lukas!
#9
Also, you may want to include a GLSL shader export by just merely using ATI's (or AMD now) HLSL2GLSL. With the new release of OpenGL by Luis, the demand for OpenGL shaders will be bigger opening a new world to the SteamOS, Mac OS, and Linux community.
Good luck!
04/08/2014 (1:01 pm)
THIS IS OVERWHELMINGLY COOL! I really hope that you can continue with this project and create new abilities.Also, you may want to include a GLSL shader export by just merely using ATI's (or AMD now) HLSL2GLSL. With the new release of OpenGL by Luis, the demand for OpenGL shaders will be bigger opening a new world to the SteamOS, Mac OS, and Linux community.
Good luck!

Torque Owner Vince Gee
WinterLeaf Entertainment