View Full Version : Shadereditor experiment

10-27-06, 06:20 PM
Hi @ all,

because ther's no shadereditor for Linux, I've wrote my own... on the first pic I've create a Earthsphere with simple dot3 Bumpmapping (I've copy Colormap and Normalmap together in one texture) One the second I've load a OBJ file, that I exported from Blender.

How does it work?:
As first create a node, a script, two or more GLSL shaders (Vertex and fragment) and textures via contextmenu.
Then load a model, create a testobject or script OpenGL commands, to get something visible.
As last run the script.

Things that work:
Load & Editing shaders and scripts with simple highligting
Loading textures
Loading simple OBJ files (via script)
Create testsphere with Tangendvectors (via script)
Draw indexed an nonindexed VBOs via script. It's partly possible to modify these with scripts.

To do:
Implement a working save function
Implement more freatures
Add support for multipass rendering.
Add a stop button for render scripts.
Add Tools for modifiing meshes.

To Hope:
Better QSA performance. (A really fast CPU or a better scriptengine are more realistic)
NVX_instanced_arrays (I need that really. That's no joke, but nobody seems to know how usefull it is...)

10-29-06, 05:37 AM
29 Views? In this forum are to much bugreports.

Please move this topic to General Linux.

10-29-06, 09:31 AM
I noticed this is QT/KDE app so maybe you should post about it on kde-apps.org? Maybe there you will gain more response :)

10-29-06, 10:08 PM
Now multiple TMUs are working.
I've add new pic. That's a simple dot3 Bumpmapping with an additional unrealistic specular term :captnkill:

10-30-06, 04:19 AM
Maybe you will have more response when sourcecode is attached so people can try it themselves...

10-30-06, 01:15 PM
Some source:

For recompiling use "qmake && make" the sorce depends to QT-3.3.x, QSA-1.1.x and Glew. Don't use QT4.x with QSA-1.2.x that doesn' work.
Start the program via shell "./gl" to see the GLSLcompiler warnings and errors.

Known Bugs:
All objects should have different names, because they are used by scripts. That's not checked jet. Rename objects using F2.
Testobjectscript: Only sphere is working.
OBJ importer: LWO name is wrong. Many OBJ files use multiple Indexstreams but that's incompatible to VBOs.
Don't close the cam.

A Simple Test:

Make a leftklick on the Wold and add a "node".
Add via Nodes contexmenu: Vertexshader, Fragmentshader, Script and a Texture
Texture : Load media/2kEarth_comp.jpg via contextmenu
Klick on the Node to select it, than run plugins/test_object.js from "Scripts" menu and say create.

shader = gl.Shader(Vertexshader,Fragmentshader);

function render(){





varying vec3 T,B,N;
attribute vec3 Tangent;
varying vec3 col;
void main(void){
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0 * vec4(1,.5,1,1) + vec4(0.35,0,0,0);
N = gl_Normal;
T = Tangent;
B = cross (T,N);

uniform sampler2D Tex0;
varying vec3 T,B,N;
vec3 lvec= vec3(0.707,0,0.707);
void main(void){
vec3 nmap = -1 + 2* texture2D(Tex0, vec2(gl_TexCoord[0]));
nmap = normalize(vec3(dot(T,nmap),dot(B,nmap), dot(N,nmap)));
float l = dot(nmap,lvec);
l += 1 * pow(max(dot(reflect (lvec,nmap),vec3(0,0,-1)), 0),4);
gl_FragColor =l * texture2D(Tex0, vec2(gl_TexCoord[0])+vec2(0,.5));

Then selelct "Run Script" from Scriptcontextmenu. You should see the dot3 bumpmapped earth.

10-31-06, 11:03 AM
Reliefmapping works now too. I've get some nice textures from here
that I use for rendering the attached pic...

11-14-06, 04:30 PM
A small update: DDS Files, Timebased animation and torus works.


Now I'm thinking what should add as next...
Multiple renderpasses and FBOs,
Other testobjects,
or something for better animation...

11-20-06, 09:13 PM
I've wrote a simple furshader :D

11-20-06, 09:27 PM
why not growing this into a sourceforge project? it looks really neat.

12-02-06, 04:28 PM
I've wrote a new shader for rendering fur. The new one is able to run on any GPU that have Pixelshader 2.0 capabilities. I the reliefshader part is replaced by a single texturelookup. With the 2 other lookups for normalmap an colormap it's need only 3 texturelookups instead many for a smooth reliefshading.
The compiled version needs 71 instruction in vf40 profile and ~81 in ps_2_0

12-02-06, 04:31 PM
really nice what you do ;)
please dont stop posting your efforts here

12-03-06, 09:03 PM
Changing the hair direction is now possible too. The next version should be able to read the direction from a texture... (hmm it's time to add the stanford bunny)

12-05-06, 07:20 PM
I've add a simple noisemodulation. I think it looks a little bit more realistic (16x AA clears all.

PS: fract(tan(float) * 43758.5453)*2-1 is a usable replacement for noise(float). sin() and cos() instead tan() are working too. That random numbers are good enough for graphics (but not for crypto....)

12-12-06, 08:03 PM
I've wrote a importer. The texcoords/tangents aren't very good so the image has many artefacs. Because the tangents aren't aligned, I couldn't change the hairdirection.

12-31-06, 10:06 AM
Last night I've installed QT4 and QSA1.2 (unfortunately it kills my QT3/QSA1.1 installation, so I can't recompile my old program). In the next days I'll port my code to the new QT version, so it would be able to run at windows too.

The model on the atached picture has round about 110K polygons.

My new roadmap for the next days:
Port to QT4
replace the MDI
Move the scripts from mainmenu to the items contextmenus
write more scripts

01-05-07, 05:48 PM
Porting to QT4 is slow :( . I have some troubles with removing Objects from the tree.
I'm also thinking about using the developers verion of QT that support QScript, which should be a QSA replacement in QT4.3 and it should run with a speed like Spidermonkey :D

01-09-07, 04:53 PM
80% of porting to QT4 is complete. The scriptlaucher is missing in this version, so it's impossible to load a model.


It would be nice if somebody could check if that code would compile on windows. Theoretical it should be plattform independent (maybe some changes in lumina.pro are needet)

Also I've registered my project at sf.net, but it will take some time. When it's done, I should have add the missing scriptlauncher.

01-13-07, 08:02 PM
My sf.net project is online:

01-21-07, 02:13 PM
I've loaded a new file up. The next step is to check if shadowalgorithms could run in Lumina.

02-01-07, 06:41 AM
I have uploaded a new version at sf.net http://sourceforge.net/projects/lumina/ (the new gear scripts aren't includet)

The same object as smal video http://cpux.de/gears.avi

03-01-07, 03:01 PM
I've uploadet a new relaise. The new version supports load and save and has a new DDS load with volume and cubemap support.