www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: shoka on January 24, 2003, 03:21:50 pm

Title: Wireframe or border rendering?
Post by: shoka on January 24, 2003, 03:21:50 pm
Hi..

First, I must confess that I'm _very_ impressed by what you have done here.. :)

I'm thinking of adapting the engine into a project of mine (effectively removing burden of downloading java plugin and j3d from average user), but ran into couple of problems when examining the apidocs.

The project is kind of a map viewer applet that is capable of displaying arbitrary statistics on specified areas (such as population versus age) and is designed to render borders and main routes such as roads, of these areas as the 'ground' on top of which the generated statistics 'float'.

Now the question: how could I render just polygon's edges (preferably with custom brush) with Object3D. In Java3D this is achieved by using LineStripGeometry and tuning RenderingAttributes, which produces the desired effect quite nicely.

Another nice-to-have feature would be using coloring for the poly, with edges in different color (this can of course be done by stacking to polys on top of each other)..

Hopefully I've presented the problem (un)clearly enough.. ;)

-shoka
Title: Wireframe or border rendering?
Post by: EgonOlsen on January 25, 2003, 05:51:48 pm
Hmmm...i have to think about this when i have a little more time, but i think that i understand what you are trying to achieve. Just one question: Would it help to draw the border into a texture, i.e. does the texture cover the polygon and ONLY the polygon that should show the outlines? I guess it doesn't, but i had to ask...that would make things easier.
Title: Wireframe or border rendering?
Post by: shoka on January 27, 2003, 08:58:25 am
I suppose it _could_ be possible to render the border and displayed data into a texture and then assign that to poly representing the area. But wouldn't that be quite expensive - after all that it should be achieved by using a 3D engine in the first place.. :)

Another thing I forgot to mention in the first post - propably because it's completely different topic - is continous picking. The user interface should employ some method of mouse tracking, with highlighting and additional information show when cursor hovers over certain object in the scene; this propably needs to be done by firing picking rays at certain intervals to see if something is available.

I'm a bit concerned by performance issues - in Java3D this took too long, at least with unoptimized code and large scenes, and degraded performance too much on not-so-high-end machines..
Title: Wireframe or border rendering?
Post by: EgonOlsen on January 27, 2003, 09:36:50 pm
Quote from: "shoka"
I suppose it _could_ be possible to render the border and displayed data into a texture and then assign that to poly representing the area. But wouldn't that be quite expensive - after all that it should be achieved by using a 3D engine in the first place.. :)


Sure...just a thought to use the TextureEffect for that somehow. I think the best solution for the time being would be to use an extra object that represents the outlines, attach it to the object to "highlight" as a child object and only set it visible if the object should be highlighted and invisible otherwise.

Quote from: "shoka"

Another thing I forgot to mention in the first post - propably because it's completely different topic - is continous picking. The user interface should employ some method of mouse tracking, with highlighting and additional information show when cursor hovers over certain object in the scene; this propably needs to be done by firing picking rays at certain intervals to see if something is available.

I'm a bit concerned by performance issues - in Java3D this took too long, at least with unoptimized code and large scenes, and degraded performance too much on not-so-high-end machines..


Shouldn't be that much of a problem. Picking in jPCT takes place in Camera-space (that's why the methods in Interact2D require the VisList), so only polygons on screen will be checked. Just try it...it should be fast enough.
Title: Wireframe or border rendering?
Post by: EgonOlsen on January 28, 2003, 12:17:32 am
Code for picking will look like this:

Code: [Select]

SimpleVector td=Interact2D.reproject2D3D(camera, framebuffer, mouseX, mouseY);
int[] res = Interact2D.pickPolygon(theWorld.getVisibilityList(),td);