How can i have a view layer rendering freestyle without rendering the object

for the compositing ?

You can’t. If object is disabled for rendering, it is disabled for Freestyle, too.
BI had a way to disable rendering of solid faces.
That way, it was possible to produce a Freestyle pass without rendering of meshes.

Currently, EEVEE or Cycles are not providing such passes.
You can not render a Freestyle pass or disable a solid faces pass.

So, you have to make solid faces transparent by using a transparent shader.
Cycles have an Override panel under View Layer properties to apply a transparent material to whole scene.
Unfortunately, EEVEE does not have that.

You can also use LANPR branch. Into this one, LANPR is a separate renderer. So, you just have to use this render engine, Background and Lines would be the only things that would be rendered.

Yes, you can. It’s only possible with Cycles, though. Enable Freestyle, set the background to transparent, then go to the view layer tab and look for a panel called filter. In there is an option that says surfaces. Just uncheck it and you should get a render with only the Freestyle lines.

For Cycles, I’m using transparent background, and an override material with a holdout shader. Might not be the applicable solution for all situations.

1 Like

Works for Eevee render also with a transparent shader and blend mode set to Alpha Blend in material properties.