Jump to content

Polygon Selection based on Fresnel?


Recommended Posts

Hi, 

Is there a way to create polygon selection based on fresnel (i.e. grazing angles based on camera view)? 

 I couldn't find a "shader" option in field list, so I'm not sure how to implement the effect. 

Is there a way around this?

Regards,
Ben
 

Link to post

I can't imagine a way to do that so far. There are 3 ways we have of making material properties influence models (vertex maps, fields and proximal) but I am not aware of any ways to make any of those interact with fresnel, which I don't believe is even calculated until render time...

 

CBR

Link to post

Seeing the answers so far, I may be on the wrong track. Please bear with me, if I'm running into the wrong direction.
As I understood the question, the goal is a polygon selection based on Fresnel. Now, for me in this case Fresnel is basically the angle between two vectors (actually I think, it's rather the change of the angle of a ray of light, when entering a material with different optical properties (still way simplified)), the vector defining the direction of the polygon (normal vector) and a camera ray.

Now, this could be achieved with a bit of Python. But we shouldn't reinvent the wheel, but instead give some credits to Donovan Keith, who already used the Python tag to create the "CV-Parametric Selection Tag".

The CV-Parametric Selection Tag provides us with means to select polygons based on different conditions. One of them being the direction a polygon is facing. This is actually already one pat of the equation, we are interested in, the polygon normal. Now, in order to answer the question correctly we'd need to take the camera ray which hits the polygon into account. But to make it a bit simpler (and also because it's probably not possible with this approach), I will only use the direction from object origin to camera position instead of the actual camera ray.

 

Using these ingredients, I get the following:

image.thumb.png.4fcdb98368856f3222f2e16b21ae24e7.png

 

I doubt, I'd be allowed to upload a scene, because Donovan's tag is actually Cineversity content.

 

Instead, here's how I set it up:

image.thumb.png.68f31c110b69cb0de9ab90a003d4dea1.png

 

A very small and simple Xpresso tag to feed the view direction from the camera into the CV-Selection tag:

image.png.129e9775e65d632dbdfdbf59812ea0e7.png 

Data type for subtraction has to be Vector, the "Vector" input of the CV tag is the one from the "Facing" parameter group (see below).

 

And finally the CV-Parametric Selection Tag:

image.thumb.png.bc9e24f36c665e376789028d1a70b3da.png

 

As said before, I utilize the "Facing" condition. With above setup it would select those polygons facing the camera with a certain tolerance- That'SA why the "Invert" checkbox is set. Playing with "Tolerance" you can change the amount of selected polygons. Depending on what you are after, you may also want to set "And Opposite" to also care for the backside.

 

As said before, this is not a mathematically correct solution, but I think depending on the view parameters and an objects geometry, it may already be sufficient. And hopefully serves you as a starter for better solutions.

 

Cheers

 

Additional notes: Due to C4D's handling of Selection tags, Donovan's tag can be a bit finicky to use. Be a bit careful, save often and read the tag's docs carefully (are there any? I didn't check, but given the internal  implications thee should be...). Hopefully, what MAXON just demonstrated with Neutron will enable us in future to achieve tings like this way easier.

 

Edited by MighT
Additional infos
Link to post

No, I am not. I wish, I were.

Actually the entire idea of such a selection tag is from noseman. Back in those days, he made Donovan and me develop such a tag in parallel. When we discovered we were doing the same in parallel, I simply dumped mine. But since then, I have quite a good idea, of what can be done with this approach. 

 

Link to post

I just realize, this might have been a bit ambiguous. Clever I am not. Bastard may be of course. I'll ask my mom for more details... 😉

 

 

Link to post

There is a shader field and it works with the fresnel shader as well. Update is a bit limited though. You can set it to update each frame but when navigating on a fixed frame it won't update live. You can preview the effect by running the scene though. 

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...