Question about CG shader language

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.

Question about CG shader language

Postby AReichl » Thu Feb 27, 2014 1:30 pm

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 ???
AReichl
 
Posts: 230
Joined: Wed Jul 13, 2011 2:34 pm

Re: Question about CG shader language

Postby hendu » Thu Feb 27, 2014 8:32 pm

Learn one language, the cross-platform one (GLSL) ;)
hendu
 
Posts: 2585
Joined: Sat Dec 18, 2010 12:53 pm

Re: Question about CG shader language

Postby AReichl » Fri Feb 28, 2014 9:06 am

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.
AReichl
 
Posts: 230
Joined: Wed Jul 13, 2011 2:34 pm

Re: Question about CG shader language

Postby Cube_ » Sat Mar 01, 2014 7:00 pm

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"
User avatar
Cube_
 
Posts: 1011
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

Postby robmar » Sat Sep 16, 2017 8:14 am

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.
robmar
 
Posts: 991
Joined: Sun Aug 14, 2011 11:30 pm

Re: Question about CG shader language

Postby Foaly » Sat Sep 16, 2017 12:48 pm

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.
Foaly
 
Posts: 141
Joined: Tue Apr 15, 2014 8:45 am
Location: Germany


Return to Open Discussion and Dev Announcements

Who is online

Users browsing this forum: No registered users and 1 guest