Native Cg shading language support in Irrlicht

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Post Reply
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Native Cg shading language support in Irrlicht

Post by Nadro »

Hi,

As I said in "Project proposal: IrrTech" topic, I tried add native Cg shading language support for Irrlicht and this is effect of my work:
https://sourceforge.net/tracker/index.p ... tid=540678
If You have some suggestions or You'll find some issues with this code I'll try help. If all will be ok I hope that this code will be merged with standard Irrlicht.
It support both D3D9 and OpenGL drivers.

I tested it with NVIDIA Cg 3.0 February 2011

Cheers,
Last edited by Nadro on Tue Dec 27, 2011 10:12 pm, edited 1 time in total.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

I might have to learn Cg :S

anyway buggy race is epic... I love you for the linux thing!
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

From what I've seen, it looks a lot like(if not even worse than) HLSL. That was a really stupid decision to make :roll: :? :evil: :(
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Post by 3DModelerMan »

Native CG support would be awesome. It would make it so we would only have to maintain one shader for both GL and D3D.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

Taking a quick look- it looks even better than the old implementation. Will try it as soon as I get some free time for programming. Thanks for continuing working on it. I`ve used Cg with the old one, and yes, there are only minor differences in HLSL/Cg, which is really nice. Hope it will take its place in the engine. :wink:
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

good or not somebody had to be the geek. nice work nadro keep it coming!
Kalango
Posts: 157
Joined: Thu Apr 26, 2007 12:46 am

Post by Kalango »

Awesome, i intend to chekc it out pretty soon, thanks.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Native Cg shading language support in Irrlicht

Post by Nadro »

I already opened a tracker for this patch. I hope, that it will speedup process of merge it with Irrlicht. I'm still waiting for potentially bug reports. In my internal tests I didn't find an issues, but maybe You will find something.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Native Cg shading language support in Irrlicht

Post by hybrid »

Actually it won't speed up the integration, as the only thing missing so far is some free time on my side. But it does not make things worse, and helps to not forget it if it takes much longer still.
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: Native Cg shading language support in Irrlicht

Post by devsh »

hybrid.. can't we have an IRR_EXPERIMENTAL compile flag for all the patches we submit that look OK, but have not been thoroughly tested to YOUR standards (which are high). So you ship irrlicht with the IRR_EXPERIMENTAL flag undefined but the user can change it and ofcourse there will be a massive print that the features enabled by that flag have not been thoroughly tested and could render the engine unstable however unlikely that is.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Native Cg shading language support in Irrlicht

Post by hybrid »

Simply said: No.
Most things can be compiled without altering the engine, so just put them into irrExt or some other place and put them into your app. Things which need to alter the engine have to be put onto your own builds of Irrlicht, or you wait for the next release. You can use SVN/trunk to get those changes which will be part of the next release. But that's it what is possible from our side. Sometimes we might also branch away (e.g. for the ogl-es changes), but this happens quite seldom because we don't have that many developers that there are conflicts from our development.
fmx

Re: Native Cg shading language support in Irrlicht

Post by fmx »

Great stuff Nadro, good to see you haven't abandoned Cg :wink:
tinhtoitrangtay
Posts: 70
Joined: Tue Oct 28, 2008 12:59 pm

Re: Native Cg shading language support in Irrlicht

Post by tinhtoitrangtay »

Great work but it don't full with irrCg.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Native Cg shading language support in Irrlicht

Post by Nadro »

Yes, it doesn't support XML materials (but it was enough only for simple shaders, so it isn't too important feature), CgFX and enableTexture in shader callback (but this was unoptimized force method for enable more textures, so it wasn't good for a final products). Other features like support for more uniforms type I will add soon. Of course if You switch from irrCg to native Cg use via Irrlicht interfaces You must rewrite shader callback, but this is very easy step.

BTW. Thanks all for all comments about this patch :)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Post Reply