Is it possible to optimize this process?

I’m working on anime-style stylization.
I created a simple scene with eyes visible through the hair. And a stylized shadow for the hair, which is only visible on the head.
A simple example without complex geometry and heavy materials


I have a fairly weak computer and I want to optimize this scene as much as possible so that in the future, when I add more complex and heavy objects, my blender doesn’t crash.
Is this possible?

Render eevee
Version blender 4.1
File :
Trans test.blend (1.3 MB)

Your compositing setup is complex, but not heavy on performance. The polygon count is completely reasonable and there are no textures. There is no performance concern for the moment, but this will have to be checked again once the full scene is there.

You are using shader to RGB, so this will have to be rendered in Eevee. The main concerns for performance in Eevee are going to be the number of lights and shadows, polygon count, and the shader to RGB node itself, which is expensive (beware using too many of those nodes, reuse materials where possible).

I’m concerned that I have to use three layers with different objects (in other words, render the scene three times) and also several AOV layers. And I don’t know how to avoid shader to RGB if the AOV layer only accepts either a color or a value.

Couldn’t the other objects be added to the existing layers and AOVs? Or at least share as few of them for as many objects as possible?

[Although I haven’t cleared out some duplicate or unused channels, I’ll just delete them in the future, so I’m not paying attention to them right now. As for the ones I’m already using, I can only say…
I don’t know.
But I’ll try to explain which layer is responsible for what.
Layers


Hair - The hair layer is initially unused because I only need hair.
But since objects like the head overlap it, creating a transparent area, I’m currently using “AOV Color 2” for this.

Without Hair - This is the head without hair; I’ll use it to layer the hair over the image.

Shadow - The shadow from the hair as an object should appear only on the face and not extend beyond it. (It might be possible to shorten this by dragging it onto the Hair layer, but I don’t know how yet.)
AOV

AOV Color 2 - A separate hair layer.

AOV Color alpha - An alpha mask that I use because I don’t know how to layer hair over it without one.

AOV Alpha Shadow - A shadow mask is needed to keep the shadow within the face.

AOV Alpha - An eye mask is needed to allow the eyes to show through the hair.
If you have any ideas where I can cut it, please tell me.

I was initially inspired by this tutorial but I still don’t understand how he made the hair transparent.

Does the shadow have to be done with compositing?

Would you be using real lighting in the final product? If yes, wouldn’t that make actual shadows anyway?

If you won’t use real shadows and need the fake stylized shadow, maybe there could be a way to do it without compositing, directly on the mesh itself? The solution I would have thought of for doing this kind of stylized shadow is a semi transparent mesh that’s shrinkwrapped on the head.

The result is visible directly in the viewport and it removes a major compositing step.

I use an artificial light source that I create from vectors and normals, so I don’t have any real shadows. The modifier might work fine on a simple sphere, but on a complex face with moving eyes, ears, and a mouth, and the hair has a rig that also moves, all of this will likely create artifacts.

All of this would be significantly easier with Goo Engine. It has extra features for exactly this that native Blender does not

Exactly this. I’ve done it several ways, including compositing, and using the nodes in goo engine is the most effective approach I’ve found.

Can you show examples? It’s quite difficult to find tutorials on Goo Engine that cover the topic I need.

Here’s some basic setup.

Hair by itself, on the head. (I’m also using mesh elements for shadowing on her shoulder, and on the neck.)

The hair mesh and armature are duplicated. Then I remove all the hair elements that don’t need to be there, because they won’t be casting a “shadow”.

(And to point out what i hope is obvious: there’s no “shadow from a light” here. We’re creating the illusion of a shadow. I don’t use Eevee light shadows at all for characters.)

Basic setup for the shadow material below. It’s possible to cast the shadow onto multiple colors (skin + eyebrow + etc) with mix nodes, but I’m keeping it simple here to demo the method:

All of that is of course in a single view layer. So, all these elements made visible give us the result:

If you have hair hanging over the eyes, and want the eyes to partially show through - then it’s simply a matter of:

  1. Assign an AOV output to the eyeshader in the main view layer
  2. Create a view layer with only the eyes
  3. In the compositor, mix the eyes (from 2) over the render, using the AOV (from 1) as the alpha matte. Then mix level = amount of eye showing through the hair.

Example (Also, i made the eyebrow included in the AOV.)