BennyQBD / 3DEngineCpp

It's like the 3D Game Engine, except in C++
Apache License 2.0
303 stars 85 forks source link

Variance Shadow Mapping texture problem #24

Open deamont66 opened 10 years ago

deamont66 commented 10 years ago

Hi Benny, I'm porting your 3DEngine to Java and accidentally bump into issue with texture creation. In you Variance Shadow Mapping Implementation video you changed shadowMap internal format to GL_RG32F and since then is my rendering broken. The PCF shadow smoothing work just fine, but this is not.

github-shadows-after

The issue started here, after changing this line:

setTexture("shadowMap", new Texture(1024, 1024, null, GL_TEXTURE_2D, GL_NEAREST, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, true, GL_DEPTH_ATTACHMENT));

to line:

setTexture("shadowMap", new Texture(1024, 1024, null, GL_TEXTURE_2D, GL_LINEAR, GL_RG32F, GL_RGBA, true, GL_COLOR_ATTACHMENT0));

Here is my commit of changing code back to PCF shadows: https://github.com/deamont66/3DEngine/commit/82d9a5a088f7653d34a61db85da57033bf342cee

My code is complete mirror of this commit: https://github.com/BennyQBD/3DEngineCpp/tree/001bc572e85e090df77cd9de2f3cfa61ab3b563a

I don't really know what the issue can be. I have laptop with Intel Integrated Graphic (3.1.0 - Build 9.17.10.3347) and NVidia m555 (4.4.0) on both same result.

P.S.: My code include the fix for depth textures on Intel (glReadBuffer), but changing or removing it doesn't make any effect at all. And sorry for my bad English but it's not my native language.

I will be glad for any help, Thanks.

BennyQBD commented 10 years ago

If you download my current version of the repository, build, and run that, does that still have the issue, or does it only happen in your repository?

deamont66 commented 10 years ago

Yeah just tried and it seems working fine. Sorry for interrupting you but problem is probably on my side (or LWJGLs). I cant found any differences in my code and cpp one, Do you have any idea what can cause that issue? Thanks for fast response.