Help - Search - Members - Calendar
Full Version: a shader each day
od[forum] > Art and Challenges > WIP
Pages: 1, 2
rdg
I want to learn this shading stuff.
So I try to dabble in a shader per day.
Small steps, probably without any recognizable pattern.

Day 1:
I think it's good to explore different shaders before trying to invent my own.
So I googled around and found this funny shader:
Constant Width Shaders! by Mach Kobayashi from Pixar Animation Studios [1]
The shader extracts a line with constant width from a noise field.

Click to view attachment

I got the - maybe false impression - that there is much more renderman information out there - so being able to convert a renderman shader to mantra vex surely cannot hurt.
Don't think I understood what's happening inside this shader.
There were few stumbling blocks:

* the renderman dPdu and dPdv - a deep look in the often underestimated Houdini help brought up:
vector dPdu = dPds/Du(s); and vector dPdv = dPdt/Du(t);

* renderman ^ and . - the . is a dot() and - thanks eetu! - the ^ is a cross()
I guess there is no need for guessing once I read the "Advanced Renderman" past page 133.

* mix() - Though a VOP VEX shader used mix() in the generated code I couldn't use it in mine.
This mystery will be solvable in the near future and in the meantime: a * (1 - m) + b * m mixes as well.


The orignal shader doesn't take any lights into account.
To be not just copying I added two lighting models: One for the base and one for the Tubes.
I also added an offset for the generated line. This allows growing patterns.
Using rest instead of P as base for the noise fixed the object moving through the noise.

The original shader creates a fake tube by bumping the tubes - this was lost somehow at some step ...

Animated: http://www.medikalesha.de/aShaderEachDay/20080422/
Click to view attachment
Click to view attachment


[1] http://renderman.org/RMR/Examples/srt2006/mach2006.ppt.gz



mark
one a day is a good idea smile.gif

you might want to search for some siggraph PDF docs on renderman shaders, theres one with a mango and (i think) banana shader which seem to convert ok.

Jason
Some info which might help you bridge the gap to Renderman, look at $HFS/houdini/vex/include/prman.h - which doesn't help with dot() and cross() due to limitations of the cpp preprocessor, but can provide insight to further mappings:

QUOTE("An excerpt from prman.h")
...
#define faceforward frontface
#define mix(aa,bb,cc) lerp(aa,bb,cc)
#define step(min,value) ((value) > (min))
#define smoothstep(aa,bb,cc) smooth(aa,bb,cc)
#define round(aa) rint(aa)
#define spline cspline
#define illuminate(xx,yy,zz)
#define solar(xx,yy) { L = -Lz; }
#define xcomp(aa) (aa.x)
#define ycomp(aa) (aa.y)
#define zcomp(aa) (aa.z)
#define cellnoise(aa) random(aa)
...
kumpa
Some time ago i had same idea, so i went to www.highend3d.com, downloaded few interesting shaders and recreated them in vex with various success.I ll try to find them, they hid somewhere.
edward
rdg, you mean you recreated the shader using RSL VOPs? As Jason, mentioned, $HH/vex/include is a good resource. There are files in there that get included with VOP generated shaders.
rdg
QUOTE(mark)
banana shader

There is already a Banana VOP node.

QUOTE(edward)
rdg, you mean you recreated the shader using RSL VOPs?


No, No - I created a VEX type surface shader Operator and crawled myself through the code in Mach's powerpoint presentation.
The main task in this exercise was to distinguish pattern vs shading and like Jason mentioned finding the correct mappings between RSL and VEX.
This lead to reading pages in the help that I would usually skip.
Now I know that points and normals need different transforms as they are not the same type of vector.




rdg
Day 2: A CMYK aware Shader

This shader allows you to input the color values in cmyk instead of RGB.
Was surely inspired by the announcement of Mario's speech about color spaces.

Click to view attachment Click to view attachment

As sphere/box swatches look rather boring on the long run - I decided to do a homage to Richard Minh Le's "Architecture of Color and Identity" [1]

Click to view attachment

The probably interesting part of this shader is the conversion of cmy to rgb in VOPs.
No color profiles are used.

Click to view attachment

PBR - somwhat better lighting - hm -somewhat
Click to view attachment

[1] http://www.richardml.com/
cellchuk
nice renders.
thumbsup.gif
Mario Marengo
Hey! Those look really nice, rdg. Nice job!
Allegro
Is that a typo on your parameters? cymk?
rdg
QUOTE(Allegro @ Apr 23 2008, 05:44 PM) *
Is that a typo on your parameters? cymk?


Oh! You are right - it's CMYK - but forward ever backward never.

Day 3: A Silkscreen Shader

This Shader simulates a silkscreen printed piece.
You feed it an image and it generates the colour seperation.

Click to view attachment Click to view attachment
Click to view attachment Click to view attachment

This interesting part was the RGB -> CMYK seperation.
It is a two step process: RGB -> CMY -> CMYK [1]
Again these process doesn't take any ICC or other profiles into account but does a good job for my purpose.
I used the inlineVOP as building a network for this function turned out to be too tedious.

Some matrix fun to rotate the four layers. Well, not that funny if you live in the matrix.

Click to view attachment

I guess this shader is going to play a major role in my new music video.

Click to view attachment

[1] http://easyrgb.com/math.php?MATH=M13#text13
Marc
Fantastic. Nice work Georg.
LEO-oo-
Cool! Weiter so wink.gif
stevenong
As always, good stuff Georg!

Thanks for sharing!

Cheers!
steven
pagefan
Nice work Georg. Sesi soon has a nice online library for their material palette.
rdg
Day 4

Todays shader drove me crazy.
I tried to build a texture bombing shader.
Instead of just compiling the one I found in the codex [1] I tried to rebuild it using additional information from the GEMs book [2]

It's definitely time for me to return to a texpad/vim/whatever based approach as connecting those boxes is really boring.
Especially if it doesn't work like expected.

Luckily Rob explained some mystery about tiling [3] but I couldn't figure out why I still get those annoying artifacts as soon as I try to add some random offset to my textures.

Click to view attachment

By now I tracked it down to the random function.
If I "manually" add a valid offset everthing is fine, if the offset is generated procedurally it wrecks.
I remember a section about random and vex and that there are some differences to real life ...

well, what was started as a "quick shader today" ended in angry.gif

Click to view attachment
Click to view attachment

Far from bombing.
Need a break.

[1] http://odforce.net/happy_rendering_with_vex/
[2] http://developer.download.nvidia.com/books...ugems_ch20.html
[3] http://forums.odforce.net/index.php?showtopic=6990&hl=
rdg
Day 5:
Tried to solve the dirt issue in my tiled shader.
I tried to blame rounding and/or float vs int but it didn't help.

Reducing the filter width in my textureVOP to zero removes the dirt.
I don't think it's good to jump over this issue as it will surely crush me from behind in the next days.

This is a simplified version of the shader:
http://forums.odforce.net/index.php?s=&...ost&p=47044
rdg
Day 5.1:

I tried to use 5 textures (letter.[1-5].rat) instead of one containing all 5 letters.
But this doesn't work, too.

the only explanation I have so far is:

Somehow my repeating uv coordinates run out of sync with the generate unique cell ID:

Click to view attachment Click to view attachment


Jason
QUOTE(rdg @ Apr 28 2008, 04:25 AM) *
Day 5.1:

I tried to use 5 textures (letter.[1-5].rat) instead of one containing all 5 letters.
But this doesn't work, too.

the only explanation I have so far is:

Somehow my repeating uv coordinates run out of sync with the generate unique cell ID:

Click to view attachment Click to view attachment


Are you getting a wrap-around on your uv's per cell? Perhaps each cell is 0 - 1 instead of 0 - 0.9999.
rdg
QUOTE(Jason @ Apr 28 2008, 05:40 PM) *
Are you getting a wrap-around on your uv's per cell? Perhaps each cell is 0 - 1 instead of 0 - 0.9999.


Aha. To be honest I am not sure what to say.
I always thought uvs ought to be 0..1 - but if they are 0..0.9999 this changes everything.
[world crumbles down]

it could also explain why printf() outputs something like this if I print the cell IDs:

11111 22222 33333
44434 55545 66656
77777 88878 99989

---

eetu suggested to use colormap() instead of texture() ... something I tried to avoid as I don't know what's the difference.
But if I do so the shader behaves like I want it to behave:

It takes an image like this:
Click to view attachment

and tiles it randomly to the object:
Click to view attachment

Click to view attachment

I'd rather understand why this is like it is.
But now I move on to the second level of "texture bombing"

cellchuk
QUOTE(rdg @ Apr 24 2008, 05:19 AM) *
Oh! You are right - it's CMYK - but forward ever backward never.

Day 3: A Silkscreen Shader

This Shader simulates a silkscreen printed piece.
You feed it an image and it generates the colour seperation.

Click to view attachment Click to view attachment
Click to view attachment Click to view attachment

This interesting part was the RGB -> CMYK seperation.
It is a two step process: RGB -> CMY -> CMYK [1]
Again these process doesn't take any ICC or other profiles into account but does a good job for my purpose.
I used the inlineVOP as building a network for this function turned out to be too tedious.

Some matrix fun to rotate the four layers. Well, not that funny if you live in the matrix.

Click to view attachment

I guess this shader is going to play a major role in my new music video.

Click to view attachment

[1] http://easyrgb.com/math.php?MATH=M13#text13

great shader man.
Andz
Really nice work rdg!

Reminds me a lot THIS texture for max.
Matt_K
Nice stuff!
Thanks for the effort!

Matt.
rdg
Day 6: Rotated Letters

Click to view attachment

Today I implemented the random rotation for cells.
Instead of using a matrix/rotateVOP I wanted to convert the rotate2D function from the vexnotes.h [1]

The Vop network for this rather "simple" function was very unclear and - guess what - didn't work.
After entangling myself I switched to inlineVOP again. Took some time though due to wrongly named variables.

I am sorry for the rather sluggish network ... it's getting messier every day.
But I need to do some other stuff, too - happens seldom enough.

Click to view attachment
(requires letters.rat from one of the previous posts)

Tomorrow's shader might include the scaling part of texture bombing.
I try to combine all those techniques into a silkscreen shader that uses letters/symbols instead of dots.

[1] http://odforce.net/happy_rendering_with_ve.../vexnotes.h.htm
rdg
Day 7: Letter Clusters

I implemented the next step for texture bombing:
Layering different layers of random textures.

Click to view attachment

I must admit I didn't quite get the forLoopVOP at first glance.
Still there are some unresolved issues as the system outputs nice images, but not the one I would expect.

Click to view attachment

today's hip file is just for archiving.
I will rework this texture bombing lecture from the ground up now that I think I got it.

There won't be any updates for some time as I'll be on holidays and visit FMX next week.

Cheers,

Georg
sanostol
have fun at the fmx smile.gif

You are doing great stuff here!

martin

QUOTE(rdg @ Apr 29 2008, 11:42 PM) *
Day 7: Letter Clusters

I implemented the next step for texture bombing:
Layering different layers of random textures.

Click to view attachment

I must admit I didn't quite get the forLoopVOP at first glance.
Still there are some unresolved issues as the system outputs nice images, but not the one I would expect.

Click to view attachment

today's hip file is just for archiving.
I will rework this texture bombing lecture from the ground up now that I think I got it.

There won't be any updates for some time as I'll be on holidays and visit FMX next week.

Cheers,

Georg

crunch
QUOTE(rdg @ Apr 28 2008, 04:45 AM) *
Day 5:
Tried to solve the dirt issue in my tiled shader.
I tried to blame rounding and/or float vs int but it didn't help.

Reducing the filter width in my textureVOP to zero removes the dirt.
I don't think it's good to jump over this issue as it will surely crush me from behind in the next days.


The texture() function uses the surface derivatives to sample an area of the texture map.

My guess is that what you're experiencing is most likely due to the fact that you're using a modulo function, or some other function which has discontinuities.

What you might try doing is using passing the derivative information manually to the texture function(with the appropriate wrap mode of course).

The key explanation is in that ASCII art

CODE
    float    ss, tt;    // Texture coordinates
    float    dsdu, dsdv;
    float    dtdu, dtdv;

    // Approximate rectangle of coordinates *before* modulo operation
    dsdu = .5*Du(ss);
    dsdv = .5*Dv(ss);
    dtdu = .5*Du(tt);
    dtdv = .5*Dv(tt);

    // Now perform modulo
    ss = ss % 1;
    tt = tt % 1;

    // Consider the case where we were shading the micropolygon.  The
    // ss coordinates across the micropolygon are something like
    //
    // Before the modulo
    //     ss=0.99 +---+ ss'=1.01
    //
    // The derivative is (ss' - ss) = 0.02
    //
    // After the modulo
    //     ss=0.99 +---% ss'=0.01
    //
    // The derivative becomes (ss' - ss) = 0.98
    //
    // So, the default texture function will end up filtering the
    // entire texture into that little seam at the edge of the map.
    //
    // The alternative is to manually specify the area that we want to
    // filter (based on the pre-computed derivatives).
    
    // Now, manual specify the four corners of the texture area to be
    // filtered, something like...
    Cf = texture( map,  ss-dsdu-dsdv, tt-dtdu-dtdv,
            ss+dsdu-dsdv, tt+dtdu-dtdv,
            ss+dsdu+dsdv, tt+dtdu+dtdv,
            ss-dsdu+dsdv, tt-dtdu+dtdv, ...);


I hope this makes sense.
rdg
QUOTE(crunch @ May 1 2008, 05:05 PM) *
I hope this makes sense.


It makes sense, I just need to implement it.
I had the luck to be with oldschool at the FMX, where he told me that one usually multiplies the modulo with 0.995.
Which also makes absolutely sense to me, but doesn't change anything ... I guess I misunderstood something.

As FMX also washed me to the Glasgow shores - if it got any - I will need some time to acclimate, before I return to this tai-chi like lessons.

Georg
rdg
Day 8: Chimera

Implementing isn't the right term as I just copied your code.
I am slowly understanding it.

Click to view attachment

oldschool also thought me that switches are no good.
So I changed them to filtersteps with very small filter width.

The aliasing is coming from the texture itself.
I used a a set of images from the "processing book" by Ben Fry and Casey Reas[1].

So the texture template looks like this:

Click to view attachment

The bombs get combined from two different slices.

Click to view attachment
Click to view attachment
Click to view attachment

I try to clean up the code - which is very messy - the next days.

[1] http://www.amazon.com/Processing-Programmi.../dp/0262182629/
Andz
Sheepgun, Snailphone and Chickenmug :-)

This is something completely new to me, that I didn't even know it was possible to do with textures.

That processing book looks really tempting, do you like it?
rdg
QUOTE(Andz @ May 18 2008, 03:19 PM) *
That processing book looks really tempting, do you like it?


It depends.
If you are looking for 3D algorithms: no.
If you have an affinity to reading pages of simple code examples: yes.
If you are teacher or interested in teaching "language like programming environments" - and I definitely would put Houdini here: YES.

There are a lot of good paragraphs about teaching and learning complex systems in it.
Mario Marengo
QUOTE(crunch @ May 1 2008, 11:05 AM) *
The texture() function uses the surface derivatives to sample an area of the texture map.

My guess is that what you're experiencing is most likely due to the fact that you're using a modulo function, or some other function which has discontinuities.


Hey crunch,

I just read your post, and everything you say makes perfect sense, but I think that what rdg is seeing is a different issue (related perhaps, but different). I made some tests and would love to hear your take on this.

In the "classical" bombing scenario, you set up a virtual grid of cells over the bound texture uv's. Each cell is a 1X1 domain where each bomb is placed. Each bomb's extent is restricted to a maximum size of 1X1 and allowed to be placed at a random location within the cell (which implies the need for a unique ID or random seed for each cell). The shader then loops over a 3X3 cell neighborhood (to allow for overlaps) placing a bomb in each cell. This is different from a pulse train where a modulo would be involved (and be subject to the issues you mentioned).
Here's a simple version of that classical setup:
CODE

surface bomb2(
string map = "";
float bfreq_u = 10;
float bfreq_v = 10;
vector uv = 0;
)
{
// incoming uv's
float u=s,v=t;
if(isbound("uv")) { u=uv.x; v=uv.y; }
// underlying bombing uv's
vector buv = set(u*bfreq_u, v*bfreq_v, 0);
// central cell coords in the virtual grid
vector cell = floor(buv);

vector C = 0; // final bomb color

// loop over the 9-cell neighborhood centered at 'cell'
float i,j;
for(i=-1;i<=1;i+=1) {
for(j=-1;j<=1;j+=1) {
// c = the test cell
vector c = cell+set(i,j,0);
// p = the bomb pos within the test cell
vector p = c + random©*{1,1,0};
// texture coords relative to bomb position
vector tp = (buv-p)+{.5,.5,0};
float du = abs(Du(tp.x))*.5;
float dv = abs(Dv(tp.y))*.5;
if(tp.x>=-du && tp.x<=1+du && tp.y>=-dv && tp.y<=1+dv) {
if(map!="") {
vector4 Ctx = texture(map,tp.x,tp.y,"mode","black");
C = lerp(C,(vector)Ctx,Ctx.w);
} else {
float a = (filterstep(0,tp.x)-filterstep(1,tp.x)) *
(filterstep(0,tp.y)-filterstep(1,tp.y));
C = lerp(C,set(tp.x,tp.y,0)*a,a);
}
}
}
}
Cf = C;
}

If you don't give it a texture map it displays each bomb's uv space -- easier to see the problems this way, and there's not texture() call involved. So, at default, that shader produces this result:
Click to view attachment
The artifacts are aligned to the cell boundaries, and the way I read it is that they're caused by the floor() and random() functions having infinite frequency at those boundaries -- i.e: the assignment to 'cell' will jitter wildly when crossing these regions and so will the entire 3X3 neighborhood as a result.
The problem is... I can't think of any way to avoid this (at least not within the structure of this classic algorithm). As given, it depends on a unique ID/seed per cell, but by definition, all the tools we can use to generate such an ID will be unstable at the cell boundaries.

And that's my question: can you think of a way to avoid this problem while keeping the overall cell-based approach?

The only way I could come up with involves completely changing the algorithm: Erasing the boundary/cell dependency by generating all points at all times... not as expensive as it may sound, but a different approach altogether:
CODE

surface bomb3(
string map = "";
float bfreq_u = 10;
float bfreq_v = 10;
vector uv = 0;
)
{
// incoming uv's
float u=s,v=t;
if(isbound("uv")) { u=uv.x; v=uv.y; }
vector buv = set(u*bfreq_u, v*bfreq_v, 0);

vector C = 0; // final bomb color

// loop over all bomb positions
float i,j;
for(i=-1;i<=bfreq_u;i+=1) {
for(j=-1;j<=bfreq_v;j+=1) {
// bomb pos
vector p = random(set(i,j,0))*{1,1,0}+set(i,j,0);
// texture coords relative to bomb position
vector tp = (buv-p)+{.5,.5,0};
float du = abs(Du(tp.x))*.5;
float dv = abs(Dv(tp.y))*.5;
if(tp.x>=-du && tp.x<=1+du && tp.y>=-dv && tp.y<=1+dv) {
if(map!="") {
vector4 Ctx = texture(map,tp.x,tp.y,"mode","black");
C = lerp(C,(vector)Ctx,Ctx.w);
} else {
float a = (filterstep(0,tp.x)-filterstep(1,tp.x)) *
(filterstep(0,tp.y)-filterstep(1,tp.y));
C = lerp(C,set(tp.x,tp.y,0)*a,a);
}
}
}
}
Cf = C;
}

Click to view attachment
This "fixes" the problem (doesn't really, just walks around it trying to ignore it smile.gif ), but it has some drawbacks: The concept of "frequency" goes out the window (I just kept the parameter names for convenience), and the bombing domain is fixed (could be parameterized though).
Anyhoo... I'd love it if someone could come up with a *real* fix to the first version. So far, I got nothin' sad.gif
rdg
hm.

I always wondered why my shader doesn't use this 3x3 grid techniques biggrin.gif
Might be caused by my reference - the vex bomber in the wiki - which uses layers.

Mario also kindly started to explain and discuss some "point cloud bases decal scattering" techniques.
Which should lead to some results in the near future.

Potential uses for "pcdb - point cloud decal bombing" might be adding details to large textures without the need of high resolution texture maps. Or maybe some radar shader that traces positions/silhouettes of ships/planes onto a radar screen.

Greetings from Glasgow

Georg
rdg
Day 9: Constant width sprite outlines [1st try]


Peter Robbins asked me about a shader that renders sprites as if they were selected in the viewport.

I used four filterstep functions to create the outline.
The width is modulated by the spritescale ... in least in theory ... something went wrong and a few of the sprites get thicker outlines.

My good old friend the derivative seems to contribute to this game and adds some variations ...
Anyway ...

I added a VOPSOP template to generate sprite properties without using a popnetwork.

Click to view attachment
Andz
Hey RDG, nice to see this thread up and running again ;-)

Realy nice image you got there, if it wasn't for the depth of field, I'd say that is looks a lot like a vector illustration.

Keep up with your research!
Jason
QUOTE(rdg @ Jul 25 2008, 10:59 AM) *
My good old friend the derivative seems to contribute to this game and adds some variations ...
Anyway ...

So do your results get much better (cleaner, more consistent) if you bump your shading quality to 2 or 3 or so?

I've seen shading quality make a huge difference to a lot of those NPR style renders. It's probably worth making a material which always has a boosted Shading Quality by default, I think.
rdg
Andz,
Thanks for waiting - I missed me too sad.gif
I finally found my way to "tchainova" - a tea pub across the street, that offers: "buy some tea - get wifi free".

Day 10: dashed selected sprites



The boxVOP seems to produce far more stable results. I'll try Jasons shading quality tipp next - and rework my "constant width" approach.
Also I need to copy the derrivate snipped to test it with this shader ...
The boxVOP is mixed with a wirepatternVOP to generate the dashes.

...

Yes, upping the shading quality makes a difference ... thanks Jason!
So many parameters, so little time.


Day 11: RDGautomaton - not a shader




This no shader at all. It's a pythonSOP that generates cellular autmatons as descibed in "A new kind of science" [1].
I get the impression that a VOPSOP might be way faster. It's b/w as I didn't understand how to multiply colors in python.

[1] http://www.wolframscience.com/nksonline/toc.html
rdg
Errata Day 9:

After having a second look at my "constant border width":
I completely forgot about Z - and I guess the borders have a constant with - the distance to camera makes them fade.
Therefore my next version should take Z into account.
Day 10 version looks like constant width as the width is just 0.01 s/t and in almost any case will be rendered as just one pixel.
ykcosmo
wow, very cool!!!
rdg
Another Day

I had the chance to speak as an opening act for "Oldschool Blog Live!" at Siggraph2008.



The presentation was about cellular automata as an example of Houdini's workflow: creating complex results from rather basic rules.
You can download the presentation, the OTL and a example file from the exchange:
http://www.sidefx.com/index.php?option=com...er&Itemid=8

As a bonus for my loyal odforce readers - here is the annoymentSOP:
Click to view attachment

It utilises the new 9.5 scriptSOP - just dive into the network and press play.

Cheers,

Georg
Jason
QUOTE(rdg @ Aug 18 2008, 12:56 AM) *
Another Day

I had the chance to speak as an opening act for "Oldschool Blog Live!" at Siggraph2008.


Well done and congratulations on your presentation! I'm sorry we didn't get a chance to meet up at SIGGRAPH..

This thread is very cool, by the way. Keep it coming:)
rdg
Day 10: Lorem Ipsum was my Cradle Song



Slowly occluded toNDC() bricks with a hint of rotate().

Surprisingly bricksVOP got it's own lighting model, which I had to bypass to make it working without lights.
Most of the luminance() calls can be disregarded by working with floats instead of colors - I was just to lazy to substitute the brickVOP with something more efficient.

Click to view attachment
rdg
Day 11: XOR

hm ... not even sure if this is XOR but let's pretend it is ...



A shader that emulates basic/java/flash boolean diplay writing.

eetu commented:
"(12:25:28 AM) eetu: yea, tracing sounds a tad overkill smile.gif"
Well, but how to cookie this?



I first felt that this is the time for gather() ... but ...
Reading some of Mario's posts I guess a gather needs a rayimport and both can be in the same shader ...
Anyway a trace() looked quite right once I transformed my direction vector into space:current.

But now:



The same struction from above.
Some raytracing limit? Just right as eetu suggested?
I guessed that I need to limit my rays to exactly one hit, but this wan't work probably as the shading works top down.
XOR works bottom up.

Well, this is 3D and I'm not limited to Y down cameras ...
This is a shaded XOR and DOF:



this is the base geometry:



My shaders still look better without lighting model ...



...

Click to view attachment
Andz
Is RDG a poet or a philosofer? cool.gif
rdg
Day 12: RDG vs Easing Functions

This not a shader.

Click to view attachment

It's my first canny steps into the HDK.
I 'implemented' some easing functions as described e.g. at actionscript.org[1]


Not yet the standart Robert Penner Easing Functions [2] - most likely caused by my lack of c/c++ knowledge.
Thanks to Chip Collier and Mark Elendt I was able to have a function that takes more than two arguments biggrin.gif

I compiled these on openSuse 10.3 64bit - I guess for other plattforms you have recompile them.
There is also a exhelp file, but how this might be merged to other existent files is a mystery to me.
It works fine, as I don't have any other exhelp files in $HOME/houdini9.5/help

Adds
* rdgeasein()
* rdgeaseout()
* rdgeaseexp()
* rdgeasecirc()
* rdgeasesin()

see exhelp rdg for details

Click to view attachment

[1] http://www.actionscript.org/resources/arti...ning/Page3.html
[2] http://www.robertpenner.com/easing/
Mario Marengo
QUOTE(rdg @ Oct 3 2008, 02:07 PM) *
Day 12: RDG vs Easing Functions


Hey rdg,

Looking good, but how are you implementing your ease function?
I haven't looked at your references, but AFAIK, the whole point of an ease() function (as an interpolation, not a spline) is that the slope at both ends is zero (a cubic spline with dydx=0 at the ends). I don't see that in your image (but maybe there aren't enough divs to show it?)... just curious.
rdg
QUOTE(Mario Marengo @ Oct 3 2008, 08:23 PM) *
Hey rdg,

Looking good, but how are you implementing your ease function?
I haven't looked at your references, but AFAIK, the whole point of an ease() function (as an interpolation, not a spline) is that the slope at both ends is zero (a cubic spline with dydx=0 at the ends). I don't see that in your image (but maybe there aren't enough divs to show it?)... just curious.


ohm ... ahm ... well
What? blink.gif

I guess easing might be the wrong term then.
The functions (easein, easeout, easeexp, easecirc, easesin) interpolate between 0...1.
E.g. :
fn easecirc(v) = -sqrt(1-v*v)-1;

Can the slope in an easein be zero at the end?
Mario Marengo
QUOTE(rdg @ Oct 3 2008, 02:38 PM) *
ohm ... ahm ... well
What? blink.gif


For those not on IRC... smile.gif
I'm aware that there are an infinite number of ways to interpolate two values, and all these ways are valid. So there's nothing "wrong" with your function (I never said there was). However, it doesn't resemble Houdini's "ease" function, and I thought that was perhaps what you were striving to get.

Ease:
3 x2 - 2 x3

And ease with "bias" or "power ease":
3 x2*bias - 2 x3*bias

And the easep() family (second function above) looks like this:

Click to view attachment
rdg
QUOTE(Mario Marengo @ Oct 3 2008, 09:19 PM) *
However, it doesn't resemble Houdini's "ease" function, and I thought that was perhaps what you were striving to get.


I did't want to resemble Houdini'S ease, which I never got to work in SOPs btw.
The functions I compiled are more like shortcuts to different interpolation methods.
Mario Marengo
QUOTE(rdg @ Oct 3 2008, 02:38 PM) *
fn easecirc(v) = -sqrt(1-v*v)-1;


Just doodling here...
Seeing as that function there is a 90 degree arc of a circle sqrt(1-(1-x)2), it occurred to me that there's a natural way to parameterize it...
Here's a "power" version of your "easecirc()" function:

easecircp(x) (always assuming x in [0,1], and bias>0):
pow(1-pow(1-x,bias), 1/bias)
This one is linear at bias=1, circle-arc (like yours) at bias=2, and inverse arc at bias=1/2.

Click to view attachment

One more for your collection smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.