Menu

Photon maps and GI in pixie

Help
2011-08-07
2013-04-25
  • Lin Yuanjing

    Lin Yuanjing - 2011-08-07

    Hi

    I am exploring the potential of pixie renderer and was stuck in the irradiance caches generation. I looked at various examples and past forum post about it but I still cannot figure it out. Could anyone help me?

    Basically I can generate the photon map. But I cannot generate the irradiance map based on the photon map. Could some one please show me how to do it?

    Attached below is my rib file and the shader that was used for the irradiance map generation…

    **
    Format 640 360 1
    Projection "perspective" "fov" 20
    ShadingRate 1
    ShadingInterpolation "smooth"

    Hider "photon" "emit" 1000000

    LightSource "distantlight" 1 "intensity" 1.5 "from"  "to"
    LightSource "distantlight" 1 "intensity" 1.5 "from"  "to"

    Translate  0 0 3
    Rotate -30 1 0 0
    Rotate 0   0 1 0

    WorldBegin

    Attribute "dice" "rasterorient" 0
    Attribute "cull" "backfacing" 0
    Attribute "cull" "hidden" 0
    Attribute "trace" "maxspeculardepth" 5
    Attribute "trace" "maxdiffusedepth" 5

    Attribute "visibility" "specular"
    Attribute "photon" "globalmap" "photonmap.gpm"
    Attribute "photon" "estimator" 100
    #Attribute "irradiance" "handle" "radiance.icf"
    #Attribute "irradiance" "filemode" "w"
    #Attribute "irradiance" "maxerror" 0.0

    #Surface "indirectsurf2" "Kd" 0.8 "samples" 8

    AttributeBegin

    Attribute "photon" "shadingmodel" "matte"

    Translate 0 0.08 0
    Color 1 0 0
    Sphere 0.1 -0.1 0.1 360

                            Translate 0.3 0 0
    Color 0 1 0
    Sphere 0.1 -0.1 0.1 360

    Translate -0.6 0 0
    Color 0 0 1
    Sphere 0.1 -0.1 0.1 360

    AttributeEnd

    AttributeBegin

    Attribute "photon" "shadingmodel" "matte"

    Color 1 1 1

    Polygon "P"

    AttributeEnd
    AttributeBegin

    Attribute "photon" "shadingmodel" "matte"

    Color 1 1 1
    Translate 0 0.2 0.5
    Rotate 90 1 0 0

    Polygon "P"
    "st"

    AttributeEnd
    AttributeBegin

    Attribute "photon" "shadingmodel" "matte"

    Color 1 1 1
    Translate -0.5 0.5 0
    Rotate 90 0 1 0
    Rotate 90 1 0 0

    Polygon "P"
    "st"

    AttributeEnd
    AttributeBegin

    Attribute "photon" "shadingmodel" "matte"

    Color 1 1 1
    Translate 0.5 0.5 0
    Rotate 90 0 1 0
    Rotate 90 1 0 0

    Polygon "P"
    "st"
    AttributeEnd
    WorldEnd**

    This is the rib I used to generate the photon map.

    With the following shaders, I attempt to generate the irradiance caches

    **normal shadingnormal(normal Ni) {
    return faceforward(normalize(Ni),I);
    }

    surface indirectsurf2(float Kd = 1, samples = 16; string envmap = "")
    {
    normal Ns = shadingnormal(N);
    // Compute direct illumination
    color direct = diffuse(Ns);
    // Compute soft indirect illumination (if diff. depth < maxdiffusedepth)
    color indirect = indirectdiffuse(P, Ns, samples,"pointbased", 1);
    // Set Ci and Oi
    Ci = Kd * (direct + indirect) * Cs * Os;
    Oi = Os;
    }**

    What I do is I uncomment the  following :

    #Attribute "irradiance" "handle" "radiance.icf"
    #Attribute "irradiance" "filemode" "w"
    #Attribute "irradiance" "maxerror" 0.0
    #Surface "indirectsurf2" "Kd" 0.8 "samples" 8

    in the second pass that was used to generate the irradiance map. And I doing this correctly? Any help?

    Thank you
    Yuanjing

     
  • Lin Yuanjing

    Lin Yuanjing - 2011-08-07

    Opps! I found out where my error is, apparently   Attribute "irradiance" "maxerror" 0.0 cannot be set to 0.0, if not no Irradiance map will be generated.

    But I am having a new problem. My .icf is in total black. I can see the disc in show, but they are all black… I thought it should be in color? Any one?

    Yuanjing

     

Log in to post a comment.