Jump to content

Procedural shader aliasing problems


lisux

Recommended Posts

Hi houdinks.

I am trying to add detail to very low resolution gmetry of a fern.

The idea is that all the details should came from a displacement/bump shader, usign a map or using a procedural.

To get the veins pattern I have reuse the leaf material that came with Houdini, which is a sine based pattern that simply apply a sine function to make the veins.

Also the surface is glass, so is like a fern made of glass.

The problem with the procedural way is the these kind of patterns, and specially with tis high frequency detail in a glass surface is creating a lot of alias/flickering, the look in a still image is great but when the geom is moving problems begin.

So anyone have tried to solve the aliasing problems with sine based patterns before?

I have attached an scene where the fern geo is using a material with the default glass shader and the problematic displacement shader, I have also included the VOP Network so anybody can have a better idea about the problem.

Thanks a lot.

testLeafPattern.hip.zip

Link to comment
Share on other sites

At a glance, there are at least two things that jump out as being aliasing sources:

1. The Trig VOP does not filter.

2. The Absolute VOP does not filter either.

The funny thing is that the main VOP header file "$HH/vex/include/voplib.h" does have a filtered version of sin() and cos() (the functions are called vop_FilteredSin() and vop_FilteredCos()), but they haven't made a VOP wrapper for them -- meaning you'd have to call them from an inline vop.

Unfortunately though, instead of just computing the integral analytically and calling it a day, they then also go ahead and fade it to the average value (which for these functions is zero), and which IMHO is just wrong -- the visual result is that your sine-based features will go completely smooth way faster than they should. I have no idea why they've done this, but I wouldn't use it as is; just write your own without the fade-to-average bit.

Bad news #3 is that voplib.h has no filtered abs(), so you have to write that one yourself as well.

Anyway, I added a quick Inline VOP that computes a filtered version of abs(sin(x)), and this seems to cure most of the aliasing. I did notice some other VOPs (like filterstep) in there that may need some love as well, so this may not be a complete fix.

testLeafPattern_mario.hip

I left the control for the filter width as a constant VOP in there, but feel free to make it a parameter.

HTH.

Link to comment
Share on other sites

Hi Mario.

Thanks for he help to busy that I forget respond this.

Well, at the moment I have solved the problem using texture maps that renders nicely.

But it hard to get the same detail as with the procedural pattern.

Hopefully tomorrow I can take a look at your shader and to give to the procedurl pattern another chance.

Ths

Link to comment
Share on other sites

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...