# [updated]how to convert from GLSL to HLSL?

## Recommended Posts

Maybe somebody knows a program for converting from GLSL to HLSL code or can advise some article/tutorial/thread on a forum about how to convert manually GLSL instructions into HLSL one? For example I'm confused with varying variables. Thanks in advance. [Edited by - Shockwave on March 13, 2006 8:43:54 AM]

##### Share on other sites
I don't have any resources to direct you at, but from the bits-n-pieces I've heard you'll be better off thinking at the algorithmic rather than syntactic level.

That is, pretty much all shaders break down to simple mathematical equations and texture IO - thats your common language [wink]

Jack

##### Share on other sites
I have to agree with Jack,
You should understand the theory behind a technique or effect. Armed with the theory you can open up a GLSL or HLSL code base and follow what goes on inside of them. Although, I don't know of any programs that will help you convert or will automagically convert them for you.

What I suggest is take a look at the theory and then open the GLSL shader again and see if you can follow on a theory based level.

I don't know GLSL that well but I have implemented some shaders in HLSL from GLSL and from what I can see, the varying variables means that the variables changes each frame or they have the ability to vary.

I hope this helps.
Take care.

##### Share on other sites
http://www.gamedev.net/community/forums/topic.asp?topic_id=376033

##### Share on other sites
The reason I've asked about converter is because I have found a good tutorial about per-pixel lightning for spot, point and directional light sources but implementation is in GLSL. Maybe you can advice me some good tutorial for implementing per-pixel light for directional, point and spot light sources in HLSL?
a per-pixel directional light and in the source code I've found that the author gives the position for his light!
As I know, directional light doesn't have a position only direction and range.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628395
• Total Posts
2982437

• 10
• 9
• 19
• 24
• 10