Decreased quality when coding outside the Processing IDE

After many years with Processing IDE, I missed Intellij IDEA too much so I went back for it but Processing stays on :wink:

However, the shapes drawn are way less sharp than in the real PDE, for example, a simple circle is rendered differently using both time the latest version of Processing available 4.1.2, the same PC and the same monitor :

In PDE :

public void setup() {
    size(500, 500);
}


public void draw() {
    background(40);
    noStroke();
    fill(255);
    circle(width/2, height/2, 400);
    saveFrame("./PDE.png");
    noLoop();
}

and the result is :
PDE

In Intellij IDEA :

import processing.core.PApplet;

public class Main extends PApplet {

    public void settings() {
        size(500, 500);
    }


    public void draw() {
        background(40);
        noStroke();
        fill(255);
        circle(width/2, height/2, 400);
        saveFrame("Intellij IDEA.png");
        noLoop();
    }
    public static void main(String... args) {
        Main pt = new Main();
        PApplet.runSketch(new String[]{"testRendering"}, pt);
    }
}

and the result is :
PDE

When I save the frame it is exactly the same output, however, on the simulation, the circle looks like this :

The problem I am encoutering is only in the simulation so I guess it should be fixable but I need your help for it !

Hello,

Related:

In the Processing settings there is something to Disable HiDPI Scaling:

Also look into:

This is not a direct answer to your question but a starting point to explore this.

:)

If you are using the same code then both white circles are 100 pixels radius. If both IDEs are running on the same computer and using the same monitor how come the screen captured images are visually different sizes? Being ā€œcaptured by handā€ should not make a difference to the image sizes.

Are you using the same version of Processing with Intellij IDEA ?
Are you using P2D/P3D or the default renderer (JAVA2D)?

Perhaps you could post the entire sketch code since it is so short.

2 Likes

Thank you for your answer !
The problem I have is with Java not Python and it is in Intellij IDEA: my parameters of the Processing IDE seem to work since I want to get the same rendering with Intellij IDEA.

Iā€™ll look into pixelDensity(), thank you again !

Thank you for your answer, I have no idea why these images werenā€™t the same sizeā€¦

I have updated my post with your comments, it should be much clearer now !
I didnā€™t setup any renderer so I guess I am using the default oneā€¦

So you are using the same source code, renderer, computer and monitor which doesnā€™t leave much left.

I have zoomed in on your two images to compare the circle edges and got this

aa

Intellij is on the left and it is clear that the anti-aliasing is coarser than Processing and I can only think of two things

Pixel density
I think this is most unlikely but to test this try modifying setup to

public void setup() {
    size(500, 500);
    println(displayDensity());
}

If both programs return the same number then this is most unlikely to be the cause.

Anti-aliasing
Processing provides the smooth() function to control anti-aliasing so you might try that.

2 Likes

it is clear that the anti-aliasing is coarser than Processing

What is even weirder is that the anti-aliasing is bad only in the sketch real view, the saveFrame() outputs exactly the same well rendered circleā€¦

I tried both your ideas :

println(displayDensity()); // Outputs 1 so it isn't the problem
smooth(8) ;

in settings(), shows this in real view:

It doesnā€™t solve the anti-aliasing problem eitherā€¦

Hello @Grusat,

Your original pictures (now edited) looked similar to what I experienced with the Python modeā€¦ sometimes these issues can be related and help in finding a solution.

If you can send me a quick reference to get me up and running with Intellij IDEA and Processing 4.1.2 I will try this.

I installed IntelliJ IDEA Community Edition 2022.3.2

:)

2 Likes

Hi !

Inside your new Java Project, juste make Ctrl + Alt + Shift + S to go into the project structure.
You need to setup Java 17 as SDK (I have the coretto version) and add the core/library folder of your processing installation in the Libraries tab.

Once youā€™ve done the config, juste make your main class extends PApplet from processing.core
And you can copy paste my code.

For the run configuration : use Java 17 and put the name of your main class and you should be good to go !

Hello,

On my PC which has scalingā€¦

image

Processing 4.1.2 on left and IntelliJ on right:

I did manage to get the IntelliJ scaling in the bottom picture above to be cleaner after I played around with some settings discussed here:

https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000556364-IntelliJ-magnifies-after-computer-sleeps

https://youtrack.jetbrains.com/issue/JBR-427

I did wander off from the links above as well!

Summary:

  • I did manage to get the IntelliJ scaled output to be much cleaner.
  • I did not yet get scaling to be disabled! I may explore another dayā€¦

Have fun!

:)

2 Likes

Thank you for those links !
I also have 125% in Windows scaling. This explains the sizeā€™s difference I guess.

Can you be more specific with what youā€™ve done exactly to clean Intellijā€™s output ? Thatā€™s exactly what I am looking for !

Thank you :wink:

On my PC:

  • Properties of:
    D:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.3.2\bin\idea64.exe (your location will be different)
  • Compatibility Tab
  • Change high DPI settings
    See selections:

Some of the settings discussed in links may be for the IntelliJ IDE itself and not the output.

Note that I did a very quick look into this.

Have fun!

:)

1 Like

This works ! But it makes the font in Intellij completely blurryā€¦is it the case on your PC ?

Hello,

At my age everything is blurry!

No noticeable blurring here.

With High DPI scaling override:

image

Without High DPI scaling override:

image

Mind you I only changed properties and then started IntelliJ againā€¦ if a reboot changes anything I will let you know.

I did have this On:

:)

4 Likes

:joy:

No worry! Youā€™re not alone with this blurry view, mate!.. :wink:

Cheers
ā€” mnse

2 Likes

It is so weird, the difference is very big with my PCā€¦
Btw, where did you find the ā€œadvanced scaling settingsā€ in Windows ? I canā€™t find it (my Windows is in French so just searching it in the search bar isnā€™t workingā€¦).

The only thing I found was a drop down menu of different scalings : (in Settings/Screen)

and when I click the arrow on the right I get this page where I can type in personnalised scaling I want but no ā€œAdvanced tabā€ :

Thank you for your help on this, if I scale down from 125% to 100% everything works fine !
I will still try to look for a way to keep my Windows on 125% scaling, Intellij on 100% without blurriness (I am too young to accept this for nowā€¦maybe one day :wink: )

1 Like

Hi @Grusat,

You can follow here, but still need to adapt for french, though. :slight_smile:

Cheers
ā€” mnse

1 Like

Hi @mnse !

Thank your for the link, no problem for translating into french normally :wink:
Is it also available for Windows 11 ?

Hi @Grusat,

Probably similar, but I donā€™t know since I wasnā€™t willing to upgrade yet! :slight_smile:

Cheers
ā€” mnse

1 Like

Hello,

I came across this Processing issue which has many links to IntelliJ as well:

Some observations for my W10 Pro with 125% scaling:

Processing 3.5.4 in Java mode does not scale output
Processing 3.5.4 in Python mode does not scale output
Processing 4.1.2 in Java mode does not scale output
Processing 4.1.2 in Python mode does scale output

Output refers to sketch window.
I have not made notes on the UI being scaled as yet.

Understanding why the above behaves so may lead to a solution.
I donā€™t have an answer just yetā€¦ just a lot of research so far.

I do enjoy a challenge!

:)