View Full Version : ctrl_approximations

10 October 2006, 03:05 AM
ctrl.approximations is a geoshader that implements mentalray flagged
approximations. it means that you can supply different subdivision levels
to your geometry depending if it is seen by a visible trace shadow gi or
caustic ray. it does not work with subdivision surfaces as xsi does its
own things and do not rely on mr subd. but can be used on displace
and nurbs surfaces. we did it because of displacement in 'fuzzy' env
like those with huge area lights and glossy reflections. there infact
instead to supply the same approximation also to trace and shadow
rays we pass a more coarse approx just for reflections and shadows.
infact as they are fuzzy the results are almost identical to those with
no flagged approx that pass the whole subdivided geometry as seen
by visible rays. this isn't necessary most of the times. we'll get lower
render times and a more coherent scene, meaning less sample for
area lights and glossy reflections.

here for example we have an orrible 3mil (once subdivided for displace)
poly rock potato like. it corresponds to a max level of 5 with a subpixel
edge of 0.5. now the scene is a fg scene, with area lights and glossy
reflections. to the trace and shadow flags we only pass a 2 subd level
with no subpixel displacement. the render when the memory fits will be
more rapid and the results more consistent.

a couple of annoying problems are:
- you have to have a geo primitive in the scene before the geometry
you're going to approximate. ie, if you have already your geometry in
the scene, first put a geoshader then duplicate your geometry and
delete the old one. this will be fixed for the final release.
- you have to tweak that damn maxdisplace parameter from the geo
approximation you applied in the standard xsi way because with the
ctrl.approx maxdisplace only works for nurbs surface.

( the shader and the video (


10 October 2006, 03:38 AM
Wow!!! Looks awesome! any "different application" version?


10 October 2006, 04:13 AM
ehy, I forgot to add that the String parameter works for multiple
objects in the list. ie, if you have 8 objects in the ctrl.approx list
in the string param you can supply 8 different values that will map
each object, so that you can use ctrl.approx as a geoapprox hub
where ctrl multiple geometries, just use ';' to separate them...
4;3;4;4 .... if from the displace string, will apply respectively
4 max subd for the first object in the list, 3 for the second...

you can exclude objs just by playing with the param, no
need to delete them from the list.

for fast interaction you can disable on the fly the displacement
of all the obj in the list, with disable.displace.

global approximations are also supported. they will be applied to
all the objects in the scene having displacement, not only to
those in the ctrl.approx list. same for global maxdisplace.

there's a huge verbose to show you what's happing under the
belly. just enable the xsi logmessage 'info' and check verbose in
the ctrl.approx main tab. then fire up the script editor.


>any "different application" version?
do you mean maya ? not for now as it's crashing lwith some queer msgs.

10 October 2006, 06:24 AM
Wow- this is great- I have a large scene with quite a bit of displacement etc. I was just going to use passes to try and work around things like this...but now I've got another tool and it's awsome!

Thanks again!

10 October 2006, 09:33 AM
Hi francesca !

That's great new toys you offer us.
I will do some test very soon.

I have a quick question, is it possible to be able to map the Ray offset parameter ?
I was thinking to use my displacement map as an offset.

Actually that remind me a paper that I read on Shrek 2. They use low res geometry to generate all Irradience and raytracing pass and apply it on the Displaced geometry via an offset of the ray.

10 October 2006, 09:43 AM
will there be maya version? :)

10 October 2006, 01:14 PM
yet another MR optimization! Is there no end to your excellent ideas?
Do you think it would ever be possible to bring your numerous shaders and/or geoshaders into some sort of phenomenon, where all could be accessed at once. Is this something that would be easy for the user to create? Not that it's too much trouble to grab a node and drop it onto my render tree......


10 October 2006, 03:55 PM

This will help me a lot!


10 October 2006, 06:16 PM

I have a quick question, is it possible to be able to map the Ray offset parameter ?
yep, but not here. here it is for the whole object as we add
just the 'ray offset' statement to the geometric object. you
can do it in your own shader with the function mi_ray_offset();

Do you think it would ever be possible to bring your numerous shaders and/or geoshaders into some sort of phenomenon, where all could be accessed at once. Is this something that would be easy for the user to create? Not that it's too much trouble to grab a node and drop it onto my render tree......
ehy I just did it the passed weekend. I have to add some things
but I will post it asap. for example you'll have access to the
ctrl.approx via the property menu, and from there the first problem
I mentioned above will be fixed because it will the plugin doing
something to get it corrected. another example is if you have a
geometry selected and a light, picking the geolight shader it will
automagically do all the things you need to have a geolight in the
scene; you have a bunch of object selected, but also a light.. by
clicking for example ctrl.occlusion, the light will be included in
the direction tab, that means you can do a shadow pass with
two clicks. 'shading+irradiance' will build up the correct rendertree.
'layered for output' will build a layered material suitable to be used
with userframebuffers.. and so on. there will be also a couple of


10 October 2006, 03:18 AM
Very very nice tool! After watching the video tutorial, it was very clear what you're trying to achieve. I see now that the sub-division level of the reflection and the sub-d level of the shadow need not be the same as the visible object when using diffused shadows and reflection blurring. very, very cool. Downloading it now.

10 October 2006, 04:44 PM
Grazie! one more time francescaluce :)

10 October 2006, 07:39 PM
Arr, I hate to say that again and do not contribute to the thread, but rapidshare is no go over here (it doesn't like BT internet, seems like).
Anyway, Francesca. that looks like a great tool, if someone would be so kind and host it on some other site, would be great!

10 October 2006, 09:17 AM
I can put it on my server, but I get no go on rapidshare too.
So, if Francesca could send it for me to publish it then, I (as well as others) can watch it too.

10 October 2006, 05:24 PM
I'm probably stating the obvious here, but I had to learn the hard way. If you want to use ctrl_approx with other geo shaders (ctrl_multidisplace for example), then they must both be applied to seperate geometry shader primitives and NOT stacked on the same one.

10 October 2006, 12:43 AM
ehya, new link.


10 October 2006, 02:16 PM
Thanks a lot Francesca, link works! Will do some testing during the week.

11 November 2006, 06:30 PM
Thanks again for this!
It's great fun for displacement freaks like me. Here's one with GI+FG, Glossy reflections, SSS, area lights and displacements on every surface (no bumpmaps):

Here's the wall clock and tesselation results:

Yeah, it's a bit of overkill, but I'm just trying to break MentalRay!

11 November 2006, 12:22 PM
Brilliant, lots of optimizing options now-Thanks!

CGTalk Moderation
11 November 2006, 12:22 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.