Jump to content

Curve Based Procedural Railway


Digistruct

Recommended Posts

Hey guys! 

I've recently started dabbling a bit in procedural modeling and making tools for creating assets. 
I just decided that I wanted to make a procedural railway as much from scratch as possible with looking as little as possible at tutorials and such, to test my way forward. 

But I have run into a problem I feel is slightly too big for me to try and find and the feature is far too important to just leave flawed. 

When I draw out the curve that is supposed to be the guideline for the railway I just figured I'd have a transform&merge to offset the other one, not thinking of the very obvious problem that this won't work if the railway starts bending. 

Any suggestions on what I could do? 

Thanks and have a great weekend! 

Jack

Link to comment
Share on other sites

Add a Polyframe SOP after resampling your curve. Set Entity to Points, and tick the Bitangent Name Box.

Add a PointWrangle SOP:

float amount = ch("Amount");

@P += -v@tangentv * amount;

 

Click on the Create Sparse Parameters icon, and offset your curve with the newly created "Amount" parameter.

Merge with original curve.

 

Link to comment
Share on other sites

Since I've already got this going I figure I might ask about the next issue that popped up! 

I used the same curves and a skin for base for he planks under the actual rails. 
It works fine except for when bending the curve since the facet -> primitive that drives them seem to work from a world orientation rather than per normal and therefore the planks melt together when the curve bends 90 degrees. 

Also, if any of you know of any good sources to learn about procedural modeling then I'd love to know about them. 

Thanks again! 

railwayMelt.JPG

Link to comment
Share on other sites

After the Polyframe, add an AttributeWrangle:

@N = v@tangentv;

 

And use this to copy your planks on with a Copy To Points SOP.

You can use a resample before copying to control how many planks you want (with the maximum segments parameter).

Make sure your planks (a box, I assume) are facing the Z axis (the long side should be parallel to the Z axis).

 

EDIT: Add a normal SOP after the copy, to get your normals back.

Edited by Ryuji
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...