HSLS GLSL CG

Community Forums/General Help/HSLS GLSL CG

Yue(Posted 2015) [#1]
That is recommend to program in Shaders?

I'm trying to understand what is the best option to try to learn something from Shaders and lean CG but not if it is the best option.

http://http.developer.nvidia.com/CgTutorial/cg_tutorial_chapter01.html


GfK(Posted 2015) [#2]
Shaders with Blitz3D? Is that even possible??


Yasha(Posted 2015) [#3]
These are programming languages you can use to write shaders. Just like CPU code, shaders can be written in different programming languages. There are many programming languages that can compile for GPU (i.e. to shader), but these are the most popular ones.

These three are very similar, all filling pretty much the same niche (it's very easy to convert code between them). GLSL is the main OpenGL shading language; HLSL is the main DirectX shading language; Cg is Nvidia's own shading language. Cg and HLSL are separate implementations, but very similar languages (same origin).

GLSL and HLSL can be used anywhere OpenGL and DirectX are supported, because their compilers are built into the graphics driver. Other languages need standalone compilers to produce some other form of GPU code (in a similar way that C or Blitz3D need to be compiled to CPU code before being run), and are thus less popular. Cg is unsupported by its creators as a standalone language now.

You should start by just using the language that fits whatever engine you're using. OpenGL-based engines use GLSL, and DirectX engines use HLSL or some variant on it. Some engines may have their own shader language, but those are likely to be obscure. Unity provides a variant of Cg (I think). There's not much point in setting out to learn any one language in particular, instead of the one your platform provides.

All of the basic principles that apply to one shading language will apply to the others. Writing code for the GPU is much more constrained than for the CPU and they essentially all have to work in the same way. (Even unusual ones like SharpShaders actually come down to more or less the exact same code.)


Yue(Posted 2015) [#4]

Shaders with Blitz3D? Is that even possible??



Already in Blitz3D not be used Shaders, but in Ogre if you can.

@Yasha
Thanks for the info, I'm trying to understand the concept of matariales and linking to a Shader, however seemed to me to read that the CG is in disuse, is that correct?


Brucey(Posted 2015) [#5]
You're using Ogre now? I thought you'd moved on to Unity? :-)


Yue(Posted 2015) [#6]
Really let Unity to a side, because the engine is heavy and each update is a real problem for unloading, that besides the development environment PureBasic seems much easier and lightweight, it uses Ogre.

In addition PureBasic makes me very like Blitz3D, on the other hand Unity kicks me in the stomach because until the last time you use the documentation was in English, and sometimes do not understand anything because my native language is Spanish.


GfK(Posted 2015) [#7]
So you've gone to Unity, then to Purebasic and Ogre, and are asking for help here?

Can't help thinking you might get more joy at the Purebasic forum...


Yue(Posted 2015) [#8]
No, only speak of Shader, only Shader...


skidracer(Posted 2015) [#9]
Yue, if you want lightweight and easy. you should consider finishing a project all the way to the end in Blitz3D. It is very much like Blitz3D.

If you are going to invest so much time and energy into something and walk away before building something great then you should please reconsider.

You were just starting to get to terms with the concept of rays and vectors and now here you are melting your brain trying to learn shaders.

Although I must say the stuff they do in shaders these days is like, wow, check out this water:

https://www.shadertoy.com/view/Ms2SD1


(tu) ENAY(Posted 2015) [#10]
Awesome water!


Yue(Posted 2015) [#11]
Incredible this water.

I accept that I have certain limitations, and put it on my Education, the truth at some point have to revisit the issue of vectore to understand their learning process, now on shaders might not advance much as maybe I find something complex that is out of my abilities.

Over time I realized that this programming is rather a hobby where I acquired some knowledge not given to create a video game.

At this point what I can do in PureBasic, I owe greatly to the time invested in Blitz3D, because not only is focused on making games, if not general applications.

So the idea is not to make a game, at least for now, maybe I pass lifelong learning but hopefully improve some things about vectors and shaders.

Greetings.


skidracer(Posted 2015) [#12]
.


Matty(Posted 2015) [#13]
Edit....removed.


Yue(Posted 2015) [#14]
Anyone know if there is an editor for writing CG Shaders or something. It seems that all documentation on CG is really hard to find.


Brucey(Posted 2015) [#15]
According to Google, there are several editors, including one by nvidia.