DGL
https://delphigl.com/forum/

Shaders - Lighting, Which is best
https://delphigl.com/forum/viewtopic.php?f=19&t=3892
Seite 1 von 1

Autor:  Stucuk [ Mi Mär 09, 2005 21:46 ]
Betreff des Beitrags:  Shaders - Lighting, Which is best

Which in your oppinion would be the best shader language to learn,

Cg
glSlang
low level Vertex/Fragment Shaders
Other

Autor:  Tomok [ Mi Mär 09, 2005 21:52 ]
Betreff des Beitrags: 

I personaly would recomend low level Vertex/Fragment Shaders, because they run faster on most graphic cards, at least for now.
But GLSlang is good to, because it will be faster on the next generation of graphic cards.

Autor:  Flash [ Do Mär 10, 2005 00:28 ]
Betreff des Beitrags: 

With Shaders you invest in the future. So I think GLSLANG would be best. Lock at the recent poll. You see: less then 40% have shaderable(?) cards. And this is a OpenGL-Board. Normal users mostly don't have shaderable cards for now. When everybody has such cards, GLSLANG would also be fast enough.

Just my 2 cents ;)

Autor:  LarsMiddendorf [ Do Mär 10, 2005 01:11 ]
Betreff des Beitrags: 

GLSL is slow because, the compiler is full of bugs, at least on ATI hw.
I prefer ARB_fp, because you will need many different shaders and you can't write them all by hand. If you've more than one standard material and one light type, there are many combinations for each light/material interaction and for each renderpass. It is necessary to generate them from a higher level material definition and that's easier with ARB_fp. GLSL is to high as a compile target, because it introduces another level of indirection that I don't need. ARB_fp is widely supported and it is fast.

Autor:  cragwolf [ Di Mär 22, 2005 23:52 ]
Betreff des Beitrags: 

What is this ARB_fp? How do I get my hands on it? And sites devoted to it? My Google search turned up nothing specific.

Autor:  Grizzly [ Mi Mär 23, 2005 00:14 ]
Betreff des Beitrags: 

search for arb_fragmentprogram.
It's basicly the low level fragment shader language

Autor:  Stucuk [ Mi Mär 23, 2005 04:45 ]
Betreff des Beitrags: 

your card needs to support ARB_FRAGMENTPROGRAM to use fragment shaders.

Nvidia 5 series and up support it (i think Fragment shaders started appearing on the 5 series)

Autor:  McCLaw [ Mi Apr 20, 2005 15:52 ]
Betreff des Beitrags: 

I would say that Cg is a good middle ground, because it adapts to the card it is running on.

You could get the best performance from this for nvidia specifically because of the way you implement the actual cgCalls

It compiles to a number of different "Lower Level" languages, or you can ask it to just use the best it can find.
Also, another factor to consider is the amount of time you spend coding your shader.

I dont know about you, but I find it VERY hard to figure out what the ARB_fp etc.. does because of the ASM like code.

Where Cg models the C language, and is MUCH easier to read.

Autor:  Silk [ Sa Apr 23, 2005 10:28 ]
Betreff des Beitrags: 

I don't intend to start a "windows vs. linux"- or "c vs. pascal"-like flamewar here (use whatever you prefer as long as you're happy with it), but would like to comment my concerns on cg :wink:

Cg might offer nice toolkits/libraries to speed up development, but remember what to 3Dfx's Glide happened. The company went bankrupt and the new owner (S3 i think) didn't have much interest in continuing their efforts, last thing of Glide i've seen was some major buggy DirectX wrapper.
I'm neither predicting that nVidia will bankrupt soonish, nor that the new owner would discontinue their strongest section. But remember that cg is property of nVidia and if a new graphics card vendor should enter the market, their hardware might not work flawless with cg default profiles you want to use or it might take a while till custom profiles are available for cg (but proper OpenGL support will most likely be one of that new vendor's major concerns, since cg can compile to standard OpenGL aswell). I might be wrong about this, but from what i know about cg it has optimized profiles for nvidia hardware extensions mostly, it might not be in their interest to support the competition at all - or the competition's interest to support nVidia's cg. If you already made the step to decide not to be tied to DirectX platforms it might be worth a thought not to tie yourself to a graphics card vendor. After all it's only about the $ for companies.

Conclusion: I tend to agree with Flash and Tomok. glslang is worth a look, especially since you will need some time to develop software - glslang will most likely improve :wink:

@Lars: You are right, glslang isn't very mature at it's current state, but would you really recommend a beginner zo shaders to start with arb_fp? I remember, you wrote fxPascal and are way beyond average's programmer skill...

@McClaw: The readability of your shaders in glslang is not much different from cg in my opinion, this argument applies to arb_fp though.

Just my 2c, didn't intend to offend anyone.

-Silk

Autor:  LarsMiddendorf [ Sa Apr 23, 2005 16:38 ]
Betreff des Beitrags: 

Cg ist very similar to Direct3D HLSL. If NVidia stopps Cg development, you can always use DirectX.
GLSL is very easy to use and the idea of compiling in the driver is good, because the driver can optimize your shader. But infact it doesn't good enough. Even the NVidia glsl compiler produces not optimal code, when using ps30 features like loops. The performance difference between dynamic and static branching is very huge and the compiler doesn't detect when static brachning should be used. I testet the same shader with glsl,Cg and DirectX HLSL and only the Direct3D compiler produces the correct code. But sometimes glsl is faster than ARB_fp on NVidia cards.
You should use glsl, because it will be hopefully faster sometime, but the current implementations are not very useable. I suppose to support both. You have to support pixel shader 3.0 (glsl,nv_fragment_program2), because it it standard. But you also need to support ARB_fp, because there are many users with Radeons and GFFX. The best solution in my optinion is to use ARB_fp for ps20. The length of these shaders is limited and so it is not a problem to write them in ARB_fp. For pixel shader 3.0 it would suggest to use glsl and in the special case, when the compiler doesn't produces the fastest code, to use nv_fragment_program2 as an option on NVidia cards.

Autor:  LarsMiddendorf [ Do Apr 28, 2005 17:19 ]
Betreff des Beitrags: 

You can also use Cg to compile GLSL programs into ARB_vp/ARB_fp.

cgc -oglsl -profile vp40 test.txt

Code:
  1. void main()
  2. {
  3.   gl_Position = ftransform();
  4. }


Code:
  1.  
  2. !!ARBvp1.0
  3. OPTION NV_vertex_program3;
  4. # cgc version 1.3.0001, build date Jan  7 2005 14:01:35
  5. # command line args: -oglsl -profile vp40
  6. # source file: test.txt
  7. #vendor NVIDIA Corporation
  8. #version 1.0.02
  9. #profile vp40
  10. #program main
  11. #semantic gl_ModelViewProjectionMatrixTranspose
  12. #var float4 gl_Vertex : $vin.ATTR0 : ATTR0 : -1 : 1
  13. #var float4 gl_Position : $vout.HPOS : HPOS : -1 : 1
  14. #var float4x4 gl_ModelViewProjectionMatrixTranspose :  : c[0], 4 : -1 : 1
  15. PARAM c[4] = { program.local[0..3] };
  16. TEMP CC;
  17. BB1:
  18. DP4   result.position.w, vertex.attrib[0], c[3];
  19. DP4   result.position.z, vertex.attrib[0], c[2];
  20. DP4   result.position.y, vertex.attrib[0], c[1];
  21. DP4   result.position.x, vertex.attrib[0], c[0];
  22. END
  23.  

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/