Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Fr Jul 18, 2025 23:33

Foren-Übersicht » Programmierung » Shader
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 3 Beiträge ] 
Autor Nachricht
BeitragVerfasst: Fr Jan 18, 2008 22:24 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
It is possible to convert almost any shader format to arb vertex and fragment shaders. This is possible with the ati ashli viewer available at: http://ati.amd.com/developer/ashli.html . It converts from:
- Renderman Shaders
- HLSL Shaders (directx)
- GLSL Shaders (directx)
to ARB vertex and ARB fragment shaders.
At first i thought is was fixed to the examples supplied, but you can add your own scenes and shaders.
For Renderman shaders you need to modify: ashliViewerListRMan.dat
For GLSL Shaders you need to modify: ashliViewerListGLSL.dat
For HLSL Shaders you need to modify: ashliViewerListHLSL.dat
You will find these files in: C:\Program Files\ATI Technologies\Ashli Viewer 1.7.0\bin if you installed the ashli viewer in the default location.
The format for adding your own scene is:
Code:
  1.  
  2. program Ambient
  3. shader basic.glsl
  4. shader ambient.glsl
  5. scene ambientduckie.scn
  6.  
  7.  

The program is the entry in the treeview and the sader and scene are showed when click on the + in the treeview. Each program needs to be seperated by a blank line.

The .glsl files and .scn file need to be in the ShadersGLSL subfolder.
Used textures need to be in the Textures subfolder and should be in .tga format.
Used models need to be in the Models subfolder and are in a custom format that should easy to understand:
Code:
  1.  
  2. Object("room") {
  3. Specular3f(1.0, 1.0, 1.0);
  4.  // unique vertices: 9445
  5.  Normal3f(-0.000015, 0.997051, -0.076735);
  6.  Color3f(0.615686, 0.000000, 0.000000);
  7.  TexCoord2f(0, -30.370804, -12.178762);
  8.  Vertex3f(105.282875, 56.890732, -192.224258);
  9.  
  10. etc ...
  11.  
  12.  // faces: 11785
  13.  // material Material #124
  14.  UseMaterial("simple");
  15.  Triangle(5491,5492,543);
  16.  Triangle(5494,5495,5496);
  17.  
  18. etc ...
  19.  
  20. Triangle(9364,9369,9362);
  21. ObjectFit(2,1.0);
  22. } /* end of object sofa */
  23.  
  24.  

But for the moment i am confused by how the triangle indices work.
More important are the material names as you can assign shaders to them in the .scn file. So for now i name my material after an material available in an object.

Setting up a scene with materials is done like this:
Code:
  1.  
  2. object rubberduckie
  3. background ramp
  4. rotate x 280
  5. rotate z 45
  6. translate z -3
  7.  
  8. material duckie
  9. shader ambient.glsl
  10. float Ka 1.0
  11. float intensity1 1
  12. color lightcolor1 1 1 1
  13.  
  14. vshader basic.glsl
  15.  
  16. lightparams
  17. 1 intensity1 lightcolor1
  18. end
  19.  

First you need to specify the model you want to use
Next a background (don't know where these are specified)
Next you specify how the object is positioned
Now we need to specify the materials
As you can see you can set default values for globals in the glsl shader. Also using one shader you can make multiple materials if your shader is flexible enough. The above is an basic scene. But things can get complicated.
Finaly you need to setup some lights.

On opening the scene you can compile arb fragment and vertex shaders that you can view and copy and post for use with your opengl application.
You can optimize shaders for nvidia and or ati video cards.

Oh before i forget you can also compile to directx shaders.

Ok this should get you started converting shaders to something less readeable... (be sure to keep your original :wink: )

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Sa Jan 19, 2008 16:35 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
For creating renderman shaders i use shaderman version 7: http://www.dream.com.ua/thetool.html that is the previous version available at: http://www.dream.com.ua/theoldtool.html (and it supposed to be written in delphi!). I realy like this as it allows to create shaders in a visual way and with ashli i can create arb-fragment en vertex shaders. :D

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Jan 21, 2008 21:17 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
Also conversion between glsl and hlsl should be possible using nvidia's cg available at: http://developer.nvidia.com/object/cg_toolkit.html

the following commands can be used (have not tested it yet):
cgc -oglsl -profile fp30unlimited some_wicked_shader.frag
cgc -oglsl -profile vp30 some_wicked_shader.vert
to create assembly like shaders, but hlsl and glsl are also targets, so conversion from glsl to hlsl should also be possible.

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 3 Beiträge ] 
Foren-Übersicht » Programmierung » Shader


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 4 Gäste


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.007s | 14 Queries | GZIP : On ]