Forums

You are not logged in.

#1 2012-07-13 14:52:53

BenR
Member
Registered: 2009-02-22
Posts: 19

Ambient occlusion in SI 2013

3Delight (3.1.10) seems to have a problem with the Ambient Occlusion shader in SI 2013(sp1).

Messages are:

' WARNING : 3Delight: unable to compile shader DefaultLib_AmbOccMat
' INFO : F:\\Anatomy\\liposomes_3\\3Delight\\shaders\\DefaultLib_AmbOccMat_surface.sl: in function DefaultLib_AmbOccMat_surface
' INFO : F:\\Anatomy\\liposomes_3\\3Delight\\shaders\\DefaultLib_AmbOccMat_surface.sl:75: ERROR: invalid number of arguments for 'XSIAmbientOcclusion' function (expected 12 arguments, but given 13)
' ERROR : 3Delight: S2050: cannot find shader 'DefaultLib_AmbOccMat_surface', will use 'defaultsurface'

Thanks,
Ben

Offline

 

#2 2012-07-13 19:57:41

gducatel
Beta tester
From: Montreal
Registered: 2007-11-13
Posts: 56

Re: Ambient occlusion in SI 2013

Hi change the code of the following file"XSIAmbientOcclusion.sl", with this one and it should fix your issue:

/*
    Copyright (c) 2007 TAARNA Studios International.
*/

#ifndef __XSIAmbientOcclusion_sl
#define __XSIAmbientOcclusion_sl

void XSIAmbientOcclusion(
    float i_samples;
    RGBA_COLOR( i_bright );
    RGBA_COLOR( i_dark );
    float i_spread;
    float i_max_distance;
    float i_reflective;
    float i_output_mode;
    float i_occlusion_in_alpha;
    float i_ao_interaction; /* Not Used */

    output color o_result;
    output float o_result_a; )
{
    extern point P;
    extern normal N;

    normal Nf = ShadingNormal( normalize(N) );   

    float maxdist = i_max_distance == 0 ? 1e38 : i_max_distance;

    uniform float algorithm = 1; /* default is raytracing */
    uniform float maxsolidangle = 0.1;
    option( "user:xsi_cb_algorithm", algorithm );
    option( "user:xsi_ao_maxsolidangle", maxsolidangle );

    float occ;

    if( algorithm == 2 )
    {
        /* Point-based */
        uniform string bake_file = "";
        option( "user:bake_file", bake_file );

        occ = occlusion(
            P, Nf, i_samples,
            "pointbased", 1,
            "clamp", 1,
            "filename", bake_file,
            "coordsystem", "world",
            "coneangle", i_spread * PI * 0.5,
            "maxsolidangle", maxsolidangle,
            "maxdist", maxdist );
    }
    else
    {
        /* ray-traced */
        uniform string hitmode = "primitive";
        attribute( "user:occlusion_hitmode", hitmode );

        uniform float falloff = 0;
        uniform float falloffmode = -1;
        attribute( "user:xsi_falloff_type", falloffmode );
        if( falloffmode != -1 )
            attribute( "user:xsi_falloff_exponent", falloff );

        /* Take maxdist from attribute if not 0 */
        uniform float attr_maxdist = 0;
        attribute( "user:xsi_maxdist", attr_maxdist );
        if( attr_maxdist != 0 )
            maxdist = attr_maxdist;

        occ = occlusion(
            P, Nf, i_samples,
            "coneangle", i_spread * PI * 0.5,
            "distribution", "uniform",
            "maxdist", maxdist, "hitmode", hitmode,
            "falloffmode", falloffmode, "falloff", falloff );
    }

    RGBA_MIX(o_result, i_bright, i_dark, occ);
}
#endif

Offline

 

#3 2012-07-16 09:05:15

BenR
Member
Registered: 2009-02-22
Posts: 19

Re: Ambient occlusion in SI 2013

Thanks gducatel. That works great!

Offline

 

#4 2012-07-19 06:06:40

Archer}
Member
Registered: 2010-01-13
Posts: 22

Re: Ambient occlusion in SI 2013

And here's addition for WORKING reflective AO



#ifndef __XSIAmbientOcclusion_sl
#define __XSIAmbientOcclusion_sl

void XSIAmbientOcclusion(
    float i_samples;
    RGBA_COLOR( i_bright );
    RGBA_COLOR( i_dark );
    float i_spread;
    float i_max_distance;
    float i_reflective;
    float i_output_mode;
    float i_occlusion_in_alpha;
    float i_ao_interaction; /* Not Used */

    output color o_result;
    output float o_result_a; )
{
    extern point P;
    extern normal N;

    normal Nf = ShadingNormal( normalize(N) );   

    float maxdist = i_max_distance == 0 ? 1e38 : i_max_distance;

    uniform float algorithm = 1; /* default is raytracing */
    uniform float maxsolidangle = 0.1;
    option( "user:xsi_cb_algorithm", algorithm );
    option( "user:xsi_ao_maxsolidangle", maxsolidangle );

    float occ;

    if( algorithm == 2 && i_reflective == 0 )
    {
        /* Point-based */
        uniform string bake_file = "";
        option( "user:bake_file", bake_file );

        occ = occlusion(
            P, Nf, i_samples,
            "pointbased", 1,
            "clamp", 1,
            "filename", bake_file,
            "coordsystem", "world",
            "coneangle", i_spread * PI * 0.5,
            "maxsolidangle", maxsolidangle,
            "maxdist", maxdist );
    }

else if( algorithm == 2 && i_reflective == 1)
       {
    /* Point-based reflective AO */

       uniform string bake_file = "";
       option( "user:bake_file", bake_file );

       string distribution = "cosine";
       normal Nn = normalize(N);
        vector refl = reflect(I, Nn);
       
        occ = occlusion(P, refl, i_samples, "pointbased", 1,"filename", bake_file,
                        "distribution", distribution,
                          "clamp", 1,
                        "maxdist", maxdist,
                    "coneangle", i_spread * PI * .5,
                        "maxsolidangle", maxsolidangle);
       Ci = 1 - occ;
        Ci *= Os;
        Oi = Os;
    }
    else
    {
        /* ray-traced */
        uniform string hitmode = "primitive";
        attribute( "user:occlusion_hitmode", hitmode );

        uniform float falloff = 0;
        uniform float falloffmode = -1;
        attribute( "user:xsi_falloff_type", falloffmode );
        if( falloffmode != -1 )
            attribute( "user:xsi_falloff_exponent", falloff );

        /* Take maxdist from attribute if not 0 */
        uniform float attr_maxdist = 0;
        attribute( "user:xsi_maxdist", attr_maxdist );
        if( attr_maxdist != 0 )
            maxdist = attr_maxdist;

        occ = occlusion(
            P, Nf, i_samples,
            "coneangle", i_spread * PI * 0.5,
            "distribution", "uniform",
            "maxdist", maxdist, "hitmode", hitmode,
            "falloffmode", falloffmode, "falloff", falloff );
    }

    RGBA_MIX(o_result, i_bright, i_dark, occ);
}
#endif

Offline

 

#5 2012-08-16 05:45:06

gonul
Member
Registered: 2011-01-04
Posts: 21

Re: Ambient occlusion in SI 2013

gducatel : Thanks...
Archer} : Not working :(
---------------------------

Why this is happening when you are with mblur and ambient occ ? GI on or off same result.
Mentalray normally.

3Delight
http://img29.imageshack.us/img29/7770/3delightgionmblurandaoc.png


Mentalray
http://img338.imageshack.us/img338/3153/mrfgonmblurandaocc.png

Last edited by gonul (2012-08-16 06:00:40)

Offline

 

#6 2012-08-16 07:20:07

gducatel
Beta tester
From: Montreal
Registered: 2007-11-13
Posts: 56

Re: Ambient occlusion in SI 2013

Hi, are you using PTC or RT for the OCC?

Offline

 

#7 2012-08-17 04:03:15

gonul
Member
Registered: 2011-01-04
Posts: 21

Re: Ambient occlusion in SI 2013

Hi gducatel. I' am using PTC. There is a problem, but without using GI.


3Delight without GI

http://img259.imageshack.us/img259/9833/3delightgioffmblurandao.png

Offline

 

#8 2012-08-17 06:17:10

victor
Member
Registered: 2009-01-26
Posts: 93
Website

Re: Ambient occlusion in SI 2013

gonul wrote:

Hi gducatel. I' am using PTC. There is a problem, but without using GI.


3Delight without GI

http://img259.imageshack.us/img259/9833 … randao.png

To apply motion blur to raytraced AO you can set Shading Frequency option to "Once per segment" and increase Deformation steps.

http://img571.imageshack.us/img571/4848/26067018.jpg

Offline

 

#9 2012-08-20 10:14:36

gonul
Member
Registered: 2011-01-04
Posts: 21

Re: Ambient occlusion in SI 2013

thank you so much victor.

Offline

 

#10 2012-08-31 14:02:22

Archer}
Member
Registered: 2010-01-13
Posts: 22

Re: Ambient occlusion in SI 2013

gonul, it works, but only for point based AO

Offline

 

#11 2012-09-01 05:59:28

gonul
Member
Registered: 2011-01-04
Posts: 21

Re: Ambient occlusion in SI 2013

I know Archer}. PTC method is much better than Raytrace.
I made the comparison below. 3Delight still the best. (GI, MBLUR and AOCC)
But it is very sharp shadows. I worked with Aocc shader parameters.

VRAY
[http://img31.imageshack.us/img31/4854/vrayz.png


MENTALRAY
http://img138.imageshack.us/img138/1310/mentalm.png


ARNOLD
It took too long. I could not wait. :D


3DELIGHT
http://img266.imageshack.us/img266/400/3delight1.png

Last edited by gonul (2012-09-01 06:02:54)

Offline

 

#12 2012-09-01 15:32:10

Archer}
Member
Registered: 2010-01-13
Posts: 22

Re: Ambient occlusion in SI 2013

gonul, i mean "my humble fix for reflective AO works only for point based method" period

Offline

 

#13 2012-09-02 07:32:40

gonul
Member
Registered: 2011-01-04
Posts: 21

Re: Ambient occlusion in SI 2013

Hımmmmm.
Normally had an error. But I have not used with point based AO. I'll try.
Thank you Archer}

Offline

 

#14 2012-09-02 15:56:47

amm
Member
From: Zagreb, Croatia
Registered: 2007-08-31
Posts: 35
Website

Re: Ambient occlusion in SI 2013

gonul,
please don't take me wrong, but, I think you won't go so far with these comparisons. 3delight is quite different render engine than MR or V-Ray. About point-based method, there are nice explanations in rendering guidelines in docs of standalone 3Delight ("extra" folder of 3Delight for SI addon).

Offline

 

#15 2012-09-03 00:22:12

gonul
Member
Registered: 2011-01-04
Posts: 21

Re: Ambient occlusion in SI 2013

I understand that, amm.
Rendering engines may be different. As a result, it does not matter to the audience. The aim is to get the fastest and most beautifully rendered. If you do not have enough information, try and fuss. : (

Resources and courses related to 3Delight very little. Not as much as others. For the newbies, this is a very large deficit. I mentioned this earlier. Anyone interested in did not happen. If enough tutorials, I would not ask questions like that here. Forums are there to learn something.

Offline

 

Board footer

PunBB is © Copyright 2002–2005 Rickard Andersson

You are here: Resources » Forums
Follow us on Twitter
© 2006-2011 dna research. All Rights Reserved.
Trademarks & Copyrights Notices