Gradient Interpolation Methods Formulas
Posted: 23 June 2022 11:16 AM   [ Ignore ]  
Total Posts:  1
Joined  2022-03-16

Hello there,

I am building an interactive prototype in C4D and need to translate some simple material settings in C4D to GLSL. I’m working with the Gradient Shader.

Please, does anyone know the exact formula used to create smooth/cubic/cubic bias interpolation methods? I’d like it to match 1:1 in my program. I assume smooth is the same as smoothstep() in GLSL, i.e. x*x*(3-2x) and would assume cubic to be x*x*x(3-2x) but what is weighted for cubic bias? I searched the help system and SDK, couldn’t find specfics.

Thanks so much!

Profile
 
 
Posted: 23 June 2022 01:52 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
Total Posts:  11951
Joined  2011-03-03

Hi leslievorreiter,

Please check the Developer Café.

https://developers.maxon.net
https://plugincafe.maxon.net

My best wishes for your project

Cheers

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES member

Photography For C4D Artists: 200 Free Tutorials. Texture, Panorama, HDRI, Camera Projection, etc.
https://www.youtube.com/user/DrSassiLA/playlists

Profile
 
 
Posted: 23 June 2022 11:39 PM   [ Ignore ]   [ # 2 ]  
Moderator
Avatar
Total Posts:  11951
Joined  2011-03-03

P.S.:
I have “Mac Gyvered” this curve, based on the gradient values (set to linear light space, and interpolation to Cubic Biased)
Just for fun, there is a Cubic curve as well in it.

All data is exported via Structure Manager as ASCI

Data, Cinema 4D file and screen shot. (File updated Friday June 11 11am PST)
https://www.amazon.com/clouddrive/share/tCOSLMntK7YrKv5OGX7tN8NvkUUMlOO4t1O00qNiCPV

I’m sorry that my suggestion from today here to ask in the Developer Café, has so far no answer created for you.

The formula in the file is a “Frankenstein curve”, not elegant. Perhaps you have a better idea based on my little support here. I hope this visual helps you to see the formulas needed for A or B, as mine is of course result based, not split in A/B contribution formulas.

I can’t see the formula
t*t*(3-(2*t))*100 [the white curve in the image]
would work here, see image, it is too strong.

But Mixed with a linear function x=y, it might for the “cubic”:
(t*t*(3-(2*t))*100)/2+(100*t)/2

t = 0 to 1

Or for the “Cubic Biased” it would be
(((pow(t;3))+(1-(pow(1-t;3))))*50)*0.25+(100*t)*0.75

Test this, as I have no data from any developer.


I understand that this is the resulting curve. You might look more for the left side or right side formula.
The one above represents the mixture of both.
I’m curious if the developers release our “trade-secret” of creating fine curves. wink

Enjoy

Image Attachments
Screen Shot 2022-06-24 at 10.34.41 AM.jpg
 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES member

Photography For C4D Artists: 200 Free Tutorials. Texture, Panorama, HDRI, Camera Projection, etc.
https://www.youtube.com/user/DrSassiLA/playlists

Profile
 
 
Posted: 24 June 2022 08:41 PM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
Total Posts:  11951
Joined  2011-03-03

Here is a curve creator.

https://www.amazon.com/clouddrive/share/rg8dg6hkQ1lLZb7XoC3ND0tV27SwTA8dPZEVXGRhMft

Adjust the User Data to your needs, then you can copy the Y(t) entry from the Formula Spline. Done.

Cheers

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES member

Photography For C4D Artists: 200 Free Tutorials. Texture, Panorama, HDRI, Camera Projection, etc.
https://www.youtube.com/user/DrSassiLA/playlists

Profile