Render textures on the fly

Hi everyone,

I’m working on a little side-project right now and I’ve come across an issue that’s best illustrated with an image:

The taxiways are all custom meshes. The straight parts are easy to do and so is the texturing. But the crossings bear no markings yet since amount, angle and width of the segments ending in the rendered node may vary greatly. Therefore the markings (centerlines, labels and all kinds of other markings) probably have to be generated on the fly. Players might even be able to define rules for the crossings some day, so the markings might have to be updated/changes later on.

Is there a recommended approach to doing this?

That’s basically what I anticipated :slight_smile:

Therefore my question is more or less of technical nature: How do I use textures in JME that are not loaded from a file but rendered on the fly?

Since I know right about nothing about Shaders right now I’d prefer to go a route that doesn’t require them.

I’ve used nifty to create textures before, don’t think it would help in your case though.

You can use voronoi generation to find the center line of a mesh. You might have to “densify” it by adding more points along the edge of the polygons to get a better representation of the center line.

I don’t know if anyone has a better way but a simple way would be to define a texture for the yellow lines and one for the grey (or rather bits of the same texture). Then add extra vertices to your model and you can put “edge” textures around the edges, “line” textures down the center and join them all up with the concrete texture.

So the line becomes:






(.=vertex, | = line, # = concrete).

Note that there might be a lot more different markings than just the centerline, so I’d prefer not to start building every decal as its own polygon. This would probably cause clipping errors anyhow, right?

Have a look at this to get an idea of what I mean:

The voronoi will give you a center line graph that you can use to draw the lines however you wish, or use it to render the lines in the shader. They can then be dotted lines, solid lines, however you wish. For other lines, you might have to write a tool that allows you to draw splines and then have them rendered the same way you would draw the center lines.

Sounds like you are going to need to build yourself some textures programmatically…or write a custom shader…

I think I’ve found the answer I was looking for in this thread:

You could draw an extra mesh just for the taxiways as a seperate layer above the roads. Or use blendind of textures to create one. Otherwise I would use lines if users should be able to create the taxiways themself. And a remark, taxiways do not always go through the center of a junction espacially on y junctions:-) When doing it procedurally I would draw bezier lines connecting taxi path centers a junction.