jMonkeyEngine / jMonkeyEngine/jmonkeyengine
point sprites render smaller with MSAA samples=16 than with other settings
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 14
Description
I recently noticed that Points-mode meshes render differently when the app is configured for 16 samples-per-pixel than when it is configured for 2, 4, 6, or 8 samples-per-pixel.
When the test app (below) is run in a 640x480 window with anti-aliasing disabled, the points p1 and p2 render as barely-touching white squares. Likewise with 2-, 4-, 6-, or 8-sample anti-aliasing. But with 16 samples, the points render as squares about half as large, so that there is a noticeable gap between them.
I doubt this relates to my GPU's maximum point sprite size, since doubling the PointSize in the mesh causes the squares to touch with 16-sample anti-aliasing.
I discovered this issue in JME version 3.2.1-stable and verified that it also occurs with 3.2.0-stable.
package mygame;
import com.jme3.app.SimpleApplication;
import com.jme3.font.BitmapText;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Geometry;
import com.jme3.scene.Mesh;
import com.jme3.scene.VertexBuffer;
import com.jme3.util.BufferUtils;
import java.nio.FloatBuffer;
public class Main extends SimpleApplication {
class PointMesh extends Mesh {
PointMesh() {
FloatBuffer fPos = BufferUtils.createFloatBuffer(3);
fPos.put(0f).put(0f).put(0f);
fPos.flip();
VertexBuffer vPos = new VertexBuffer(VertexBuffer.Type.Position);
vPos.setupData(VertexBuffer.Usage.Stream, 3, VertexBuffer.Format.Float, fPos);
setBuffer(vPos);
setMode(Mesh.Mode.Points);
updateBound();
}
}
public static void main(String[] args) {
Main app = new Main();
app.start();
}
@Override
public void simpleInitApp() {
flyCam.setEnabled(false);
Material white6 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
white6.setColor("Color", ColorRGBA.White);
white6.setFloat("PointSize", 6f);
Mesh mesh = new PointMesh();
Geometry p1 = new Geometry("p1", mesh);
p1.setMaterial(white6);
rootNode.attachChild(p1);
Geometry p2 = new Geometry("p2", mesh);
p2.setMaterial(white6);
p2.setLocalTranslation(0.1f, 0.1f, 0f);
rootNode.attachChild(p2);
int samples = settings.getSamples();
int height = cam.getHeight();
int width = cam.getWidth();
float pointSize = (Float) white6.getParam("PointSize").getValue();
BitmapText text = new BitmapText(guiFont, false);
String message = String.format(
"Samples=%d Height=%d Width=%d PointSize=%.0f",
samples, height, width, pointSize);
text.setText(message);
float centerX = (width - text.getLineWidth()) / 2;
text.setLocalTranslation(centerX, height, 0f);
guiNode.attachChild(text);
}
}
INFO: OpenGL Renderer Information
- Vendor: NVIDIA Corporation
- Renderer: GeForce GT 545/PCIe/SSE2
- OpenGL Version: 4.6.0 NVIDIA 388.73
- GLSL Version: 4.60 NVIDIA
- Profile: Compatibility
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied Java reproducer in Main and run it at 640x480 with anti-aliasing set to disabled, 2, 4, 6, 8, and 16 samples. Compare the spacing and apparent size of the two point sprites; no repository file or test is named, so completion would require locating the rendering path and verifying consistent point-sprite sizing across these settings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100