Curvature using hitpoint info

Use this forum for general user support and related questions.
Forum rules
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
User avatar
Egert_Kanep
Posts: 237
Joined: Tue Mar 13, 2018 10:34 am

Curvature using hitpoint info

Post by Egert_Kanep »

Would it be possible to calculate curvature using world position and normal data?

I've been trying to make something, but couldn't get the math working :D. My idea was to use world position to calculate height difference between points with given offset.

Any ideas or is it possible at all?
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Curvature using hitpoint info

Post by Dade »

Egert_Kanep wrote: Wed Oct 09, 2019 8:18 am Would it be possible to calculate curvature using world position and normal data?

I've been trying to make something, but couldn't get the math working :D. My idea was to use world position to calculate height difference between points with given offset.

Any ideas or is it possible at all?
But do you mean inside LuxCore code (i.e. LuxCore has a structure named "HitPoint") or in some other context like inside Blender with a textures ?

Internally, LuxCore has this kind of information, they are the differential DnDu and DnDv: how change the normal at the change of UV texture coordinates. A new texture node could use this information.
Support LuxCoreRender project with salts and bounties
User avatar
Egert_Kanep
Posts: 237
Joined: Tue Mar 13, 2018 10:34 am

Re: Curvature using hitpoint info

Post by Egert_Kanep »

Yes, I was thinking if it's possible to have/do it in blender with nodes. Just an exploration if this kind of thing is doable. I'm not entirely sure how it should work and my math is what it is :D. But the end goal is to have a better behaving curvature, perhaps something like arnold. Altough they seems to use some kind of raytraced solution I guess
https://docs.arnoldrenderer.com/display ... /Curvature

Another example -http://cmiss.bioeng.auckland.ac.nz/deve ... curvature/
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Curvature using hitpoint info

Post by Dade »

BTW, have you tried the Pointiness support ? From your links, it may be what you are looking for: https://wiki.luxcorerender.org/Shape:_Pointiness

I don't think it is possible to do anything with current texture nodes but it may be easy to add a new one that just export the "curvature" information. I will try to put something together.

P.S. all this gives me some idea on how to do "Bevel" support. My problem is I can't and don't want to tracing additional rays.
Support LuxCoreRender project with salts and bounties
User avatar
Egert_Kanep
Posts: 237
Joined: Tue Mar 13, 2018 10:34 am

Re: Curvature using hitpoint info

Post by Egert_Kanep »

Yes, I am aware of the pointiness node, but output isn't too great. But it would be great to have more math and technical stuff available in Blender as well.
Attachments
added 2 levels of subd. aplied modifier jsut in case
added 2 levels of subd. aplied modifier jsut in case
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Curvature using hitpoint info

Post by Dade »

Egert_Kanep wrote: Wed Oct 09, 2019 9:57 am Yes, I am aware of the pointiness node, but output isn't too great. But it would be great to have more math and technical stuff available in Blender as well.
it doesn't look right, can you post that test scene ?
Support LuxCoreRender project with salts and bounties
User avatar
Egert_Kanep
Posts: 237
Joined: Tue Mar 13, 2018 10:34 am

Re: Curvature using hitpoint info

Post by Egert_Kanep »

Here's the monkey with pointiness attached.

Edit: noticed that file didn't upload, now its should be ok
Attachments
suzanne_pointiness.blend
(4.73 MiB) Downloaded 117 times
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Curvature using hitpoint info

Post by Dade »

Not sure if this is what you are looking for but I usually use a "band" node, not a "remap" node for pointiness:

point.jpg
I noticed that if the pointiness multiplier is too high, there may be artifacts starting to appear like in your rendering, going to check if there is something wrong or it is just the 32bit floating point precision.
Support LuxCoreRender project with salts and bounties
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Curvature using hitpoint info

Post by Dade »

I may have found the problem: this suzanne model has apparently a LOT of duplicate vertices.

I was checking the Cycles code for pointiness and I noticed it has some specific code for handling coincident vertices like if they were a single vertex (so the curvature is not cracked).
Support LuxCoreRender project with salts and bounties
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Curvature using hitpoint info

Post by Dade »

Dade wrote: Wed Oct 09, 2019 3:39 pm I may have found the problem: this suzanne model has apparently a LOT of duplicate vertices.
@B.Y.O.B. I receive a mesh with 6531 duplicated vertices out of 36494 but if I do a "mesh => clena up => merge vertices by distance", Blender tells me there are no duplicates. What is going on ? Is it the result of some applied modifier :?:
Support LuxCoreRender project with salts and bounties
Post Reply