5
$\begingroup$

I think this question has been raised numerous of times, but I have yet not found an answer that works.

I'm rendering game graphics with cycles and I need them to be saved in RGB, without any alpha information what so ever.

Setup:

enter image description here enter image description here

I want to save this picture, exactly as it appears here, with no alpha. But it always saves an antialiased version of it against black.

How can I save the image without antialiased result?

$\endgroup$
  • 1
    $\begingroup$ could you add two small images with how the result looks right now and exactly how you want it to look? $\endgroup$ – Haunt_House Oct 11 '13 at 18:10
  • 1
    $\begingroup$ Just to be clear, I don't think the antialiasing is stored as alpha values in a single layer PNG, rather just a mix of whatever color and black (in RGB colors). So with the settings you have now, there is no alpha information being saved. $\endgroup$ – gandalf3 Oct 11 '13 at 20:23
  • $\begingroup$ @Gandalf3 I need the object to not be antialised against the background, but still within the object itself. So far Peter's solution worked best for me. $\endgroup$ – Max Kielland Oct 11 '13 at 20:59
  • $\begingroup$ @MaxKielland I agree PeterT's solution is better, but my solution should work for doing that. $\endgroup$ – gandalf3 Oct 11 '13 at 23:54
7
$\begingroup$

I assume you still want AA within the image, just not at the borders, so I'd suggest that you render with a transparent background and remove the border AA in the compositor:

Nodes

There's obviously ugly aliasing artifacts here but you could fine-tune the "Greater Than" Node or process multiple alpha ranges differently.

$\endgroup$
  • $\begingroup$ I went for this solution. It was independent of the objects and I see how it works, I can fine tune it. Thanks! $\endgroup$ – Max Kielland Oct 11 '13 at 20:38
  • 1
    $\begingroup$ Is there any advantage to using Image > Separate RGBA > Alpha instead of using the Alpha socket of the RenderLayers node? $\endgroup$ – wchargin Oct 13 '13 at 1:55
  • 1
    $\begingroup$ @WChargin nope, I just threw this together, you obviously don't need the RGB node either, since you can set the color on the empty image slot on the Mix node itself $\endgroup$ – PeterT Oct 13 '13 at 2:09
13
$\begingroup$

In 2.67 and 2.68a (I haven't checked 2.69+), the amount of AA present in the cycles render is controlled by the size of the Gaussian sample on the film.

The gaussian for the film is the amount of jitter that rays leaving the camera receive. If this is high, the pixel effectively samples a little circle of incoming light in the scene, and you get anti-aliasing. If this is small, then all the rays are almost the same, and you are sampling one single point on the film.

So to reduce or remove anti-aliasing in Cycles, turn down the Gaussian width in the Film section of the Render settings. Turning it to 0 will reset it to its minimum (currently 0.01 on my version, the default is 1.50), and rendering will give essentially a non AA image.

enter image description here

If you just want to avoid an aliased outline, then this isn't the right setting, do it in the compositor as per PeterT's answer.

$\endgroup$
3
$\begingroup$

The Anti-Aliasing option does nothing for the Cycles renderer, it's only for the OpenGL renderer (=viewport render).

If you wanna have a Cycles render with no AA, try this:

  1. Sampling panel, set from Path Tracing to Branched Path Tracing

  2. Set AA Samples to 1

  3. In the Film panel, untick Transparent

  4. Save in RGB mode

$\endgroup$
  • $\begingroup$ Note that GPU does not work with the non-progressive integrator (it does in the RC, but the OP's screen-shot is of an older version) $\endgroup$ – gandalf3 Oct 11 '13 at 18:19
  • $\begingroup$ It sort of worked in 2.69 RC1, but it could occasionally crash on Windows (which is really a Windows problem, stupid timeout error whereby OS believes the GPU crashed if it doesn't respond fast enough and resets driver). $\endgroup$ – CoDEmanX Oct 11 '13 at 18:24
  • $\begingroup$ Is this for Blender 2.69RC? I on 2.68. $\endgroup$ – Max Kielland Oct 11 '13 at 20:04
3
$\begingroup$

Another way to remove anti-aliasing in cycles is with composite nodes and ID Masks:

  1. Enable Object Index in Renderlayers > Passes:

    enter image description here

  2. Set the pass index of all the objects to 1 by

    1. A> Select all (to ensure you have all objects selected, you may also need to un-hide hidden objects (AltH) and toggle all layers visible (~))

    2. Set Object Data > Relations > Pass Index to 1

    3. Right click on the Pass index setting, and select Copy to selected:

      enter image description here

  3. This will add a new output to the Renderlayer node. By plugging it into an Id Mask node and setting the Index to 1, you can generate a mask of all the objects. This mask will not be antialiased when the Anti-Aliasing option is disabled:

    enter image description here

  4. Use the resulting aliased mask as a Mix factor to remove anti-aliasing from the render. This will only remove anti-aliasing from the edges next to the sky, leaving the edges over other objects smooth:

    enter image description here

Result:

enter image description here

$\endgroup$
  • $\begingroup$ Just as a side-note, if there's not transparent surfaces this gives almost the same results as filtering for alpha>0.5 meaning that it will still contain some pixels mixed with the background color if cycles is set to use AA, but they're fairly unnoticeable compared to what the default output gives you. $\endgroup$ – PeterT Oct 11 '13 at 18:48
  • $\begingroup$ @PeterT Your solution is better, +1 :) $\endgroup$ – gandalf3 Oct 11 '13 at 18:54
  • $\begingroup$ objectively it can go both ways, with your method you don't get these artifacts on straight lines. But using "Greater Than" values of 0.85 seems to be a good compromise. $\endgroup$ – PeterT Oct 11 '13 at 19:07
  • $\begingroup$ I did tried this one too, but at a first glance Peter's solution seemed to give me more control and I don't have to fiddle with the index for each object. Thank you any way.. $\endgroup$ – Max Kielland Oct 11 '13 at 20:40
  • $\begingroup$ @MaxKielland PeterT's answer is the better one, but I have updated this answer anyway. (you shouldn't have to fiddle with the the pass index for individual objects, so I tried to clarify) $\endgroup$ – gandalf3 Oct 12 '13 at 0:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.