How to generate usable texture uv along a line

   6717   16   2
User Avatar
Member
125 posts
Joined: April 2014
Offline
I thought this would be easy, ha

Could someone explain or point me to a reference on what kind of uv values I should create in order to render a texture along a line.

If I have no uv all, I get ok results but I need to control the uv settings based on the length of the line.
Everything I have tried results in a streaked texture across the surface of the line.

(btw where is the uv info coming from if there are no uv on the points?)


My assumption is that between two points the uv.x would span between 0 and 1, however what should the uv.Y or uv.Z value be?
whatever I put in there I still get a streaked image of what I assume is a single pixel stretched across the surface.

any suggestions much appreciated.

jeff
User Avatar
Member
125 posts
Joined: April 2014
Offline
I have found this previous post which describes exactly the same issue I am having and provides a visual example.

However my level of knowledge is not sufficient to follow this on how to come to a solution -
“ just connect the t input of the vex texture node and let mantra use its own space going from 0 to 1 for the s coordinate”


https://sidefx.com/forum/topic/11795/ [sidefx.com]
User Avatar
Member
125 posts
Joined: April 2014
Offline
somehow posting a question almost always leads me to finding the answer on my own.

I seem to get this to work by indeed plugging a ucoords node into the shader.

Note that the “mode” needs to be set to “Primitive coordinates s,t” see pic

Attachments:
ut.PNG (38.9 KB)

User Avatar
Member
253 posts
Joined: July 2006
Offline
If you want explicit uvs, append a uv texture sop, texture type Rows and Columns.
User Avatar
Member
125 posts
Joined: April 2014
Offline
I must be doing something wrong because every time I try to generate uv on a line I get a stretched image look when rendering.

Per my earlier post putting the s and t values in to uv at the shader level will render the image correctly but I have no control over the values in s,t that I can tell. It just seems to bypass the uv settings I have done.

If not clear I am looking for a way to generate uniform length (uv) over the length of the line so that all of the textures maintain the same scaling along the length of the line no matter how long.

Jeff
User Avatar
Member
125 posts
Joined: April 2014
Offline
thanks A-OC but as I mentioned previously this does not seem to work when I do it.
User Avatar
Member
253 posts
Joined: July 2006
Offline
If you post a sample hip file I'm pretty sure I could fix it. You might need to resample and transfer back the u attribute or just use the resampled curve.
User Avatar
Member
125 posts
Joined: April 2014
Offline
of course!
thanks for your time

I thought about using the resample and that will work as long as my texture can span along the single segments and no uv's but I need to apply a long texture across potentially several points depending on how the object is built.

Frustrating thing is that I cant seem to get past setting a uv attribute without creating a distorted texture. I included some pics as well as the scene.

Attachments:
uv_setAsRowColumn.PNG (59.1 KB)

User Avatar
Member
125 posts
Joined: April 2014
Offline
and the rest of the stuff I promised…

Attachments:
no_uv.PNG (542.3 KB)
source_lines.PNG (14.5 KB)
linetexture.hip (327.3 KB)

User Avatar
Member
125 posts
Joined: April 2014
Offline
apologies as I learn the ropes here, if the filenames aren't visible the images may need some explanation.

Image 1 - Line with uv added, texture streaks
Image 2 - Line with no uv, texture stretching based on line segment length.
IMage 3 - Source line showing different length segments.

Again all I am trying to do here is to find a way to add a consistent texture size across the entire line regardless of point positions or segment lengths.
User Avatar
Member
7770 posts
Joined: Sept. 2011
Online
The only way I have found is to force all the segments to be the same length using the resample node. The uvtexture node has options for various types of uv parameterization, ‘arclength spline’, ‘uniform spline’, etc. None of these modes seemed to take the cake for me either.
User Avatar
Member
253 posts
Joined: July 2006
Offline
Is this what you needed ?

Attachments:
picline.jpg (34.9 KB)
linetexture_c.hipnc (360.3 KB)

User Avatar
Member
125 posts
Joined: April 2014
Offline
thanks for doing that but it is not what I am looking for. This result is actually what I am trying to find a way to avoid.

the texture projection is not correctly rendered (at least to my expectations/hope) it seems to be streaking in that only the top row of pixels across the surface of the line.

If you turn off the uvtexture node in my scene it will render the pattern correctly or view the referenced texture in the material.
User Avatar
Member
125 posts
Joined: April 2014
Offline
tha
jsmack
The only way I have found is to force all the segments to be the same length using the resample node. The uvtexture node has options for various types of uv parameterization, ‘arclength spline’, ‘uniform spline’, etc. None of these modes seemed to take the cake for me either.

thanks jsmack, this of reflects where I am with it as well
User Avatar
Member
253 posts
Joined: July 2006
Offline
One of these 2 ?

Attachments:
picline_b.jpg (68.2 KB)
picline_c.jpg (65.1 KB)
linetexture_d.hipnc (357.5 KB)

User Avatar
Member
125 posts
Joined: April 2014
Offline
thank you!, yes the second one. it took me a bit to find why this worked then I looked at the shader.
Jeff
User Avatar
Member
125 posts
Joined: April 2014
Offline
gotta say thanks again for this. It makes perfect sense now that I see it but I am not sure I would have ever found this solution
  • Quick Links