Jump to content
Isleofgough

Cell Shader

Recommended Posts

I have looked at various ways of rendering just the visible edges in Houdini, and it seems like I have to use Flipbook. To add the lines on top of an existing texture, I have to do a double render and composite them. Is there a shader that basically just adds lines (multiplying an image of the edges on top of a constant or principled shader?

CellShader.jpg

Share this post


Link to post
Share on other sites

unfortunately no, there is no dedicated wireframe shader in Mantra. but there is a pretty easy geometry based workaround that gives decent results. check the file in attachment, hope that helps.

cheers, D.

 

wires_test.jpg.a7e69988d24d6ffaea719db945bb0a01.jpg

wireframe.hiplc

Share this post


Link to post
Share on other sites
Posted (edited)

I still think there must be a way of doing this all in a shader. (since many other 3D programs DO have a built in cell shader). I know absolutely nothing about what I'm doing in shader editing, but I tried to at least get a start with this. If I could remap the greyscale with some sort of ramp to pure white and pure black, I would be very close. I'm guessing this wouldn't work if actual UVs were applied:

 

FakeCellShader.hiplc

FakeCellShader.jpg

Edited by Isleofgough

Share this post


Link to post
Share on other sites

you're almost there, just need to compute abs(0.5 - s) and see if it's less than your chosen edge threshold value. granted, this still is going to render the edge width as a percentage of the parametric UVs instead of a constant world space width, which is why i like the Convert Line method better.

FakeCellShader_ts.hipnc

  • Like 1

Share this post


Link to post
Share on other sites

... almost as in ~20%, but thank you. I see what you mean about the Convert Line method too.

Share this post


Link to post
Share on other sites

You could measure world distance from P to edge (primuv(0, "P", primnum, {0,1,0}) and remap the result to 0-1. In that way edge width maintain in world space units. Here is example file.

cell_shader.jpg

wireframe_shader.hip

  • Like 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×