Development: Profile Editor for MeshRoad
by Ryan Mounts · in Torque 3D Professional · 10/30/2009 (7:36 pm) · 20 replies
This is just a little development post of something I'm working on. I've been customizing MeshRoad for my project, so I have a pretty good grasp of it so far. There has been a feature request for a profile editor for MeshRoad which would allow the user to create a spline that would basically be lofted along the road, taking the place of the flat, vertical sides we have now. I need to do something similar for my project, so I thought maybe I'll just take a shot at a generic tool that would be useful for everyone. Then I can just use the generic code as a basis for my project-specific stuff. So here's where I'm at right now... I've added a Profile Edit Mode to the MeshRoadEditorGui that allows you to see a MeshRoad's side profile. You can add points to the profile by ctrl-clicking the line. You can delete points from the profile by alt-clicking an existing point. You can click points to select them. You can drag points to change the shape of the profile, and the MeshRoad updates in realtime so you instantly see your changes. You can also control the profile normals. Shift-clicking a point toggles between flat shading and smooth shading. There are a few more things to do, one of the main things being adding collision for the profile. The ends are also not capped at the moment, but that is pretty easy to do. So here's some pics showing a profile and its normals. The first one has all the points with flat shading. The second pic has all the points with smooth shading. Obviously the profile spline is drawn in yellow with yellow nodes, and the normals are drawn as red lines. And for those who are interested, I'd like to release this as a resource to the community soon.




#2
10/31/2009 (6:29 am)
this looks really cool; thumbs up!
#3
11/01/2009 (12:57 am)
This is great stuff! Way to dig in to the guts of the MeshRoad code.
#4
That looks fantastic Ryan! Its what we were considering doing, but did have the time to for 1.0.
Keep us up to date with your progress... if you have any questions or run into problems feel free to ask. James wrote the original code and i'm sure he'll be able to help you.
11/01/2009 (12:59 am)
Man... T3D users rule. This is why having C++ source access is so bad ass... you can extend stuff as you need it for your project.That looks fantastic Ryan! Its what we were considering doing, but did have the time to for 1.0.
Keep us up to date with your progress... if you have any questions or run into problems feel free to ask. James wrote the original code and i'm sure he'll be able to help you.
#5
11/01/2009 (3:07 am)
This IS great stuff. Yep, keep us posted, and you can contact me here or gchat or email.
#6
11/01/2009 (8:46 am)
This looks great, keep us all posted :)
#7
1. Collision
2. Sumbit actions to UndoManager
3. Save profile to mission file
11/02/2009 (1:36 pm)
I've had a chance to work on this some more this morning, and I got the end caps working. Still on the to-do list:1. Collision
2. Sumbit actions to UndoManager
3. Save profile to mission file
#8
11/02/2009 (1:41 pm)
Good stuff. Keep up the good work.
#9
11/03/2009 (6:58 am)
YEAH! Great work!! Thanks for sharing!
#10
11/03/2009 (11:47 am)
Got a little more done this morning... collisions are almost finished. In the pic, you can see Boombot standing on a fairly complex profile.
#11
Ryan you kick much @$$!! great work!
Can't wait to get my hands on this!
question: how are the materials controlled? it defined per segment or what?
11/03/2009 (1:25 pm)
yeah someone heard my plea!www.garagegames.com/community/forums/viewthread/95377Ryan you kick much @$$!! great work!
Can't wait to get my hands on this!
question: how are the materials controlled? it defined per segment or what?
#12
11/03/2009 (1:57 pm)
At the moment, the profile is just takes the place of the side, and therefore uses the Side Material for all segments. With the way the stock code is written, I think changing materials on a per-segment basis would require significant modification of the MeshRoad system. I can look into it, though.
#13
1. Update buildSegmentPolyList for decal geometry
2. Update ray cast code to hit new profile geometry
If anyone has any feature suggestions, let me know. I might try them and I might not. Per segment material control on the profile has already been suggested. I might put an angle snap feature to help square off corners and such.
11/03/2009 (8:03 pm)
Another quick update... Undo/redo functionality is complete, as well as saving to the mission file. Collisions are mostly complete. I say mostly because for some reason collisions are not working correctly on the two ends of the road. If he gets an opportunity, James is planning to take a look at the code to see if I goofed something up. Just a couple more things to go:1. Update buildSegmentPolyList for decal geometry
2. Update ray cast code to hit new profile geometry
If anyone has any feature suggestions, let me know. I might try them and I might not. Per segment material control on the profile has already been suggested. I might put an angle snap feature to help square off corners and such.
#14
11/04/2009 (6:29 pm)
Update... got collisions working on the two ends of the road. Added the ability to select multiple profile nodes and move/delete/smooth them all at once.
#15
11/05/2009 (6:21 pm)
Update... got buildSegmentPolyList() working so now decals appear on the profile, and got ray casts working so the 3rd person camera does not pass through the profile. I'm basically done. I'll look into adding a few more small "features", but since they are not necessary, I'll go ahead and release this if they start to take longer than anticipated. Here's a little pic of one use of the profile tool: tunnels!
#16
11/05/2009 (6:26 pm)
Looks pretty cool :-)
#17
11/05/2009 (6:44 pm)
Holy Crap. Awesome Ryan!
#18
11/05/2009 (7:14 pm)
so much for voxel terrain this will do just as good for making tunnels maybe even rocks and stuff. :P
#19
http://www.garagegames.com/community/forums/viewthread/105391
11/06/2009 (11:13 pm)
Just released the MeshRoad Profile Editor resource today...http://www.garagegames.com/community/forums/viewthread/105391
#20
http://www.garagegames.com/community/forums/viewthread/105391
11/09/2009 (3:42 pm)
Updated this resource today with the ability to toggle the profile materials on a per-segment basis between the Top, Side, and Bottom materials.http://www.garagegames.com/community/forums/viewthread/105391
Torque 3D Owner Akiraa
Thanks.