Page 1 of 1

pbr shader code in glsl

Posted: Sun Oct 03, 2021 3:50 pm
by cosmo
Hi,
since I knew Irrlich is capable to consume GLSL code version 3 or 4, I'm trying to implement a PBR Shader, based on LearnOpenGL lessons.
But when I run my application, the mesh (to which the shader code is reffered to), is rendered completely black, without any textures or effects applyed to.
Could you please check if the code that follows is all right?

Code: Select all

teapot_Mat = gpu->addHighLevelShaderMaterialFromFiles("./Res/Shader/Pbr.vert", "main", EVST_VS_3_0,
                                                       "./Res/Shader/Pbr.frag", "main",  EPST_PS_3_0,
                                                        teapotPBR, EMT_SOLID, 0, EGSL_DEFAULT);
Are EPST_PS_3_0 and EGSL_DEFAULT the right enums to use for GLSL shader code?
I didn't find any example for this specific topic.
Sorry for my lack of skills and for some explanation issue.
Thanks, bye!

Re: pbr shader code in glsl

Posted: Sun Oct 03, 2021 4:13 pm
by CuteAlien
Yes, should be the correct one. I just had to check what we use here and it seems we also check if the card supports it. Thought that's probably always the case these days.
So our code something like:

Code: Select all

HighestVSType = driver->queryFeature(EVDF_VERTEX_SHADER_3_0) ? EVST_VS_3_0 : EVST_VS_2_0;
HighestPSType = driver->queryFeature(EVDF_PIXEL_SHADER_3_0) ? EPST_PS_3_0 : EPST_PS_2_0;
And then we pass the result of that.

Our shaders themself then set the version in their first line (before anything else), with:
#version 430 compatibility

You should probably start with the simplest possible shader (just returning one color or so).