lwjglgamedev / lwjglbook-leg

Source code of the chapters of the book 3D Game Development with LWJGL 3
https://ahbejarano.gitbook.io/lwjglgamedev/
Apache License 2.0
560 stars 202 forks source link

[Ch28] Objects with texture alpha #107

Closed cleverpanda closed 2 years ago

cleverpanda commented 2 years ago

I'm unable to render models with textures that have alpha, which I thing is a big problem for things like foliage. It currently renders alpha black. I tried copying the glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); from the particle code and disabling after in the renderGeometry method but this results in a black object.

lwjglgamedev commented 2 years ago

Hi,

This is a normal issue in deferred rendering. The problem is that the render targets do not store alpha info (it makes no sense). If you want to add support for transparencies you can:

In any case, I'm currently refactoring the book, I will try to explain this better in the new version.