2
$\begingroup$

enter image description here

enter image description here

enter image description here

FILE (less than 2 mb): https://drive.google.com/file/d/1WA3w3Ge7d9dcQu06PUIzS4RqcgHRcGqf/view?usp=sharing

I've created this road generator with geometry nodes that takes mesh lines and vertexes as input, then outputs this road. The number of lanes can be changed.

One thing I can't figure out is how to make the texture "even" everywhere. No matter what I do, it is reliant on each "leg" of the road structure. So as you can see in the first image, the short road segment has very short white dotted lines, while the longer road sections have sparse ones.

Any ideas how to do this? I tried to use Curve Resample node but couldn't get it to work. Tried multiple approaches, couldn't get any of them to work.

$\endgroup$
2
  • 1
    $\begingroup$ it might help if you "resample curve" after "mesh to curve" $\endgroup$
    – Chris
    Commented Jul 30, 2022 at 17:03
  • $\begingroup$ I tried resampling the curve, but at least personally, I couldn't get it to work. $\endgroup$
    – Aleksi
    Commented Jul 30, 2022 at 17:04

1 Answer 1

2
$\begingroup$

try this:

enter image description here

result:

enter image description here

GN modifier:

enter image description here

material:

enter image description here

Important is: multiply the factor with the length so that the texture is looking the same independent of the curve length. Capture attribute to save the uv coordinate in the group output, fill the variable in the modifier to use this in the shader nodes as uv coordinate. The two multiplayer nodes are just in there to finetune the uv coordinates that it looks good.

Note: you didn't pack resource before uploading your blend file so your road texture wasn't in your blend file. So i had to use another texture (i used checker so you can see it works)

UPDATE:

it is exactly the same principle:

enter image description here

result:

enter image description here

enter image description here

$\endgroup$
12
  • 1
    $\begingroup$ it is the same principle....i updated my answer. $\endgroup$
    – Chris
    Commented Jul 31, 2022 at 9:08
  • 1
    $\begingroup$ you forgot to name the attribute in your modifier. And check your node setup. They are not as i showed you in the solution. Try first exactly rebuild my solution. And check whether it works. Then try to modify it. Don't modify in the beginning because that's only frustrating if you don't understood it completely. $\endgroup$
    – Chris
    Commented Jul 31, 2022 at 9:15
  • 1
    $\begingroup$ that link is wrong, just delete it and name the attribute in your GN modifier [1]: i.sstatic.net/420zU.png $\endgroup$
    – Chris
    Commented Jul 31, 2022 at 9:19
  • 1
    $\begingroup$ in the modifier: [1]: i.sstatic.net/soN0O.png $\endgroup$
    – Chris
    Commented Jul 31, 2022 at 9:21
  • 1
    $\begingroup$ Enter the name of your attribute there $\endgroup$
    – Chris
    Commented Jul 31, 2022 at 9:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .