Shaders, which and how to learn?

Discussion about everything. New games, 3d math, development tips...
Post Reply
Insomniacp
Posts: 288
Joined: Wed Apr 16, 2008 1:45 am
Contact:

Shaders, which and how to learn?

Post by Insomniacp »

Alright... I have seen some great looking things using shaders so,
I was wondering where does one start learning these?
Which would be better to write in GLSL or HLSL?

The game I am making will hopefully work on any system(primary is windows then linux) so keep that may help with which is better, I believe that GLSL was the more portable one. If you know of some guides or tutorials those would be nice aswell.

Thanks ahead of time, hope to be able to add to the irrlicht screen shots area soon.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Re: Shaders, which and how to learn?

Post by Acki »

Insomniacp wrote:The game I am making will hopefully work on any system(primary is windows then linux) so keep that may help with which is better, I believe that GLSL was the more portable one.
probably GLSL is, because HLSL depends on DX and I doubt you'll get a linux distro that uses DX... :lol:

for a HLSL tutorial look here: http://www.neatware.com/lbstudio/web/hlsl.html
or this for GLSL: http://www.lighthouse3d.com/opengl/glsl/
but always remember: Google is your friend (there are tons of shader tuts on the web)... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

You could always look into CG which works with both DX and OGL...
Image Image Image
Insomniacp
Posts: 288
Joined: Wed Apr 16, 2008 1:45 am
Contact:

Post by Insomniacp »

Hmmm, CG does sound appealing, would it be better to use CG or make separate GLSL and HLSL pending what system they are running? I guess more specifically are there any draw backs to CG because it works in both places not one specifically?
Halan
Posts: 447
Joined: Tue Oct 04, 2005 8:17 pm
Location: Germany, Freak City
Contact:

Re: Shaders, which and how to learn?

Post by Halan »

Acki wrote:
Insomniacp wrote:The game I am making will hopefully work on any system(primary is windows then linux) so keep that may help with which is better, I believe that GLSL was the more portable one.
probably GLSL is, because HLSL depends on DX and I doubt you'll get a linux distro that uses DX... :lol:
Every moder distro runs wine and has dx support ;)
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Re: Shaders, which and how to learn?

Post by Acki »

Halan wrote:Every moder distro runs wine and has dx support ;)
maybe it'll be usefull in the future, but I doubt at present, at least for serious game developing using dx... :lol:

http://wiki.winehq.org/DirectX-Shaders
# We know that the bytecode represents from MSDN: See Shader Tokens
* Just like with everything else in WineD3D, we are basically implementing a driver for MS Direct3D that sits on top of OpenGL.

# How bytecode is handled
* Historically only vertex shaders (D3D8 ones, VS1.1) were running, using software rendering (pixel shaders will likely be too slow and tricky to simulate).
* WineD3D currently have 2 paths: one for Hardware (HW) support (on top of OpenGL) one for Software (SW) simulation
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Insomniacp
Posts: 288
Joined: Wed Apr 16, 2008 1:45 am
Contact:

Post by Insomniacp »

If I were to to choose HLSL I would also learn GLSL and make the same shaders using both languages in the long run so that there is full support for linux and windows. Though if I were to just learn CG I would only need to write one shader that would work both places. Which method would be more efficient and allow for more advanced shaders? So unless there is a major flaw with CG I will most likely learn it and use it.
Post Reply