Problems with framebuffer object

Adeon

terasology.ru
Contributor
Architecture
GUI
Logistics
I've made th wrapper for the framebuffer object(FBOHelper.java), but a small problem appeared.
The textures on the blocks are not shown, it even seems that the texture, which is attached to the fbo is binded to all the blocks.
BUT if we pree the ESC key or F3(out debug info), everithing becomes clearly seen (is shown).

Fbo out:


Fbo with debug info o_O


Commit with code

Could you help me, please?
 

begla

Project Founder and Lead Developer
Contributor
Architecture
Logistics
I've currently have a nearly identical problem when binding a texture in the skysphere (experimenting with clouds at the moment). Reading every line of code back and forth and can not find the quirked statement. :shock: This might related though.
 

Adeon

terasology.ru
Contributor
Architecture
GUI
Logistics
I don't ven know what to suppose... I have overlooked all the conditions of opengl. Could I really make a mistake somewhere in the fbo initialization? Than why the water and the grass is pictured normally, but the other blocks don't? I think that my problem that in GL_BLEND. But... oh... :(
 

begla

Project Founder and Lead Developer
Contributor
Architecture
Logistics
I've got exactly the same behavior. When I set another texture, It is applied to all opaque blocks that should have another texture applied to but the translucent ones are rendered correctly. Seems related to your problem as well. Will be hard to find, but I'm at it. Might even be a bug in the Slick texture loader thingy.
 

begla

Project Founder and Lead Developer
Contributor
Architecture
Logistics
Yeah... It is a bug in Slick. Replaced the bind() call of slick with my own one and... Everything works as expected. Just have a look at the TextureManager and replace the bindTexture(...) method with the following snippet:

Code:
public void bindTexture(String s) {
  glBindTexture(GL11.GL_TEXTURE_2D, _textures.get(s).getTextureID());
}
Please say that it helps with your problem. :D

EDIT: Okay, but this f**** up the text rendering. Give me a moment.
 

begla

Project Founder and Lead Developer
Contributor
Architecture
Logistics
Found the bug in the Slick Texture class. It saves the last bound texture to ignore unnecessary bind calls. But it sets the last active texture in the constructor which might result in many completely ignored texture calls in our context. If no other method uses another Slick texture, the texture might never be bound at all.

The reason is, that this library is constructed to be used without any separate glBindTexture()-calls. I'll have to find a workaround or write the texture rendering and texture loading from scratch. Might be the cleanest way anyhow. Hm.
 

begla

Project Founder and Lead Developer
Contributor
Architecture
Logistics
Okay. I've just pushed my take on animated clouds using Perlin Noise. This might become a bit funky on slow machines but it looks nice if you've got the horse power. The update interval can be tweaked in the config file to compensate this issue. This commit might also include the fix to your FBO problem, so you might want to take a look at it. :)
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Pulled latest to take a look at the clouds - they look nice, tho they seem to be almost boiling from the frequent updates. Which might also be why CPU went from 13% to 50-60% on my machine for just that one update :D
 

begla

Project Founder and Lead Developer
Contributor
Architecture
Logistics
Cervator said:
Pulled latest to take a look at the clouds - they look nice, tho they seem to be almost boiling from the frequent updates. Which might also be why CPU went from 13% to 50-60% on my machine for just that one update :D
I'll reduce the default update interval in the next update – but it is already an option in our config file! :p Try 200 ms or so.
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Yeah that helped, with 200ms CPU is just up 4-5% from normal, tho of course now the clouds look a little laggy. Alas, can't have it both ways! :)
 

Adeon

terasology.ru
Contributor
Architecture
GUI
Logistics
I have a 1 fps O_O(Intel i3-2330M, GeForce GT540M, Memory 3GB). Benjamin, please watch how I did the turbulence of the clouds in the shader (my old commits). I think the clouds should be calculated in the GPU. You use the plane for clouds. Try to use the stretched sector of a sphere. I gave up the idea of "realistic clouds" because a new idea came into my mind. Look, you used the 2d Perline noise transfared in binary image for the old clouds(512x512). I have the other idea - what if we used the 3d Perlin noise transfared binary image(512x512x8). Then we'll have "nice cumulus clouds" in conformity with the styleof blockmania. But this in future =)
 

begla

Project Founder and Lead Developer
Contributor
Architecture
Logistics
Adeon said:
I have a 1 fps O_O(Intel i3-2330M, GeForce GT540M, Memory 3GB). Benjamin, please watch how I did the turbulence of the clouds in the shader (my old commits). I think the clouds should be calculated in the GPU. You use the plane for clouds. Try to use the stretched sector of a sphere. I gave up the idea of "realistic clouds" because a new idea came into my mind. Look, you used the 2d Perline noise transfared in binary image for the old clouds(512x512). I have the other idea - what if we used the 3d Perlin noise transfared binary image(512x512x8). Then we'll have "nice cumulus clouds" in conformity with the styleof blockmania. But this in future =)
The problem is not the calculation itself. You are creating one texture and use it to for post-processing in a shader. I will do so later on using your approach as a template. :)

I'm currently just creating a 2D texture and painting it on a plane (as you said). This texture is regenerated using a background worker thread using the third dimension of our Perlin Noise function as a temporal offset. This allows me to create morphing clouds without changing anything. Looks really nice if you have top-notch hardware. Using this approach with your 3D noise approach to create shadows on the cloud I would need a 4D noise function which is becoming far too computational intensive for a game. Sadly.

I'll reduce the interval the background thread updates the 2D texture to reduce the overall load. This is currently killing the performance especially on mobile hardware. I'll extend the clouds later on using your approach as a template. Maybe even calculating the noise function in the shader. I'll see.

Thinking of... I could extend the chunk shader to darken the terrain if a cloud is above a certain area. Hm. :cool:
 
Top