Lines narrow as you move toward them

HI all,

I’ve always noticed this issue with jme3 but it hasnt been something thats bothered me too much. I just thought I’d raise it here for

completeness :slight_smile:



I have an application that generates Lines using Lim, YongHoon’s Line class which I found in here somewhere ages ago.

[java]/**

  • Line

    *
  • @author Lim, YongHoon

    *

    */

    public class Line extends Mesh {



    /**
  • Create single line with start/end point

    *
  • @param start
  •        start poisition<br />
    
  • @param end
  •        end position<br />
    

*/

public Line(Vector3f start, Vector3f end) {

this(Mode.Lines, new Vector3f[] { start, end });

}



/**

  • Create lines

    *
  • @param mode
  •        Mode.Lines, Mode.LineLoop, Mode.LineStrip<br />
    
  • @param points
  •        line points<br />
    

*/

public Line(Mode mode, Vector3f… points) {

FloatBuffer data = BufferUtils.createFloatBuffer(points);

VertexBuffer vpb = new VertexBuffer(Type.Position);

vpb.setupData(Usage.Static, 3, Format.Float, data);



setBuffer(vpb);

setMode(mode);



updateBound();

updateCounts();

}

}[/java]



I’m assigning the Line to a geometry like this:

[java]

Geometry geom = new Geometry(name, mesh);

Material mat = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);

mat.setColor(“m_Color”, color);

mat.setColor(“m_GlowColor”, color);

mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);

geom.setMaterial(mat);

[/java]



my problem is that once assigned to a geometry and rendered, then as I move the camera toward these lines, they grow and scale properly lengthwise, but their width appears to visually narrow.



any thoughts?

Cheers

A line only has one dimension :wink:

well 2 dimensions (it has width), but so does a quad, and it grows as you move toward it. So I assume I need to change the mesh I’m using somehow? perhaps use a cylinder instead? how would I do that and still use LineMode lineStrip? would it still work?

I have two options in mind.

  1. If it is fixed in the screen.

    geom.setQueueBucket(Bucket.Gui)
  2. change line width according to the camera distance
normen said:
http://en.wikipedia.org/wiki/Line_(geometry)


this is just obnoxious and incredibly unhelpful, these jme lines have width too!
mulova said:
I have two options in mind.
1) If it is fixed in the screen.
geom.setQueueBucket(Bucket.Gui)
2) change line width accoring to the camera distance


thanks for the ideas,
my lines arent fixed in the screen so option 1 wont help, the effect I want is of a flat bar (linestrip style, its a crooked line) that I can lay on the ground, but it should scale and look like an ordinary part of the scene. line's as I'm trying above do not, but I'm not sure how else to create the effect I want.

The jme lines dont have width, they would get bigger then when you get close if they had. A line has per definition no width, of course it has to be at least 1pixel wide to see it on a computer screen but it makes no sense why it should get thicker when you get close.

I understand that, and I’ve said as much. So I’m asking for advice on how best to acheive what I want, will any mesh work the way I want with Mode=linestrip?

No, you will have to not use lines, use 3 dimensional objects.