Shaders - Where to start?

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
IrrWHAT?!
Posts: 33
Joined: Tue May 20, 2008 9:18 am
Location: Australia

Shaders - Where to start?

Post by IrrWHAT?! »

Hi. I'm IrrWHAT
this is my first time on the forum (so be nice :wink:).

I am not a complete noob to programming C++ but I am to Irrlicht. I like it so far and wish to continue with it. For a long time I've wanted to have a go at shaders, long before I got irrlicht, but it all went over my head. glsl, hlsl, fragment shader and pixel shader, where all unknown terms to me and I couldn't find a good tutorial to fix my confusion. I know what they mean now, but I'm not sure what I should be learning to start using shaders with Irrlicht (I haven't learnt a shader language yet).

I want my programs to run on gl and dx APIs but that would involve learning GLSL and HLSL, which, when combined are too hefty a read for me to find the time to learn.

I found the alternative, IrrCG, an abstraction from the two languages. Sadly I can't get any of the examples to compile (probly bad library linking on my part) and I am having trouble finding good documentation on how to use it. Then I read somewhere that the current version doesn't support PS3, which especially disappointed me as I wanted to look into steep parallax, among other things (which tend to require PS3).

I had a brief look at the description of ATI's ASHLI, but it is a big download on my slow connection, when I am not really sure if it is what I'm after.

A GLSL<->HLSL converter that doesn't require an entire abstracted language would be perfect (but that's asking for too much :wink:).

I am willing to learn one shader language but not two. And I really would much rather have PS3 support than not.

Any suggestions?
lostclimategames
Posts: 331
Joined: Sat Sep 02, 2006 4:11 am
Location: Michigan
Contact:

Post by lostclimategames »

hmm i wasnt aware that irrlicht couldnt support pixel shader 3, I thought just about anything that accepts hlsl could.... thats wierd.
___________________________
For all of your 3D/2D resource needs:
Image
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

Hi, for first You should read Cg tutorial:
http://http.developer.nvidia.com/CgTuto ... ter01.html

I think, than Cg shading language is the best language if You use both API: DirectX and OpenGL. Next You can use easy tu use IrrCg (I don't know how problems with linking You are, I release source code, so linking isn't problem now, IrrCg usage similar to standard irrlicht shader usage method and You can see how is done in examples). Of course IrrCg has got support for Shader Model 3.0 because this is only wrapper and has got all profiles etc. from native cg libraries.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Hi. I'm IrrWHAT
Lol (Waves from across the tasman)
Then I read somewhere that the current version doesn't support PS3,
No idea where you read that, but its wrong.
I know what they mean now, but I'm not sure what I should be learning to start using shaders with Irrlicht (I haven't learnt a shader language yet).
The shader example in the SDK is a start.
A GLSL<->HLSL converter that doesn't require an entire abstracted language would be perfect (but that's asking for too much Wink).
The best GLSL<->HLSL converter is yourself, first of all, they are very very similar, (Just change from float3 to vec3 and some lerp() to mix(), etc), and secondly most converters won't convert the mathematical concepts correctly, for example the ATI converters didn't swap the order of multiplication of my matrices because it didn't know what I was doing (GL has a different matrix coordinate system from Direct3D), so I had to swap them myself.

I recommend looking at and trying to implement examples in Irrlicht, the NVidia shader library has alot of nice stuff (They come in HLSL and CG versions), and theres alot of stuff to check out on the forums here. Then I recommend studying some mathematical concepts involving shader algorithm, because it's necessary to know that stuff more than anything, the language is the easy part (And thats why I say whether its hlsl or glsl its irrelevant, it just comes down to the mathematical formula you're trying to convey).

Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
IrrWHAT?!
Posts: 33
Joined: Tue May 20, 2008 9:18 am
Location: Australia

Post by IrrWHAT?! »

Thx alot.
I read that irrCG didn't support PS3 in a forum somewhere (don't remember which). It was probably talking about a really old version of IrrCG, or it was just wrong. Glad to know it does support it! :D

Thx for the quick response too. Getting a response from Nadro, creator of IrrCG, is cool. Having the creator speak to you gives much more reliable information than an outdated forum topic/person who doesn't know what they're talking about :wink:.

IrrCG looks like what I'm after. I'm still having a problem though :?. The line

Code: Select all

#include <Cg/cg.h>
is confusing me. Neither me nor my compiler know where cg.h is.
Hi. I'm IrrWHAT
Lol (Waves from across the tasman)
LOL, hi blindside :)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Maybe you should download Cg from NVidia's website?
IrrWHAT?!
Posts: 33
Joined: Tue May 20, 2008 9:18 am
Location: Australia

Post by IrrWHAT?! »

Yeah, I'm an idiot! :oops:
I just realised that.
I'm downloading the cg toolkit now.
Post Reply