Go Back   nV News Forums > Software Forums > Software Development

Newegg Daily Deals

Reply
 
Thread Tools
Old 10-27-06, 07:20 PM   #1
oc2k1
Registered User
 
Join Date: Aug 2006
Posts: 38
Smile Shadereditor experiment

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...)
Attached Thumbnails
Click image for larger version

Name:	editor11.jpg
Views:	410
Size:	74.9 KB
ID:	21493  Click image for larger version

Name:	editor12.png
Views:	357
Size:	45.1 KB
ID:	21494  

Last edited by oc2k1; 10-29-06 at 06:28 AM.
oc2k1 is offline   Reply With Quote
Old 10-29-06, 06:37 AM   #2
oc2k1
Registered User
 
Join Date: Aug 2006
Posts: 38
Default Re: Shadereditor experiment

29 Views? In this forum are to much bugreports.

Please move this topic to General Linux.
oc2k1 is offline   Reply With Quote
Old 10-29-06, 10:31 AM   #3
TPG
Unregistered User
 
TPG's Avatar
 
Join Date: Apr 2006
Location: Poland, Warsaw
Posts: 203
Default 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
__________________
mandriva > all
kthnxbai

Last edited by TPG; 10-29-06 at 11:11 PM.
TPG is offline   Reply With Quote
Old 10-29-06, 11:08 PM   #4
oc2k1
Registered User
 
Join Date: Aug 2006
Posts: 38
Default Re: Shadereditor experiment

Now multiple TMUs are working.
I've add new pic. That's a simple dot3 Bumpmapping with an additional unrealistic specular term
Attached Thumbnails
Click image for larger version

Name:	editor13.jpg
Views:	332
Size:	52.9 KB
ID:	21548  
oc2k1 is offline   Reply With Quote
Old 10-30-06, 05:19 AM   #5
pe1chl
Registered User
 
Join Date: Aug 2003
Posts: 1,026
Default Re: Shadereditor experiment

Maybe you will have more response when sourcecode is attached so people can try it themselves...
pe1chl is offline   Reply With Quote
Old 10-30-06, 02:15 PM   #6
oc2k1
Registered User
 
Join Date: Aug 2006
Posts: 38
Default Re: Shadereditor experiment

Some source:
http://cpux.de/opengl.qsa7.tar.bz2

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.

Script:
Code:
shader = gl.Shader(Vertexshader,Fragmentshader); 
shader.Uniformi("Tex0",0); 
 
function render(){ 
   Texture.Bind(0); 
   shader.Bind(); 
 
   Sphere.UvCoords.Bind(); 
   Sphere.Tangent.Bind(shader.Loc("Tangent")); 
   Sphere.Vertex.Bind(); 
   Sphere.Normal.Bind(); 
  
   Sphere.Index.Draw(gl.QUADS); 
 
   Sphere.Normal.Unbind(); 
   Sphere.UvCoords.Unbind(); 
   Sphere.Tangent.Unbind(); 
   Sphere.Vertex.Unbind(); 
 
   shader.Unbind(); 
   }
Vertexshader:
Code:
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); 
    }
Fragmentshader:
Code:
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.

Last edited by oc2k1; 10-30-06 at 06:27 PM.
oc2k1 is offline   Reply With Quote
Old 10-31-06, 12:03 PM   #7
oc2k1
Registered User
 
Join Date: Aug 2006
Posts: 38
Default Re: Shadereditor experiment

Reliefmapping works now too. I've get some nice textures from here
http://www.bencloward.com/textures_extra.shtml
that I use for rendering the attached pic...
Attached Thumbnails
Click image for larger version

Name:	editor17.jpg
Views:	315
Size:	70.2 KB
ID:	21573  
oc2k1 is offline   Reply With Quote
Old 11-14-06, 05:30 PM   #8
oc2k1
Registered User
 
Join Date: Aug 2006
Posts: 38
Default Re: Shadereditor experiment

A small update: DDS Files, Timebased animation and torus works.

http://cpux.de/opengl.qsa8.tar.bz2

Now I'm thinking what should add as next...
Multiple renderpasses and FBOs,
Other testobjects,
or something for better animation...
Attached Thumbnails
Click image for larger version

Name:	editor21.jpg
Views:	268
Size:	72.6 KB
ID:	21980  
oc2k1 is offline   Reply With Quote

Old 11-20-06, 10:13 PM   #9
oc2k1
Registered User
 
Join Date: Aug 2006
Posts: 38
Default Re: Shadereditor experiment

I've wrote a simple furshader
Attached Thumbnails
Click image for larger version

Name:	editor22.jpg
Views:	301
Size:	85.1 KB
ID:	22188  
oc2k1 is offline   Reply With Quote
Old 11-20-06, 10:27 PM   #10
ari.reads
Registered User
 
Join Date: Nov 2006
Posts: 17
Default Re: Shadereditor experiment

why not growing this into a sourceforge project? it looks really neat.
ari.reads is offline   Reply With Quote
Old 12-02-06, 05:28 PM   #11
oc2k1
Registered User
 
Join Date: Aug 2006
Posts: 38
Default Re: Shadereditor experiment

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
Attached Thumbnails
Click image for larger version

Name:	editor32.jpg
Views:	284
Size:	153.4 KB
ID:	22485  
oc2k1 is offline   Reply With Quote
Old 12-02-06, 05:31 PM   #12
El_Presidente
Registered User
 
Join Date: Feb 2006
Posts: 62
Thumbs up Re: Shadereditor experiment

really nice what you do
please dont stop posting your efforts here
El_Presidente is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 06:38 AM.


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