Sign in to follow this  

texture mapping on arbitrarily curved surface(or mesh)

This topic is 366 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

Don't know if that's what you're looking for but 3d texture mapping typically has 

 

f(x,y,z) = some color

 

you can use that for surface points or even points inside the mesh. As if the mesh was carved out of some material.

 

http://gamedev.stackexchange.com/questions/9668/what-are-3d-textures

Edited by teutoburger

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.

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

This topic is 366 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this