Jump to content
  • Advertisement
Sign in to follow this  
qxsl2000

texture mapping on arbitrarily curved surface(or mesh)

This topic is 578 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,guys. is there some texture mapping tech taking account of  vertices of curved mesh as input  to calculate it's uv coordinate with respect to the z component, and even angle viewed from, instead of generalized uv mapping as usual,

just like f(x,y,z)==>(u,v),which the function results in uv output with respect to it's perspective.   hope your guys give me some hints.thank you!

Edited by qxsl2000

Share this post


Link to post
Share on other sites
Advertisement

I dimly remember reading about some old school technique, can't think of the words to google for it now. Basically, imagine a simple top-down mapping on the Y plane, looks great on flat floors, stretches horribly on your vertical walls. Now, imagine the same for the X plane and the Z plane, you now have 3 sets of UV mappings, each of which look terrible on certain surfaces, but OK on others. Now, in your fragment shader, you take all 3 samples and blend between them, picking blend factors that avoid letting the horrific stretching being too visible.

 

As I say, I can't remember what it's called, so can't find an article about it, and I'm not convinced it'll look particularly good, but it wouldn't be very hard to prototype if you don't have any better options.

Share this post


Link to post
Share on other sites

I dimly remember reading about some old school technique, can't think of the words to google for it now. Basically, imagine a simple top-down mapping on the Y plane, looks great on flat floors, stretches horribly on your vertical walls. Now, imagine the same for the X plane and the Z plane, you now have 3 sets of UV mappings, each of which look terrible on certain surfaces, but OK on others. Now, in your fragment shader, you take all 3 samples and blend between them, picking blend factors that avoid letting the horrific stretching being too visible.

 

As I say, I can't remember what it's called, so can't find an article about it, and I'm not convinced it'll look particularly good, but it wouldn't be very hard to prototype if you don't have any better options.

This may be 'Triplanar mapping.'

https://gamedevelopment.tutsplus.com/articles/use-tri-planar-texture-mapping-for-better-terrain--gamedev-13821

 

I just took this screenshot in 3d paint to show triplanar. You get a good mapping when aligned with the 3 axes (front, side, top) but between you get a blend, which can look bad with some textures but not so bad with other less patterny textures.

 

triplanar2_zpsehe08umw.jpg

 

The best answer may depend on what you are using it for. Some possibilities aside from usual uv unwrapping and procedural texturing are 'ptex':

http://ptex.us/

 

Or lightmap type packing, where you don't share uvs between triangles. In this case you can just orientate your uv coords exactly to the 3d triangle plane, and you have to orientate it to get it to pack decently onto a uv map. But there may be other issues to deal with, such as bleedover at the side of triangles from texture filtering / mipmapping, which standard uv unwrapping islands mostly deals with automagically.

Share this post


Link to post
Share on other sites

 

I dimly remember reading about some old school technique, can't think of the words to google for it now. Basically, imagine a simple top-down mapping on the Y plane, looks great on flat floors, stretches horribly on your vertical walls. Now, imagine the same for the X plane and the Z plane, you now have 3 sets of UV mappings, each of which look terrible on certain surfaces, but OK on others. Now, in your fragment shader, you take all 3 samples and blend between them, picking blend factors that avoid letting the horrific stretching being too visible.

 

As I say, I can't remember what it's called, so can't find an article about it, and I'm not convinced it'll look particularly good, but it wouldn't be very hard to prototype if you don't have any better options.

This may be 'Triplanar mapping.'

https://gamedevelopment.tutsplus.com/articles/use-tri-planar-texture-mapping-for-better-terrain--gamedev-13821

 

I just took this screenshot in 3d paint to show triplanar. You get a good mapping when aligned with the 3 axes (front, side, top) but between you get a blend, which can look bad with some textures but not so bad with other less patterny textures.

 

triplanar2_zpsehe08umw.jpg

 

The best answer may depend on what you are using it for. Some possibilities aside from usual uv unwrapping and procedural texturing are 'ptex':

http://ptex.us/

 

Or lightmap type packing, where you don't share uvs between triangles. In this case you can just orientate your uv coords exactly to the 3d triangle plane, and you have to orientate it to get it to pack decently onto a uv map. But there may be other issues to deal with, such as bleedover at the side of triangles from texture filtering / mipmapping, which standard uv unwrapping islands mostly deals with automagically.

 

 

 

yes, thank your patience and reply, i think it's indeed what i'm looking for.but as what you said, some flaws inside it. could you explain in detail. thank you.

 

Edited by qxsl2000

Share this post


Link to post
Share on other sites

yes, thank your patience and reply, i think it's indeed what i'm looking for.but as what you said, some flaws inside it. could you explain in detail. thank you.

Sorry, I'm not clear which method you are referring to here :blink: .. if you mean triplanar mapping, the linked article gives a good explanation, or google will reveal some. :)

 

https://gamedevelopment.tutsplus.com/articles/use-tri-planar-texture-mapping-for-better-terrain--gamedev-13821

http://www.martinpalko.com/triplanar-mapping/

https://www.volume-gfx.com/volume-rendering/triplanar-texturing/

 

etc etc.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!