10
$\begingroup$

I am new at this. I am extracting files from a game. In the game they have thin black outlines, but they aren't part of a model. I am having trouble finding anything about this. What is the simplest way to do this?

I think I am looking for something like freestyle. What is the simplest way to use this to create a thin black outline around a model?

$\endgroup$
5
  • $\begingroup$ What are you planning to use it for? $\endgroup$
    – piegames
    Commented Dec 27, 2016 at 20:25
  • $\begingroup$ @Piegames : I am extracting models from a game, and in the game they have outlines. However the outlines aren't part of the model. $\endgroup$
    – LadyAriel
    Commented Dec 27, 2016 at 20:53
  • 1
    $\begingroup$ A picture would probably help explain your question more. $\endgroup$
    – cmomoney
    Commented Dec 27, 2016 at 23:53
  • $\begingroup$ As in something like freestyle? $\endgroup$
    – sambler
    Commented Dec 28, 2016 at 1:53
  • $\begingroup$ @sambler : Yes freestyle is what I think I am looking for. Do you know the best way to create a thin line with that? $\endgroup$
    – LadyAriel
    Commented Dec 28, 2016 at 2:02

3 Answers 3

11
$\begingroup$

In your render settings enable freestyle.

freestyle on

Under render layers add a freestyle line set.

freestyle line set

example from default settigns

The line thickness is a quick way to adjust the size of the line drawn. For more control over what edges are used to draw lines and how the lines are drawn, you will need to look through the freestyle documentaion.

$\endgroup$
4
  • $\begingroup$ Thanks this seems to work for what I need. However it creates an extra box on the inside of the model (probably because it is a different material or something). I have tried all sorts of options, but I can't remove it. Is there anyway to fix that? $\endgroup$
    – LadyAriel
    Commented Dec 28, 2016 at 19:22
  • $\begingroup$ It is finding the edges of the model, unless you enable material boundary. Is it another object? or an extrusion within the object? $\endgroup$
    – sambler
    Commented Dec 29, 2016 at 3:16
  • $\begingroup$ I figured out how to remove the box, but I have another issue. There should be an outline around the nose of the object, but I can't figure out how to outline the entire nose (only a part of the nose is highlighted). Here is the blend file, so you can see more the mesh or anything else. $\endgroup$
    – LadyAriel
    Commented Dec 29, 2016 at 17:10
  • $\begingroup$ If you have trouble with it picking up edges you want drawn, you can specifically mark an edge as a freestyle edge so it will be drawn. $\endgroup$
    – sambler
    Commented Dec 30, 2016 at 7:21
7
$\begingroup$

As I supposed, this model is used in a game. In games, rendering happens differently than in Engines like Cycles. You wouldn't put the information about the outline into the model, but code it as an effect. Here's an approach how to do this in games:

  • Lock depth buffer writing
  • Render the object as wireframe with a thick colored line
  • Enable depth buffer writing
  • Render the object again, this time normally.

There are other ways to do it, (for example with some normal calculations), but this one is fairly common.

How to recreate this effect in Blender?

Idea 1

As mentioned in the answer by @sambler, you could use freestyle.

Idea 2

Another way is to use modifiers and render passes to emulate the effects done in the game:

  • Duplicate your model and put the clone on another layer. Add a Wireframe modifier to the clone and change it's material to the outline material.
  • Exclude the wireframe clone's layer from your scene rendering. Add another render layer, rendering only the layer with the wireframe object.
  • Composite them together with a Z Combine. Make sure the Z values of the Wireframe are always greater (farther behind) than the object, but never too far that they get hidden by other objects.

idea 2

Idea 3

Another idea I found here is quite similar to 2:

  • Duplicate your model. The copy will be the outline
  • Select your outline model and go into edit mode
  • Select all faces and use Alt+S to "extrude" them. Quit edit mode
  • Assign each one a different material. You can join the meshes if you want.
  • Make the outline's material transparent when front facing and black (outline color) when back facing.

The original idea used a geometry shader to extrude backfacing faces but it didn't work with displacement in Blender. Also the inner material has to be emission (I don't know why, but it is just an idea you could elaborate). Final result:

enter image description here

Idea 4

Similar to 2. Probably my favourite.

  • Set a unique Object or material ID to the object that should have an outline (I went for object)
  • Enable object (or material) render pass in your render layer.
  • In compositing, use the ID mask to cut out your object. Blur the mask, color it and use alpha over nodes to put all together.

In the screenshot, I've labelled the nodes with their function so you know wich values to tweak. enter image description here

Here's the node setup for idea 4:

$\endgroup$
9
  • $\begingroup$ In regards to idea four, since freestyle has some extra lines that I don't want and I can't figure out how to get ride of. How do you add the Object ID node? I can't figure out where it is. $\endgroup$
    – LadyAriel
    Commented Dec 28, 2016 at 19:19
  • $\begingroup$ Add -> Converter -> ID Mask. I renamed its label in the screenshot - sorry for confusing you $\endgroup$
    – piegames
    Commented Dec 28, 2016 at 20:13
  • $\begingroup$ How did you add the Multiply and all the outline nodes? I can't find those. $\endgroup$
    – LadyAriel
    Commented Dec 28, 2016 at 21:27
  • $\begingroup$ The multiply node is a Math node, the "Outline color" node is a "set Alpha node" I renamed as well as for the "Outline size", which is a Blur node. If I hadn't closed Blender without saving I'd redo the screenshot, maybe tomorrow $\endgroup$
    – piegames
    Commented Dec 28, 2016 at 21:31
  • $\begingroup$ Okay I think I connected everything exactly as your picture, but it is a black square. The only thing I notice is that the first multiple node has a value instead of "image", as seen in your picture. How do you fix that? $\endgroup$
    – LadyAriel
    Commented Dec 28, 2016 at 21:47
0
$\begingroup$

On newer versions of Blender than is mentioned here, it is not necessary to do anything special with the wireframe method. Just copy/paste what you wat to have the wireframe layered over (but make sure that you unparent and keep transformation before you do that), and then on the duplicate you can simply set the wireframe option with no special procedures required (and also set the thickness, I'm personally using .03m) and if the wireframe has a grid over a part where you don't need one, select the duplicate, go into edit mode, select the vertices which intersect the parts of the grid, press the delete key and select the dissolve edges option. Repeat this with any other side of the mesh that has a grid on it until all the grids are gone. After that, if you had the original mesh parented to something (such as an armature bone) go into the means by which you originally parented the source mesh (pose mode in the case of an armature) then select the relevant object and reparent both the source mesh and the wireframe mesh in accordance with the respective procedures. A few words of caution, though: you want to keep the source mesh and the wireframe mesh in the exact same position if you're using this method.

Here's an example using a cat girl who works as an astronaut with the wireframe applied to her oxygen pack:

enter image description here

As a side note, the other outlines in the example image use an entirely different method than the oxygen pack. For those I do something similar, however I do not duplicate those objects. Instead, I append a material entry to the end of the list for that particular mesh and name it for what it is (technically it can be any name whatsoever, but simply calling it "outline" is both sufficient and descriptive). Next, I turn on the nodes option for the material, configure it with a principled BDSF and have the base color for that set to the same color as the wireframe (typically that would be pitch black, or hex code 000000 to be technical about it) and then I go into the modifiers for the mesh and add a solidifier. The third step I use is to set that modifier's width to a reasonable setting that goes in the negative direction (-0.003 for example) and then check the box to flip the normals on the modifier. After that, I set the material offset for the modifier to one less than the total number of materials used on the mesh (since it follows the z-index numbering system meaning that it starts at zero and not one, so if the material at the end of the list is at position 8 then I'll use the number 7). Finally, I go back to the list of materials, select the one that controls the outline and check off its backface culling option, or else the entire mesh would have the color assigned to the outline material. Once that's done, the solidifier settings will look something like this:

enter image description here

And the principled BDSF for the outline will look something like this:

enter image description here

From there, I repeat the process for each mesh that I'm adding an outline to, except that I can reuse the outline material that was already created by selecting it from the materials list instead of adding an entirely new material.

Finally, if not all parts of the model play nice with the above method (and no other rendering method is doing the trick) then you may wish to consider the prospect of using the freestyle option that's mentioned above. This is useful for things like hair which may not respond to other methods. It's not a guarantee that it will provide a usable result in every situation, but it's a good final resort if all else has failed. After checking it off, it's simply a matter of setting the desired thickness (but no less than a tenth or it won't be visible and thereby defeat the purpose). I use three tenths, so the freestyle options would look like this:

enter image description here

And here's the cat girl again to show off the results, as she prepares for a scuba diving excursion alongside her human friends:

enter image description here

As an aside, the reason by which I say that using freestyle is a last resort is because it requires additional rendering time in order to be processed, perhaps significantly if you're not working off of something like an RTX 4060, or if you have a lot of 3D models in your project, or perhaps even both.

$\endgroup$

You must log in to answer this question.

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