How can i convert hlsl to glsl shader?

Hello everyone .
I use coppercube engine to developing game.
Users have written several hlsl shaders for it that only work on the Windows platform. But I want to work on webgl as well. But I do not know how to convert them. Can anyone help me?
For example, is this one of the shades I really need ! But this is hlsl:

If you google “HLSL to GLSL” you find some existing tools. However, they were originally designed to port shader code from DirectX to OpenGL. So you probably will run into issue when reusing the resulting GLSL with WebGL.

I’m not aware of a converter specifically designed for WebGL.

Hello . Thanks, yes, I tried them, but I did not get any results. Someone who writes hsls shaders has said that I just need to replace some code to make it work for WebGL as well. But I do not know it either. Because I do not know Shader at all

I this case I suggest you are looking for somebody with sufficient WebGL/HLSL/GLSL skills who can support you in your project. It’s probably necessary to write the entire shader from scratch.


learning GLSL isn’t even enough, since three use it’s own lights/shadows/textures/UV system
the learning curve is quite steep (you may end diving into three core too :sweat_smile:). But there is a great resource available for free.

This extremly detailed document contain everything you need to know.
and since it’s a web format, it is GLSL friendly and provide live exemple editing

1 Like

thank you. I will definitely look at these sources. I do not know how complicated this is, but a programmer who converted just one of the hlsl shaders to glsl (for coppercube engine) said it’s not too hard, you just have to change a few lines of code.

I referred to the link you introduced. But I saw that many of its main parts (such as texturing, or lighting, etc.) are inactive or have not been written yet.