Hello, need help with off screen rendering

Hello. I am a total Java and jMonkeyEngine noob. I tried my best to find the answer on my own, but I failed. So I need help from you guys. Basically what I try to achieve is to render a model to offscreen and then save it to the image. I did that, my code is working. But the problem is that I need a better quality and I do not know or understand how to add anti-aliasing to my offscreen renderer. Here is my OffscreenRenderer class i use to render and save image Dropbox - File Deleted

Maybe you guys can look in to this and provide me with the code example.

I tried to do the same thing like in this post Offscreen Antialiasing - #3 by nehon
but it’s not working(I also did not fully understood it). So maybe someone can simply edit my OffscreenRenderer class for me? Thank you for your time reading this and helping me out. Thank you.

Did you try with:

app.start(Type.OffscreenSurface);

and then attaching a ScreenshotAppState or VideoRecorderAppState?

No and I do not think that I need to do that. This is my Main class Dropbox - File Deleted

Not an expert, but maybe such stuff could help:
offTex.setMinFilter(Texture.MinFilter.Trilinear);
offTex.setMagFilter(Texture.MagFilter.Bilinear);

Check the javadoc of Texture (Texture2D inherits from it)… it’s packed with info.

Thank you very much for your answer. Problem is that those docs are quite difficult to understand. As I said, I’m a beginner :slight_smile: So sometimes I simply do not know how to implement code I found on Internet :confused: Still thank you. I will look in to the javadoc of Texture.

look at this Test case

when creating your frame buffer, the last parameter is the number of samples you want. 2, 4 8 or 16.

Thank you for the answer, problem is that I already know that. And I tried that. But if I place more than 1, my image becomes empty… no model. Only 0 and 1 works. But those values means that anti aliasing is off… That is why I am searching for answer here.

ok, that’s probably because you have opengl below 3.0.
Before opengl 3.0 you had to copy your multi sampled frame buffer to a non multisampled frame buffer to be able to read the data.
So you actually need 2 frame buffers.
See the FilterPostProcessor code, there is a frameBufferMS variable that allows to handle multi sampling and it’s managed like that if you have a version bellow 3.0.

Yes, maybe this is the problem, but it is strange. I have a quite new laptop with second dedicated Nvidia video card. I read this before about using two frame buffers. And yesterday I looked in to the FilterPostProcessor code, I tried to implement it in to my OffscreenRenderer class, but without a luck.
Can you help me with that? Can you look in to my code at Dropbox - File Deleted and provide me with the example how exactly i need to implement this. I’m trying to solve this problem for 4 days now. I really appreciate your help guys.