Jump to content

reproduce Vray "invert normal" option for occlusion


MrGAG

Recommended Posts

Hello, I was wondering how could I reproduce the effect of the "invert normal" option in 3dsmax Vray dirt shader ?

like in this example :

http://www.spot3d.com/vray/help/150SP1/examples_vraydirt.htm#ex6

the only thing I could think of trying for now is invert N begore pluging it in occlusion vop, but it has no effect on my render.

Does anyone have a clue ?

Link to comment
Share on other sites

I think I have part of a solution

I inverted geometric normals this time ;) and it has an effect now.

it seems we have a problem where geometry is interpenetrating though. I haven't tried this configuration with Vray dirt yet, but I don't think I'll the same result.

But I like that already, it could give some nice details on the edges.

post-3728-131272605485_thumb.jpg

post-3728-131272606646_thumb.jpg

Link to comment
Share on other sites

Hello again,

I used the inverted occlusion to drive emission color of a standard Surface model Vop.

It gives a pretty good result. Sort of a SSS look, but cheaper I guess.( this image took 1 hour and a half, but I think the blurry reflection is responsible for a big part of the render time.)

post-3728-131273871234_thumb.jpg

Link to comment
Share on other sites

A simple method would be to use a ramp parameter after your occlusion vop. This would let you get the outside edges and and even the inside edges, or what ever pattern you want.

I have done the same method you're speaking of in renderman, and this will cut out the extra geometry, or normal re-working.

Link to comment
Share on other sites

good idea, I am definitly going to try to expand this shader into something a little more complicated.

By the way, correct me if I am wrong, but vex code seems much easier to read, passed a certain point of complexity,

would it be better for me to code that shader instead of building it with Vops ?

Link to comment
Share on other sites

good idea, I am definitly going to try to expand this shader into something a little more complicated.

By the way, correct me if I am wrong, but vex code seems much easier to read, passed a certain point of complexity,

would it be better for me to code that shader instead of building it with Vops ?

Whatever manner gets the job done easier for you. Doing vops and vex are two great parallel structures, each having their pros and cons. I personally understand working in vops better when it comes to complex shading, or any nodal based shading system. Almost everyone that looks at my node based shader networks get confused, but looking at tons of vex code for me gets confusing.

On a completely personal belief, I think you will do a vops or vexs based work flowed depending on how you think. I am a very strong spatial learner. I've meet a few other people that do vops and they are of the same type of learning style. Where as many vex/coders are better with other skill sets.

If you haven't heard of what I am a talking about here is a quickly found article on it.

Theory of Multiple Intelligence

In the end it don't matter how you do it, as long as you get it done. So you're not wrong or right.

Link to comment
Share on other sites

In the end it don't matter how you do it, as long as you get it done. So you're not wrong or right.

I can only agree that ;)

but I might be a bit on the other side to ... I have a background in web scripting, max script, a little of python.

Don't really know why I didn't tried vex already. Maybe because it's so easy to use any function you want in vex, node base representation of function is a bliss. But on the other hand, I find that doing a simple "if / then " or a while loop become really tedious sometimes. ( especially regarding point clouds iterations .... ) I guess coding it would be easier for me sometimes.

Link to comment
Share on other sites

I find that doing a simple "if / then " or a while loop become really tedious sometimes. ( especially regarding point clouds iterations .... )

lol... yeah, point clouds and while loops are still unsolved in my book, too... if/then blocks I finally got covered. Having practical applications to use the concepts makes them a lot easier.

-Ben

Link to comment
Share on other sites

I am a bit confused :

I have a little vex script :

sop
sop_pc_test()
{

int handle = pcopen("op:/obj/pointCloud/OUT_pc","P",P,1,1);

vector myPos = pcfilter(handle,"P");
float dist = distance(P,myPos);
Cd = clamp(dist,0.0,0.1);

}

as you can see, this vex script runs in sop context. and it runs well.

When I try this in "surface" context, as a shader, it doesn't work at all. Of course I remembered to switch from "Cd" to "Cf", but besides that why wouldn't it work ?

surface
sop_pc_test()
{

int handle = pcopen("op:/obj/pointCloud/OUT_pc","P",P,1,1);

vector myPos = pcfilter(handle,"P");
float dist = distance(P,myPos);
Cf = clamp(dist,0.0,0.1);

}

Link to comment
Share on other sites

  • 9 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...