Render only a part of a Geometry

Is it possible to render only one part of a geometry (sepcified as bounds). So it is possible to specify bounds for rendering?

For example:

I have a box with bounds (0,0 -> 10,10) and I just want to render the par of that box in the bounds (4,4-> 6,6). Is it possible?

Is It related to culling or something?

not simple , but possible

pass the bounds in uniforms to a custom shader,
in the vert shader pass the vert position to the frag.
if the coordiante in the frag is out of the bounds, dispose it (thats a actual instruction there)

1 Like

Keep in mind that this will still leave shapes as hollow, so you will not see it “fill in” where the bounds are reached.

Woaw! I’m pretty new to jme3 and not familiar with shaders… I will take a look but I hope I’ll find easier solution… Thanks anyway!

is there no predefined shader that does what i want?

It would be very easy to do with a custom mesh, but you must have a specific reason to want to show only a part of your box. Maybe you could explain in more detail what kind of functionality you need?

An alternative would be to use a texture map with alpha values, basically ‘painting the ends transparent’, but if it is not a dynamic rendering, a custom mesh is the way to go.


I’m currently designing a Foldable display Prototyping Tool. Foldable displays are created in 2D then rendered in 3D using Jmonkey.

For example a foldable display composed of two panes (a diptych) must render a user interface on the entire surface. In this example the global user interface is divided in two parts each one displaying a part of the UI. The situation is depicted above.

image here

I already have the foldable device working but now I want to display UI on it.
The way a thought about this is to have a UI composed of Windows, buttons, etc represented in 3D using thin 3D boxes. Each pannel (screen) would have an instance of the full UI but would only show one part of it. It’s here that I would use the functionality of displaying only one part of a shape.

If I used Unit3D pro I would have use render texture functionality but I dont think it’s possible in JME3…

I don’t know if it’s the best way to do it but at least it’s an idea.

JME has render to texture.

Please try to read the docu vefore making assumptions :slight_smile:

1 Like

…and nifty already has a texture renderer, theres even an example. :roll:

Ho sorry I havn’t checked that before… Jmonkey is definitely a good engine ^^

Okay render to texture works well.

But I have a pretty straightforward question but I can’t find informations about that in forum a tutos: How can I simply move the texture coordinates of a texture?

I used geom.getMesh().scaleTextureCoordinates() to scale the texture but I don’t know how to place the texture at the desired location on a geometry.

Is the Texture atlas is needed in this case?

Thanks in advance.

Get the texcoord1 buffer from the mesh, and update that.

okay thanks I found this and with little modifications a managed to move my texture by x,y offset.

Also, the source code for everything is available in only a few clicks. So if scaleTextureCoordinates() almost did what you wanted it was a good place to look to see how you could write your own that did exactly what you wanted.

It’s frustrating sometimes how many users stop right at the API when going one step further would answer their question.