Project 2D scene onto mesh as pixel perfect texture

I want to draw 2d lines onto a mesh as a texture, but they should be crisp at any zoom level, not an interpolated bitmap. Any ideas how to do that with Babylon js?

I swear I saw somewhere in the documentation a special material class to project one scene perfectly onto a mesh of another scene, as you would need for UI, but I can’t find it anymore. DynamicTexture is a pixelated pre-rendered texture; that’s not what I’m looking for.

I suppose it would be implemented by a kind of deferred rendering of the mesh (uv coordinates) first offscreen and then shading the dynamic texture at “infinite precision” for the visible pixels of the mesh, rather than rendering the texture first and using a texture lookup shader.

This would be really tough to do with regular textures and uv mapping. You would probably need a special kind of material drawn in screen space.but it would anyway look jumpy when drawn accross screen pixels.

I wonder how the new line mesh system from @roland might help ?

1 Like

Thanks, mesh lines look great and quite like what I could use, I will look into it further.

Ideally I would be able to drape lines and curves onto a terrain, without z-fighting or interpolated texture. I have some ideas for that but perhaps this wheel is already invented for BabylonJS.

looks like you might wanna have a look at Grid Material | Babylon.js Documentation as well