Custom shaders?

May be a silly question to ask, but if i want to write my own object shaders does it depend on dx11 or opengl backend ?? I mean do i have to write an hlsl or a glsl shader ?

Custom shader are written in glsl and then it is trans-compiled to platform’s own shading language for example for:
Mac/IOS -> MSL,
Windows-> Hlsl/Glsl (DX/OpenGl, depend on api you choose),
Linux -> Glsl/SPIR-V (OpenGl/Vulkan, depend on api you choose)
So, you just have to write shader in glsl and let armory/kha handle platform’s backend.

I did do here:
Shader in pure iron: Physically Based Rendering(PBR) In Iron. (Repo link)
Custom shader in armory: Physically Based Rendering(PBR) In Iron (Repo link)

4 Likes

Ok, that was my understanding of how armory was working but i was not sure. Thanks for clarifying.

1 Like

I come back to you, do we have access to geometry shader too ?

Yep, we can do whatever kha can do, you can access and use geometry shader too but i haven’t used geometry shader.

1 Like

I guess i have to investigate what kha can do :slight_smile:

2 Likes

Geometry shaders currently only work when targeting GLSL, HLSL support is unfinished. It will never work on Metal though because that simply doesn’t support geometry shaders (which tells you a lot about the general state of geometry shaders which are frowned upon by many developers because of their performance problems (see for example http://www.joshbarczak.com/blog/?p=667)).

3 Likes

Ok, great! thanks for clarify this …