pbr shader code in glsl

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
cosmo
Posts: 17
Joined: Sat May 06, 2017 1:29 pm

pbr shader code in glsl

Post 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!
CuteAlien
Admin
Posts: 9647
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: pbr shader code in glsl

Post 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).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply