Welcome, Guest. Please login or register.

Author Topic: How to Make Surf Ramps in Blender  (Read 11969 times)

Offline Kompile

  • Newbie
  • *
  • Posts: 44
    • View Profile
How to Make Surf Ramps in Blender
« on: April 24, 2014, 03:42:27 PM »
How to Make Surf Ramps in Blender

This tutorial will teach you how to make a fairly simple 90 degree wedge-shaped ramp, like this one.



Resources:

I would suggest learning the basic functionality of Blender before attempting to make surf ramps. Here are some sites I used to learn the basics; with my limited modeling experience I found them to be very useful.

Blender 3D: Nood to Pro (http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro)

Blender Manual (http://wiki.blender.org/index.php/Doc:2.6/Manual)

Downloads:

This is what you will need to complete this tutorial; I have included some example files which we will use later.

Blender (http://www.blender.org/download/)

Blender Source Tools (http://steamreview.org/BlenderSourceTools/)

Example Files (https://www.dropbox.com/s/lpiqm88ccq1omj6/Example%20Files.7z)

Instructions on how to install the Blender Source Tools are available on the site.

Steps:

1: Blender Configuration

2: Creating the Body

3: UV Mapping

4: Collision Model

5: Exporting

6: Compiling

7: Conclusion




1: Blender Configuration

Before we get started, we need to change some settings in Blender to make modeling big objects easier.

In the 3D View, press N to bring up the Properties panel. Then under the View sub-section, edit the End value to something large like 99999. This will help us see more of the model in the 3D View.



Then use SHIFT + RMB to select the Cube, Camera and Lamp. Delete these as they will just get in the way.

Now, Press SHIFT + TAB to enable snapping.

Before starting, it might also be helpful to know the View Selected key which defaults to NUM. this centers the 3D View on the objects currently selected. I personally change this to a thumb button as it makes navigating the 3D View a lot quicker.

If you haven’t already done so, now would be a good time to install the Blender Source Tools.

With Blender configured, press CTRL + U to set this as the default.

2: Creating the Body

The body will be the visible part of our ramp; this is separate from the collision model.

Our first step is to make a triangular face. This face will be the start of our ramp.

Press SHIFT + A to bring up the Add menu, then click Mesh > Plane.



Next we need to resize and rotate this plane using the Transform sub-section in the Properties panel.

Change the Y Rotation value to 90, the Dimensions X value to 640 and the Y value to 512.



Now we need to make this into a triangle, to do this we simply go into Edit Mode by pressing TAB, now use RMB to select to bottom right vertex, then hold SHIFT and select the top right vertex.



Now finally, we Press ALT + M, Merge > At First. And you should now have this.



With our new triangle face created, we now need to apply the Spin tool to it. In Edit Mode select all the vertices by pressing A. Now in the Transform sub-section of the Tools bar press Spin.



Now we can edit the Spin sub-section in the lower left to get our desired result.

Change the Steps value by 16; this increases the smoothness of our ramp.

Change the Angle to 90 degrees; this will be the angle of our ramp.

Change the Y Center value to 2816; this is the center of rotation for the spin.

And finally, change the Z Axis value to 1 and the X Y values to 0; this is the axis our spin will run along.

You’re object should now look like this.



Now we're going to change the origin of our new object, the origin is the point of rotation in hammer and also the point at which light is sampled from. To do this we must first move our 3D Cursor to where we would like our new origin.

In Object Mode navigate to the 3D Cursor sub-section of the Properties panel and change the Y value to 2816 and the Z value to -320. Your 3D Cursor should now be located here.



To set this point as our new origin we press Object > Transform > Origin to 3D Cursor.



Our next step is to flip the faces of our object. They were created pointing into the ramp and not outward as we would like, so, in Edit Mode, select all the faces and then press CTRL + N to Recalculate Normals. You should notice the ramp change brightness.



Important Step:

We can use the object we’ve just made as the basis for our collision model later in the tutorial.

Return to Object Mode (TAB) and select our new ramp. Press SHIFT + D to duplicate it, RMB to deselect it and finally M to move the object into layer 2.



Press number 1 to make sure you've switched back to layer 1 before continuing.

Next we need to set the faces to be smooth; this will improve the way lighting is cast on the ramp. Select the ramp, go into Edit Mode and press the Face select button.



Next, select all the faces on the front side and press CTRL + F > Shade Smooth.



With the faces smoothed we then press Y which splits the faces away from the others. If you don't split the faces the lighting will look weird.

Do this on front and back of the ramp. The underside and triangular faces can remain flat shaded.

3: UV Mapping

Now that we've made the body we need to make the UV maps, these tell the model how to align our textures. For the purpose of this tutorial we will be making a fairly basic UV map.
 
Firstly, we need to make a new viewport; this will be where we edit our UV maps. To do this we simply drag this corner of the 3D View into the centre.



As you can see we now have 2 viewports side by side. We won't be using the extra panels so press T and N to remove them.

Next, use this button in the lower left to change the viewport to UV/Image Editor.



Now we need to create our UV maps, in Edit Mode select all the faces of our ramp and press U > Reset to create the UVs.



Now we need to use a reference texture to help us edit our UVs more easily, I have provided one in the Example Files for this tutorial.

With all the faces selected press Image > Open Image from the lower toolbar of the UV View and open test.jpg from the Example Files folder. This texture will help us align our UVs correctly.



In order to see the texture we've just opened, we must check Textured Solid from the shading sub-section of the Properties panel in the 3D View. You should now see the texture being displayed on the model.



As you can see, the UV maps are incorrectly aligned so we need to fix them. In Edit Mode select all the faces on the front of our model.
 


These UV maps are upside down so we have to rotate them by 180 degrees. With the faces selected, press R in the UV View to Rotate them. Repeat this process for the other sides of the ramp and you should end up with this.



You may have noticed one, or both of the triangular UVs is messed up, to fix this you need to mirror it along either the X or Y axis.



Then, in this example, we have to grab the top right UV vertex and press G to translate it down to the lower right.



You may need to do this another way depending on how the UV map is aligned, just make sure you move the vertices to different corners until you get this.



Now that our UVs are the right way up we need to replace our image. In the UV View, select Image > Replace Image and open ramp_test.jpg from the Example Files folder.

You will notice the texture appears to be slightly squished; this is because the UV maps are too big. To fix this we need to split the UV in half. Start by selecting the first face of our ramp and then subsequently every other face like so.



Now we can edit all of these UVs simultaneously to save a bit of time. With these faces selected go to the UV View and press A to deselect the UVs, now press B and box select the right side vertices like this.



Press G to move these vertices inwards.



Repeat this process for the faces we didn't select but move the UVs in the other direction.



And now repeat this process again on the other sides of the ramp. You should end up with UV maps which look like this.



4: Collision Model

Our next step is to create the collision model; this is the part of the ramp that players will actually surf on.

Before we get started, you may want to remove the UV View and also uncheck Texture Solid from the shading sub-section.

To save time we can use the copy we made earlier. First, in Object Mode change to layer 2 by pressing 2. Make sure you're on the correct layer otherwise you'll end up editing the body by mistake.



If we were to compile this model now our collision mesh would look like this.



Obviously we can't surf on this so we need to make the collision model more complex. To do this we need to separate the ramp into its various sections and then create more faces in-between them.

To do this, go into Edit Mode and select the four faces of the first section, like so.



Now do the same for the remaining sections but with gaps in-between.



Once you have the sections selected like this, press P > Selection to make it into a separate object.

You should now have 2 objects side by side like this.



Now we need to create new faces in-between these objects to separate them from each other.

Select the first object, switch to Edit Mode, select all the faces and then press F. Do this for both objects and you should be able to see the new faces peaking through the ramp.



Now that we've sealed both these objects, select them and merge them together by pressing CTRL + J.

Finally, in Edit Mode, with all the faces selected press CTRL + F > Shade Smooth and you should end up with something like this.



5: Exporting

Now that we've created all the parts of our model we need to name them, add a material and export them. Since we made the collision model last, we will start there.

With our collision model selected, click the Object button in the Properties panel and name it turn_90_phys.



Now do the same for our body by switching to layer 1 and naming it turn_90.



Now we need to add a material to our body, click the Material button in the Properties panel and then click New.

The name of this material needs to be the same as the VTF texture we will be using, the VTF provided in the Example Files is named ramp so in this case we name the material, ramp. We only need to add a material to our body, as this is the visible part of our model.



Finally, in the same panel click the Scene button and navigate to the Source Engine Export sub-section. If you can't find this you've probably installed the add-on incorrectly.

The Export Path is where our SMD files will be output to, create a new folder on your desktop called turn_90 and set it as the Export Path.

Change Export Format to SMD and Engine Path to where studiomdl.exe is located for the game you're using. I will be using TF2 and so the engine path would be.

C:\Program Files (x86)\Steam\steamapps\common\Team Fortress 2\bin

Now press Export > Scene export (2 files).



You should get a warning about not having materials assigned. You can ignore this or just add a material to the collision model if you’re worried.

Now check the turn_90 folder and you should see turn_90.smd and turn_90_phys.smd

6: Compiling

Our next step is to compile our SMDs using studiomdl, first off we need to have a QC file. This tells studiomdl how to compile our model.

To learn more about QC files visit https://developer.valvesoftware.com/wiki/Compiling_a_model

I have provided an example QC file in the download for this tutorial, copy this over to our turn_90 folder which should now contain our SMDs and QC file.

Use Notepad to open the example QC file.

$modelname, is the directory our model will be compiled to. This folder is created automatically.

C:\Program Files (x86)\Steam\steamapps\common\Team Fortress 2\tf\models\surf_ramps

$cdmaterials, references the directory where our VTF textures will need to be.

C:\Program Files (x86)\Steam\steamapps\common\Team Fortress 2\tf\materials\models\surf_ramps

Prior to compiling our model we need to create this folder and copy over the VTF and VMT files from the Example Files folder.

Now you should be all set, the only thing left to do is run the QC file through studiomdl. Navigate to the where studiomdl.exe is located for the game of your choice, since I'm using TF2 this will be.

C:\Program Files (x86)\Steam\steamapps\common\Team Fortress 2\bin

Now we simply drag and drop the QC file from our turn_90 folder on to studiomdl.exe. If you've done everything correctly you will now have completed model located in.

C:\Program Files (x86)\Steam\steamapps\common\Team Fortress 2\tf\models\surf_ramps

7: Conclusion

Now that the model is complete, you can open it in HLMV to make sure everything compiled correctly. If your model has missing textures then either the $cdmaterials path in your QC file is incorrect or you have not followed the steps correctly.

Remember, our textures need to be in the folder referenced by our QC file prior to compiling. Also our body we created in Blender needs to have a material with the same name as the VTF in this folder.

If your model compiled correctly, well done! Before jumping in though, here are some tips on how to improve the lighting on this model.

If you compile your map using -staticproplighting the ramp will look terrible, a simple solution is to Disable Vertex lighting in the Object Properties of the model. Then you can use Lighting Origin to sample light from other parts of the map. If anyone knows a better way to improve the lighting on these models using -staticproplighting please let me know.

I hope you found this tutorial interesting and at least somewhat comprehensible. There are probably easier and more efficient ways to create models like these, and if so, I would love to know. As you become more proficient with Blender you will be able to make ramps of greater complexity, hopefully this tutorial will help you on the way.

Thanks for reading, If you have any questions please ask them.
« Last Edit: April 26, 2014, 10:09:08 AM by Kompile »

Offline Diealready

  • aka Felix
  • Newbie
  • *
  • Posts: 49
  • aka massive faggot
    • View Profile
Re: How to Make Surf Ramps in Blender
« Reply #1 on: April 24, 2014, 10:40:17 PM »
Oh god you took the most complicated and time-consuming route to making these. you can just make the end face of the ramp and then use the "spin" tool on it, and it makes the whole ramp at any angle/size.

I found a ton of little tricks and stuff that make these easier to create, I might make a video or something showing how to make them way easier than this.

Also I did some tests, subdividing the model did nothing but make -staticproplighting look even worse, it does not seem to have any benefit. You can also make the collision mesh easier by splitting the ramp into two objects rather than each segment their own object, just selecting every second segment in the ramp and then hitting P. This just saves you from having to switch out of edit mode, then select the other object, go back into edit mode, fill faces, etc.
« Last Edit: April 24, 2014, 10:45:09 PM by Diealready »

Offline Kompile

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: How to Make Surf Ramps in Blender
« Reply #2 on: April 25, 2014, 02:33:48 AM »
Oh, thank fuck! I'll never have to make another one of these bastard circles. Go make that video! I'll re-write the top part of this tutorial and use the spin tool instead. That's also a really neat trick with the collision model, I guess it's similar to the way I make the UVs, I didn't even think to do it for the collisions as well. It's also good to know about the subdivision idea not working, thanks for trying it out.

Also do you think I can leave the UV, Compile and Exporting steps as they are?

I really want to get more people using Blender, I appreciate the advice.

Offline Kompile

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: How to Make Surf Ramps in Blender
« Reply #3 on: April 25, 2014, 09:15:37 AM »
I've updated the tutorial to include both of your suggestions, I'm also thinking about making another section about alternate methods. Another way that I know of is to use paths and the array modifier.



Unfortunately, the collision models on these don't work correctly, if you know of a way to fix that I'd really like to know.

Offline Diealready

  • aka Felix
  • Newbie
  • *
  • Posts: 49
  • aka massive faggot
    • View Profile
Re: How to Make Surf Ramps in Blender
« Reply #4 on: April 25, 2014, 03:22:38 PM »
I tried making a set of S-bends using that method but yeah, it just doesn't work for some reason. Can only surf them in one direction, otherwise instant ramp-bug.

Offline Kompile

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: How to Make Surf Ramps in Blender
« Reply #5 on: April 25, 2014, 04:18:11 PM »
Yeah it's a shame, there might be a way though.

I'm going to add a part about changing the origin of the ramp, forgot to do that. Having the origin where it is now will make the light weird.

Offline NamedPlayer

  • Newbie
  • *
  • Posts: 35
  • http://i.imgur.com/BvAuO.jpg
    • View Profile
    • iSpawnedThere
Re: How to Make Surf Ramps in Blender
« Reply #6 on: April 27, 2014, 04:03:09 AM »
Probably the best thread I have ever seen since I joined!

Offline FalseLogic

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: How to Make Surf Ramps in Blender
« Reply #7 on: April 27, 2014, 06:37:38 PM »
Thanks a ton for this tutorial. I was first having issues with the textures not showing up, but when I was trying, I was using the array and curve modifiers.

Offline NamedPlayer

  • Newbie
  • *
  • Posts: 35
  • http://i.imgur.com/BvAuO.jpg
    • View Profile
    • iSpawnedThere
Re: How to Make Surf Ramps in Blender
« Reply #8 on: April 28, 2014, 01:53:36 AM »
I've updated the tutorial to include both of your suggestions, I'm also thinking about making another section about alternate methods. Another way that I know of is to use paths and the array modifier.



Unfortunately, the collision models on these don't work correctly, if you know of a way to fix that I'd really like to know.

What exactly is wrong with the collision models on this ramp? Could you post a screenshot of HLMV?

Offline Kompile

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: How to Make Surf Ramps in Blender
« Reply #9 on: April 28, 2014, 08:46:54 AM »
The wireframe and collision model doesn't line up, it also shifts the vertices around.



If I had to guess, it might be because the shape you end up with has concave sections. Studiomdl probably re-shapes it to make it convex. AFAIK, Blender doesn't have an option to make something convex, so I don't know how you would test it.

Offline NamedPlayer

  • Newbie
  • *
  • Posts: 35
  • http://i.imgur.com/BvAuO.jpg
    • View Profile
    • iSpawnedThere
Re: How to Make Surf Ramps in Blender
« Reply #10 on: April 28, 2014, 12:14:51 PM »
It seems like studiomdl is trying to over simplify the number of polys in the collision model which is making the concave shape. Does anybody know of a way to override this or any other ideas?

Offline Panzerhandschuh

  • Server Op
  • Sr. Member
  • *****
  • Posts: 407
    • View Profile
Re: How to Make Surf Ramps in Blender
« Reply #11 on: April 28, 2014, 05:28:26 PM »

Offline Kompile

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: How to Make Surf Ramps in Blender
« Reply #12 on: April 29, 2014, 12:57:40 PM »
-fullcollide does the same thing that $maxconvexpieces does. It removes the limit on the amount of convex pieces your model can have. Without raising the limit your collision model would just be a big box.
« Last Edit: April 29, 2014, 01:11:37 PM by Kompile »

Offline spoz

  • Elder Statesman
    of the Surf
  • *****
  • Posts: 1,813
  • WHAT ARE YOU LOOKING AT DICKNOSE?
    • View Profile
    • Line12
Re: How to Make Surf Ramps in Blender
« Reply #13 on: May 22, 2014, 09:32:03 PM »
I've been experimenting with this for almost a year now on and off, surprised people have only just thought of doing it too. Bonus side to this - baked pbr lighting \

You can realistically just use a light_env pointing straight down, for shadowing, if you've baked, but the trade off for better lighting is bigger map sizes, longer loading on low end systems and a whole lot more work. Obviously it's a pain in the arse to do "right" (DDO and NDO help a lot) but give these guides a browse if you're thinking of it:

http://media.steampowered.com/apps/dota2/workshop/Dota2CharacterTextureGuide.pdf
http://media.steampowered.com/apps/dota2/workshop/Dota2ShaderMaskGuide.pdf

They're for DotA, but the technique is pretty much identical, but remember source limits model texture maps to 2048^2 so if you're making giant ramps you're gonna have to have multiple split large textures on the model and increase pak size, or drop the fidelity down.

IMO the later is the best option, as you can just use detail blends at a low scale, on top of the large base to simulate a higher res texture, just remember to offset the xy coords, and the rotation on the detail texture or the repetition will be obvious, and ensure that the detail has mipmap lod otherwise welcome to the lagfest.

Ideal scenario

1024^ base texture, with very minimal detail, you're looking for a point where normals are pretty much unnecessary
512^ detail texture, ensure there is enough variation, and it scales well, or it'll just look daft


Obviously this is a hacky technique, and by no means replicates what's possible with engines that fully support pbr (working with UE4 is awesome) and honstly is not a good idea for distributable output, but it's a good lil project to help work on your workflow, and makes pretty sweet portfolio shots.
Quote
But if u really wanna see a screwed up map take a look at that greatriver awesome 1... freaked the shit out of me... its like a child molestation adventure.....

Offline Kompile

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: How to Make Surf Ramps in Blender
« Reply #14 on: June 08, 2014, 12:24:27 PM »
I couldn't figure out how to make them correctly, the physics mesh always seemed to go mental. Besides, making these ramps doesn't take that long and you only have to make them once. Editing them is really easy. I've remade my ramps several times and when you recompile them, the model just updates in hammer.

Offline Crayz

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: How to Make Surf Ramps in Blender
« Reply #15 on: October 05, 2014, 03:49:55 AM »
I spent a few hours today re-creating a large curvy ramp in Blender (using this guide) that I originally made with brushes, end result is much smoother and cleaner.  Thanks