Jump to content

Planar texture mapping


animats
 Share

You are about to reply to a thread that has been inactive for 729 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts


slscreenshot_192.thumb.png.f3e990a14e3cce6708f81c162364152b.png

Four cylinders with planar mapping.

Left to right, 1) Mesh, Blender-generated normals, 2) Mesh, uploader-generated normals, no UVs, 3) Mesh, uploader generated normals, Blender UVs. 4) Prim cylinder. Texture scales 1,1.

Planar mapping is somewhat obscure, and because I'm working on rendering, I need to understand how it's supposed to behave.

it turns out that UVs are totally ignored for planar mapping. It's the normals that matter. This sort of make sense. For a flat surface, you want the texture to map perpendicular to the flat surface. For curved surface, though, the effects are wierd.

One side effect is that there are objects in world with no UVs, or junk UVs. They have to be used in planar mapping mode. I have a mesh signboard like that. If you set it to default mapping, one pixel of the texture gets picked to fill the whole sign, instead of the texture being displayed.

I need to know the function you apply to a mesh coordinate and a normal to get a UV.

Anyone really understand this?

Link to comment
Share on other sites

3 minutes ago, animats said:

I need to know the function you apply to a mesh coordinate and a normal to get a UV.

Anyone really understand this?

I'm not sure if this helps but planar mapping is entirely client side so it's all hidden somewhere in the open source code.

Link to comment
Share on other sites

42 minutes ago, ChinRey said:

I'm not sure if this helps but planar mapping is entirely client side so it's all hidden somewhere in the open source code.

Right.

What has me puzzled is the vertical distortion of the texture. The normals on the cylinders are fine for lighting purposes. There's no vertical distortion.

Does anybody actually use planar UV mapping on non-flat surfaces?

Link to comment
Share on other sites

primcylplanarlodhigh.png.e4ee314e04e1d1761aa611f616fda9ab.png

Prim cylinder, planar mapping, highest LOD.

 

primcylplanarlodlow.png.d7eb0c1b06b41b7ebcdb3ab651e801af.png

Prim cylinder, planar mapping, lowest LOD. The low LOD is shown by setting Firestorm LOD factor to 0. (Which is why most of my avatar is gone.)

The cylinder has been reduced to 6 sides, which is normal prim behavior at low LOD. That worked fine.

The texture has flipped and torn. Now, that's totally wrong.

Planar mapping was apparently documented in SNOW-586, written by Patch Linden, but that's gone from the JIRA.

A 2008 video tutorial indicates that planar projection on non-flat surfaces is "funky", and shows similar distortions.

So, planar mapping for non-rectangular objects seems to be undefined behavior. In other words, don't try to do that, because it will render very strangely.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Elizabeth Jarvenen explained to me how planar mapping is supposed to work. She showed me how Substance Painter does it right. Here's a paper on the theory.

There's single planar mapping, which is like illuminating something with a projected pattern along one axis. That's how land textures work in SL, and it's why steep slopes look so bad. Then there's triaxial planar mapping, where the object is illuminated along all three axes, from both directions. That's hard to do and usually requires special shaders in the GPU.

So, is that feature actually used? Yes. I've found it twice in New Babbage.

triaxialprojectionbadcase.thumb.png.bcaadb59e55c0a174823b94808a6098d.png

Savory Street Market, Port Babbage. Across from the docks. Rendered with Animats renderer, not a standard viewer.

The bays on the facade use planar texture projection. The top, front, and sides of the bay are all one SL face. So this needs triaxial planar projection. Notice that the stonework texture is lines instead of stone blocks on the top and front side, but correct on the angled faces. This works in the LL renderer and Firestorm. I'm surprised that it does, after seeing what the LL renderer does with other hard cases.

My renderer only has single planar mapping, and that's not enough. I have to handle the hard cases. Still much to do, but getting there.

This doesn't come up often. The only other place I've seen it is the cockpit windows of the Albatross, the sky ship permanently parked above Babbage Palisade alongside the railroad track to The Fells. If you know of other places, please let me know, and I'll go look. Planar mapping tends to be used on large surfaces, so, when it's a problem, it shows.

In SL, we're used to looking at blur in close-up. Once that's fixed, as it is in my viewer, and textures go to high resolution before you get close enough to see blur, problems like this stand out more. (Is that fixed in the "performance viewer"?)

  • Like 2
Link to comment
Share on other sites

  • 4 weeks later...
3 hours ago, Jenna Huntsman said:

SNOW-586

Thanks!

Key line there: "The result is meaningful only if all the selected faces are on the same plane."  So I can stop worrying about the weird cases for curved surfaces. Planar mapping for non-flat faces doesn't seem to be very meaningful. Look at those cylinders above.

What I do is this:

  • Start with mesh. Separate triangles by their primary normal axis, X, Y, or Z, constructing 1 to 3 new meshes.
  • Give each of those meshes UVs appropriate for the axis they face.
  • Put resulting meshes into the main rendering system, which only handles meshes with UVs.

This gives consistent results. It looks like what you'd see if you had faraway light projectors aimed at a blank object from all six axis directions. It's not exactly the same as what LL does, but it's the same for all flat axis-aligned faces, which is what planar texture mapping is used for in practice. That wall at Savory Market now works.

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 729 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...