Question about CG shader language

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
AReichl
Posts: 270
Joined: Wed Jul 13, 2011 2:34 pm

Question about CG shader language

Post by AReichl »

I just try the Xth. time do get into shader programming.

I won't learn 2 languages (HLSL + GLSL) !!!

CG is fine, but Nvidia itself advises to take something else for future use (and besides, CG is used by Sony for the PlayStation, but it does not run on the XBox).

Maybe use a HLSL -> GLSL "converter" (or the other way around, i don't care) which will be supported in the future (DirectX 11 <-> OpenGL 4) ?

Found some hints here (but still don't know what to do):
http://aras-p.info/blog/2012/10/01/cros ... s-in-2012/

Some time ago there were some interesting university projects (Brook, SH), but development is closed.

It SEEMS to me, that the most economic way right now and for the future would be to learn HLSL (maybe only up to DirectX 9), compile it through CG if you need the written shaders in GLSL, and hope that some company or open source project finds a solution for this mess.

Any ideas or advice ???
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Question about CG shader language

Post by hendu »

Learn one language, the cross-platform one (GLSL) ;)
AReichl
Posts: 270
Joined: Wed Jul 13, 2011 2:34 pm

Re: Question about CG shader language

Post by AReichl »

Right - specially now where GLSL becomes more important again.

But then you could also say, Irrlicht should only support OpenGL in the future.

If there would be a GLSL -> HLSL converter (there is a project in work), i immediately would say "that's it".

Also you are not alone on this world - i once was asked to help with shaders in HLSL (customer requirement!), so i could not choose.

To sum it up - you are probably right, but i still don't really like the answer.
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: Question about CG shader language

Post by Cube_ »

What about http://en.wikipedia.org/wiki/Shading_la ... g_Language ?
I personally use GLSL but OSL is interesting at the least.
"this is not the bottleneck you are looking for"
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Question about CG shader language

Post by robmar »

OSL is interesting, does anyone have any idea how or if that could be integrated into Irrlicht? I looked at the GitHub project page, but there were very little details on integration.
Foaly
Posts: 142
Joined: Tue Apr 15, 2014 8:45 am
Location: Germany

Re: Question about CG shader language

Post by Foaly »

robmar wrote:OSL is interesting, does anyone have any idea how or if that could be integrated into Irrlicht? I looked at the GitHub project page, but there were very little details on integration.
My opinion:

OSL is meant mainly for ray tracing.
E. g. on the github page it says "OSL does not have a separate kind of shader for light sources. Lights are simply surfaces that are emissive, and all lights are area lights."
Things like that really make it unsuitable for real-time rendering.

And you don't compute shadows and all yourself, like you would with glsl, but the rendering system magically does it for you.
So is probably inflexible for real-time, where you don't want accuracy, but instead "fake" many effects.

Although some part of the language could probably be used in a rasterization based renderer.
E. g. that it does not differentiate between varyings and uniforms.
You could maybe create an OSL-like language.

But it would be a huge amount of work and probably not worth it.
Post Reply