Constant thickness spline rendering

Constant thickness spline rendering

w.haak
Contributor Contributor
1,779 Views
5 Replies
Message 1 of 6

Constant thickness spline rendering

w.haak
Contributor
Contributor

I'm looking for a way to render splines with constant thickness, i.e. 1px (ant aliased) at full render resolution. 
The renderable spline modifier allows for constant thickness of the spline object, but that results in perspective dependent thickness in the render. 

I want to replicate splines in a similar fashion how they displayed on screen, where the thickness is constant irrespective of distance. I have tried all combinations of renderable spline modifier and shaders(wire/toon) that I can think of, but I can't seem to find a solution. 
"Create preview animation" almost works, but there's a slight shift against the background, as it creates a 1px grey border at high resolutions (bottom and right). 

  1. Is there any scripting access to spline objects that I could hook into?
  2. are there any other programmable functions I could use?

kind regards,

Accepted solutions (1)
1,780 Views
5 Replies
Replies (5)
Message 2 of 6

leeminardi
Mentor
Mentor

Will the entire spline be visible in the render or will parts of it be obscured by other objects?

lee.minardi
0 Likes
Message 3 of 6

w.haak
Contributor
Contributor

It will be rendered together with geometry objects. But if it's easier I'd be happy to accept a solution where it's rendered as a separate pass.

0 Likes
Message 4 of 6

leeminardi
Mentor
Mentor
Accepted solution

I don't have any experience with this but perhaps you could use interpCurve3D to get a series of spline 3D points and then assign them to thePos in the code How To ... Develop a Vertex Renderer 

lee.minardi
Message 5 of 6

Diffus3d
Advisor
Advisor

Which renderer are you using?  VrayToon (the environment effect, not the shader) has a way to have a constant thickness on the toon lines.  Maybe you could use that with a spline converted to poly and the bottom pulled down with transparency and disabled shadow casting so it only sees 1 edge for your 1 pixel thick line.   (Or maybe a clever opacity mapping in the vraytoon rollout.) 

 

Then, you need a better minimum anti-aliasing than 1, so maybe 2.  Then turn off shadow casting, reflections/refractions, etc. and it should be a quick pass to render.  The only hindrance is that the outer and/or bottom edges will show lines, so you need some extra space at the ends so they extend beyond the camera's ability to see them.  

 

Working example attached.  I don't know of another way to do it with a different renderer, I put my eggs in the Vray basket 15 years ago.  

 

Best Regards,

0 Likes
Message 6 of 6

w.haak
Contributor
Contributor

@Diffus3d  - That's an interesting approach, although give how many I will have to do, I suppose not practicable as a repeat pipeline.
Appreciate the time and thought spared. 

 

@leeminardi 
I was aware of the SVG render script, but a this one is new. That may have some mileage, I'll have to play with the code. If I can make it work, it should work a) fast b) repeatable. Thanks for the idea!

kind regards,