Getting sampler2DShadow to work

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
motorfreak
Posts: 21
Joined: Thu Feb 20, 2014 7:39 pm

Getting sampler2DShadow to work

Post by motorfreak »

Does anyone have a working example of how to set up textures so that they work as sampler2DShadow?
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Getting sampler2DShadow to work

Post by Nadro »

Just use sampler2D. Sampler2DShadow is deprecated solution.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
motorfreak
Posts: 21
Joined: Thu Feb 20, 2014 7:39 pm

Re: Getting sampler2DShadow to work

Post by motorfreak »

Nadro wrote:Just use sampler2D. Sampler2DShadow is deprecated solution.
That should not have anything to do with it. It should work anyway. I have added this to OpenGLTexture:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);

then I use sampler2Dshadow and query it with shadow2D(shadowTex, vec3(xy, z));

I was able to make it work just fine if I do comparison in shader (using texture2D instead. But when I switch to shadow it does not work anymore. So I know that: there is nothing wrong with my texture coordinates, there is nothing wrong with the depth value passed in to shadow2D. So it must be something wrong with how the framebuffer texture is created.

is there an example somewhere on how to do soft whadows with irrlicht and glsl?
Post Reply