Jump to content
Crustedink

Wireframe and UV Distortion with mantra

Recommended Posts

Hello,

i am trying to render a wireframe of the topology straight from mantra. Feely a bit stupid, but it seems way more complicated then i thought. I read about wren or creating a "wireframe-geo", but in my case, i need it from mantra as an additional image plane (via bind export).
Trying to create a mantra beauty render of an asset as kind of Model QC, so besides the wireframe it would be great to also include the uv distortion (as in maya) in my render, to see if the uvs are strechted or compressed.

most important is the wireframe, would be great, if somebody could point me in the right direction.

Cheers,
Daniel
 

Share this post


Link to post
Share on other sites

perfect, looks good as a start, thank. only proplem of this approach is the inconsistent thickness of the lines. but should work for now!

Share this post


Link to post
Share on other sites

For a wireframe shader with consistent line widths, first create a primitive attribute that contains all point positions. Then inside a shader choose point pairs for ptlined() to determine the shortest distance to your shading position to check against a custom wire width.

image.thumb.png.a95b68aedf855173a577c7a148dbcf09.png

// primitive attribute with point positions
int pts_prim[] = primpoints(0, @primnum);

v[]@pos = {};
foreach(int pt; pts_prim){
    vector p = point(0, 'P', pt);
    append(@pos, p);
}
// shader snippet feeding point positions into ptlined()
// determining shortest distance to check against wire width.
int num = len(pos);

float dist = 1e6;
for(int i = 0; i < num; i++){
    vector pos_0 = pos[i];
    vector pos_1 = pos[(i + 1) % num];
    float dist_curr = ptlined(pos_0, pos_1, P);
    if(dist_curr < dist){
        dist = dist_curr;
    }
}

stroke = dist <= stroke;

 

wireframe.hipnc

  • Like 5

Share this post


Link to post
Share on other sites

fantastisch... thank you very much. there is a lack off shader building tuts for npr rendering. do you know how to get the edges of the geometry to get more an artistic look?

Edited by primzahl

Share this post


Link to post
Share on other sites

Hi Helmut,

do you mean artistic wireframe edges or the outer rim of the entire mesh?

Either way, if you are talking about turning the wireframe into something more complex you could always color ramp the distance values and/or distort them with some noise:

wireframe_cartoon.thumb.jpg.07dfbb819a8fb04af2c38e0e4215b6c7.jpg

wireframe_art.hipnc

 

In case you meant the entire mesh, you can color ramp a lambert shader like this:

 

Also, a more painterly look can be achieved by using images to control gradient thresholds:

cartoon_shader.thumb.jpg.d01964153ba2c98e347dcfc47a87503f.jpg

https://www.sidefx.com/forum/topic/68331/

 

Share this post


Link to post
Share on other sites

Hallo Konstantin,

thank you for the files and the link. I will have a closer look.

I was thinking about something like C4 sketch and toon shader. because I'm current on my final animation project and would like to have the look of a painting from Pissarro, Sisley. but brush strokes rendering seems more complicated than I naively and in deep shader creation and writing was not part of the lectures - so every tips and tricks are highly appreciated. 

Share this post


Link to post
Share on other sites

combine this + find on Ddforce Shader each day topic

and vex shader code

 

 

Share this post


Link to post
Share on other sites

Hi Helmut,

I got fairly good results by distorting colorful circles on top of images/renderings like so: https://forums.odforce.net/topic/44391-na/?tab=comments#comment-208974

To get closer to certain artists' way of painting though you would need to breakdown their visual style first. There won't be the one uber-cartoon shader that covers it all.

Hirai Toyokazu also used to present his cartoon shading workflows on CMIVFX. Maybe you can get hold of this:
https://web.archive.org/web/20180827020108/https://cmivfx.com/houdini-cartoon-effect

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

×