Home Technical Talk

Blender Texture Coordinates, is this even possible?

Chrismartinartist
polycounter lvl 4
Offline / Send Message
Chrismartinartist polycounter lvl 4
[short version]
Hi all, not sure if this is even possible, but is there a way to keep the Texture Coordinates from a Procedural material, yet have them apply to a model using a different Texture Coordinates method? Possibly via Mixing or Math?

[long version]
I have a Procedural material which was made on a Plane using UV Texture Coordinates. If you change it to Object it doesn't work properly (patterns get all messed up etc.) Generated works to a degree, but is difficult to control for mapping (if I get the short side of the object correct, the long side is wrong and so on).

I'm now trying to use it on a 3d model that has UV's, however, the model and the material were not made with each other in mind. So the UV's for the model are not all facing the same direction as they were packed with a program ( I can't easily go in and rotate the UV's as this is the last part in a mostly baked model). I usually use Object Texture Coordinates for Procedural Texturing as it gives good even distribution.

Is there a way to retain the UV Texture Coordinates, while also applying them to the 3d model using Object Texture Coordinates?

It isn't the end of the world if I can't use this material here, I just wanted to know if this was possible. Thank you for any info.

Replies

  • Fabi_G
    Offline / Send Message
    Fabi_G high dynamic range
    Hi! You could try using a second UV set for the material, combining it with the textures using UV0. If you want to use just one set, Blender allows to bake textures from one UV set to another, so you could transfer your baked textures to a layout that works with your material as well.
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    My guess your issue is  with 2d patterns  like procedural brick texture   because  3d noises look same from any view directions.  

      For 2d patterns   a common way is to use so called tri-planar projection.   Blender doesn't have it  by default but it's either possible to find on blenderartist.org   or do it on your own:
       You make  3  projections of your 2d pattern   using object, world,  generated  or whatever space  . it's irrelevant .   2d will always stay 2d.   So you can have a brick nodes projecting its 2d texture along X, Y and Z  local  axis with a mask for each direction   based on dot product of  those axis and object surface normals.     So each sides is projected only where surface normals  look in X, Y or Z direction.     
    With extra power node after dot product you can control how abrupt  each side projection is fading .  

    Then you can bake tri-planar projected material in UV coordinates.     A disadvantage  is you will always see a bit blurry materials where one projection fades into another.   

    Also Chat GPT tells that you can pre-compute  each triangle UV rotation against  its world space  orientation  and assign as a face attribute to use then as a rotation compensation  input within a shader .  My guess you can try to persuade it to make such script .   Or do it yourself with geometry nodes .   But Chat is quite ok  with codding for  Blender, you should try .   You would probably have to precompute XY shift and scale if texel size is not same everywhere.

    Dot product is in vector math node, power is in math node  , UV rotation is in Mapping node.  Also with object  mapping  you can make a quad  and use it as mapping projector ( along its normal) so you can do not only tri-planar  projection but rather  as many as  you want planars projections not exactly projecting in XYZ axis  direction and working with normals based masks or for certain vertex groups or whatever attributes you store in geometry. By scaling those planes  you can also scale the projected texture.     

    Or  you can just repack UV islands in a necessary order you procedural shader works fine with manually   in another UV set    and bake it then into  original one.  My guess it's what  Fabi_G   suggested.  You need just to tell what UV target texture  ( selected texture node )  is going to use  and  do simple  surface bake ( not hires to low , just surface ) .
  • okidoki
    Offline / Send Message
    okidoki greentooth
    I now see this after answering the other.. simply: no.

    If you have a 2D texture then you can't simply pull this into 3D. It may work for example for some sand texture and you have somekind of sandheap.. but as mentioned: a brick texture changes if you "got into 3D" simply because the bricks are layed in some other pattern (except if you do use a simple grid.. but no brick layer would use this.. because of the structural integrity over "overlapping" bricks.. ).. 
    ..so you need some 3D-texure; a texture which is meant to be generated in 3D

    You may have a look at this 2D voronoi pattern using UVs and a real 3D voronoi pattern using 3D cooridnates..

Sign In or Register to comment.