nV News Forums


nV News Forums (http://www.nvnews.net/vbulletin/index.php)
-   Software Development (http://www.nvnews.net/vbulletin/forumdisplay.php?f=53)
-   -   Shadereditor experiment (http://www.nvnews.net/vbulletin/showthread.php?t=79101)

oc2k1 10-27-06 06:20 PM

Shadereditor experiment
2 Attachment(s)
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...)

oc2k1 10-29-06 05:37 AM

Re: Shadereditor experiment
29 Views? In this forum are to much bugreports.

Please move this topic to General Linux.

TPG 10-29-06 09:31 AM

Re: Shadereditor experiment
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 :)

oc2k1 10-29-06 10:08 PM

Re: Shadereditor experiment
1 Attachment(s)
Now multiple TMUs are working.
I've add new pic. That's a simple dot3 Bumpmapping with an additional unrealistic specular term :captnkill:

pe1chl 10-30-06 04:19 AM

Re: Shadereditor experiment
Maybe you will have more response when sourcecode is attached so people can try it themselves...

oc2k1 10-30-06 01:15 PM

Re: Shadereditor experiment
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.

oc2k1 10-31-06 11:03 AM

Re: Shadereditor experiment
1 Attachment(s)
Reliefmapping works now too. I've get some nice textures from here
that I use for rendering the attached pic...

oc2k1 11-14-06 04:30 PM

Re: Shadereditor experiment
1 Attachment(s)
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...

oc2k1 11-20-06 09:13 PM

Re: Shadereditor experiment
1 Attachment(s)
I've wrote a simple furshader :D

ari.reads 11-20-06 09:27 PM

Re: Shadereditor experiment
why not growing this into a sourceforge project? it looks really neat.

oc2k1 12-02-06 04:28 PM

Re: Shadereditor experiment
1 Attachment(s)
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

El_Presidente 12-02-06 04:31 PM

Re: Shadereditor experiment
really nice what you do ;)
please dont stop posting your efforts here

All times are GMT -5. The time now is 08:55 PM.

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.