Forums

You are not logged in.

#1 2009-02-24 21:51:50

samhodge
Member
From: Adelaide, South Australia
Registered: 2007-03-14
Posts: 100
Website

indirectdiffuse as an method for convolving a map?

I made a couple of shaders to debug something we are having an issue with on production

Indirect Diffuse



Code:

surface indirectDiffuseDebug
(
    uniform string lightSpace= "lightSpace";
    uniform string lightMap = "lightMap";
)
{
    normal _Nn = normalize(ntransform("current",lightSpace,normalize(N)));
    varying color indirectDiffuseDebug = indirectdiffuse ( lightMap, _Nn ) ;
    Oi = Os;
    Ci = Cs;
    Ci *= indirectDiffuseDebug;
    Ci *= Oi;
}

Reflection


Code:

surface reflectionDebug
(
    uniform string lightSpace= "lightSpace";
    uniform string lightMap = "lightMap";
)
{
    normal R = normalize(ntransform("current",lightSpace,normalize(reflect(I,normalize(N)))));
    varying color reflection = environment ( lightMap, R ) ;
    Oi = Os;
    Ci = Cs;
    Ci *= reflection;
    Ci *= Oi;
}

Two Nurbs Spheres and a Coordsystem and the shaders above
I will attach a maya scene if I can work out how to do that soon

The envGrey.tdl is a grey map created from a tif

Code:

tdlmake -envlatl input.tiff envGrey.tdl

There is a dark spot on the indirect diffuse sphere that is less than ideal

Here is the RIB, I hope I took out any specific customisation we are using

Code:

##RenderMan RIB-Structure 1.0
##Creator 3Delight 8.0.22 linux (Dec 12 2008) "Midnight Express"
##CreationDate Wed Feb 25 16:00:32 2009
# Scene cached for RIB output in 0.07s
#

Option "shutter" "float offset" [ 1 ]
#
# Start of geometry shader archives.
# {

ArchiveBegin "indirectDiffuseDebug1 surface"  # {
  Surface "/home/samh/dev/rspSVN/t4Shaders/share/delight/shaders/indirectDiffuseDebug"
    "uniform string lightSpace" [ "delightCoordinateSystemShape1" ]
    "uniform string lightMap" [ "envGrey.tdl" ]
ArchiveEnd  # }


ArchiveBegin "reflectionDebug1 surface"  # {
  Surface "/home/samh/dev/rspSVN/t4Shaders/share/delight/shaders/reflectionDebug"
    "uniform string lightSpace" [ "delightCoordinateSystemShape1" ]
    "uniform string lightMap" [ "envGrey.tdl" ]
ArchiveEnd  # }

# Geometry shader archives output in -2.182698466e-13s
#

# }
# End of geometry shader archives.
#

#
# Start of geometry archives.
# {

ObjectBegin "|nurbsSphere1|nurbsSphereShape1"  # {
  # |nurbsSphere1|nurbsSphereShape1
  NuPatch
    7 4 # nu uorder
    [ 0 0 0 0 0.25 0.5 0.75 1 1 1 1 ] 0 1 # umin umax
    11 4 # nv vorder
    [ -0.25 -0.25 -0.125 0 0.125 0.25 0.375 0.5 0.625 0.75 0.875 1
      1.125 1.25 1.25 ] 0 1 # vmin vmax
    "vertex hpoint Pw" [ 9.596475e-17 -1 -2.5316185e-16 1 0.1999168 -1 0.1999168 1 0.61643 -0.7836116 0.61643 1
      0.86720247 4.4113033e-17 0.86720247 1 0.61643 0.7836116 0.61643 1 0.1999168 1 0.1999168 1
      1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1 0.28272503 -1 -5.512922e-17 1
      0.87176364 -0.7836116 1.268959e-16 1 1.2264094 9.7213866e-17 3.2082685e-16 1 0.87176364 0.7836116 3.2920823e-16 1
      0.28272503 1 2.030501e-16 1 1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1
      0.1999168 -1 -0.1999168 1 0.61643 -0.7836116 -0.61643 1 0.86720247 1.503147e-16 -0.86720247 1
      0.61643 0.7836116 -0.61643 1 0.1999168 1 -0.1999168 1 1.2304236e-16 1 3.4154717e-17 1
      9.596475e-17 -1 -2.5316185e-16 1 -1.8991932e-16 -1 -0.28272503 1 -4.2954374e-16 -0.7836116 -0.87176364 1
      -5.2948258e-16 1.7230979e-16 -1.2264094 1 -3.2319616e-16 0.7836116 -0.87176364 1 -5.4204673e-17 1 -0.28272503 1
      1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1 -0.1999168 -1 -0.1999168 1
      -0.61643 -0.7836116 -0.61643 1 -0.86720247 1.503147e-16 -0.86720247 1 -0.61643 0.7836116 -0.61643 1
      -0.1999168 1 -0.1999168 1 1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1
      -0.28272503 -1 9.820774e-17 1 -0.87176364 -0.7836116 2.8758069e-16 1 -1.2264094 9.7213866e-17 3.9726926e-16 1
      -0.87176364 0.7836116 2.7719785e-16 1 -0.28272503 1 8.4957776e-17 1 1.2304236e-16 1 3.4154717e-17 1
      9.596475e-17 -1 -2.5316185e-16 1 -0.1999168 -1 0.1999168 1 -0.61643 -0.7836116 0.61643 1
      -0.86720247 4.4113033e-17 0.86720247 1 -0.61643 0.7836116 0.61643 1 -0.1999168 1 0.1999168 1
      1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1 8.074172e-17 -1 0.28272503 1
      9.290196e-17 -0.7836116 0.87176364 1 5.589015e-17 2.2117946e-17 1.2264094 1 -1.34456173e-17 0.7836116 0.87176364 1
      -5.4972927e-17 1 0.28272503 1 1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1
      0.1999168 -1 0.1999168 1 0.61643 -0.7836116 0.61643 1 0.86720247 4.4113033e-17 0.86720247 1
      0.61643 0.7836116 0.61643 1 0.1999168 1 0.1999168 1 1.2304236e-16 1 3.4154717e-17 1
      9.596475e-17 -1 -2.5316185e-16 1 0.28272503 -1 -5.512922e-17 1 0.87176364 -0.7836116 1.268959e-16 1
      1.2264094 9.7213866e-17 3.2082685e-16 1 0.87176364 0.7836116 3.2920823e-16 1 0.28272503 1 2.030501e-16 1
      1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1 0.1999168 -1 -0.1999168 1
      0.61643 -0.7836116 -0.61643 1 0.86720247 1.503147e-16 -0.86720247 1 0.61643 0.7836116 -0.61643 1
      0.1999168 1 -0.1999168 1 1.2304236e-16 1 3.4154717e-17 1 ]
ObjectEnd  # }

ObjectBegin "|nurbsSphere2|nurbsSphereShape2"  # {
  # |nurbsSphere2|nurbsSphereShape2
  NuPatch
    7 4 # nu uorder
    [ 0 0 0 0 0.25 0.5 0.75 1 1 1 1 ] 0 1 # umin umax
    11 4 # nv vorder
    [ -0.25 -0.25 -0.125 0 0.125 0.25 0.375 0.5 0.625 0.75 0.875 1
      1.125 1.25 1.25 ] 0 1 # vmin vmax
    "vertex hpoint Pw" [ 9.596475e-17 -1 -2.5316185e-16 1 0.1999168 -1 0.1999168 1 0.61643 -0.7836116 0.61643 1
      0.86720247 4.4113033e-17 0.86720247 1 0.61643 0.7836116 0.61643 1 0.1999168 1 0.1999168 1
      1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1 0.28272503 -1 -5.512922e-17 1
      0.87176364 -0.7836116 1.268959e-16 1 1.2264094 9.7213866e-17 3.2082685e-16 1 0.87176364 0.7836116 3.2920823e-16 1
      0.28272503 1 2.030501e-16 1 1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1
      0.1999168 -1 -0.1999168 1 0.61643 -0.7836116 -0.61643 1 0.86720247 1.503147e-16 -0.86720247 1
      0.61643 0.7836116 -0.61643 1 0.1999168 1 -0.1999168 1 1.2304236e-16 1 3.4154717e-17 1
      9.596475e-17 -1 -2.5316185e-16 1 -1.8991932e-16 -1 -0.28272503 1 -4.2954374e-16 -0.7836116 -0.87176364 1
      -5.2948258e-16 1.7230979e-16 -1.2264094 1 -3.2319616e-16 0.7836116 -0.87176364 1 -5.4204673e-17 1 -0.28272503 1
      1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1 -0.1999168 -1 -0.1999168 1
      -0.61643 -0.7836116 -0.61643 1 -0.86720247 1.503147e-16 -0.86720247 1 -0.61643 0.7836116 -0.61643 1
      -0.1999168 1 -0.1999168 1 1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1
      -0.28272503 -1 9.820774e-17 1 -0.87176364 -0.7836116 2.8758069e-16 1 -1.2264094 9.7213866e-17 3.9726926e-16 1
      -0.87176364 0.7836116 2.7719785e-16 1 -0.28272503 1 8.4957776e-17 1 1.2304236e-16 1 3.4154717e-17 1
      9.596475e-17 -1 -2.5316185e-16 1 -0.1999168 -1 0.1999168 1 -0.61643 -0.7836116 0.61643 1
      -0.86720247 4.4113033e-17 0.86720247 1 -0.61643 0.7836116 0.61643 1 -0.1999168 1 0.1999168 1
      1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1 8.074172e-17 -1 0.28272503 1
      9.290196e-17 -0.7836116 0.87176364 1 5.589015e-17 2.2117946e-17 1.2264094 1 -1.34456173e-17 0.7836116 0.87176364 1
      -5.4972927e-17 1 0.28272503 1 1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1
      0.1999168 -1 0.1999168 1 0.61643 -0.7836116 0.61643 1 0.86720247 4.4113033e-17 0.86720247 1
      0.61643 0.7836116 0.61643 1 0.1999168 1 0.1999168 1 1.2304236e-16 1 3.4154717e-17 1
      9.596475e-17 -1 -2.5316185e-16 1 0.28272503 -1 -5.512922e-17 1 0.87176364 -0.7836116 1.268959e-16 1
      1.2264094 9.7213866e-17 3.2082685e-16 1 0.87176364 0.7836116 3.2920823e-16 1 0.28272503 1 2.030501e-16 1
      1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1 0.1999168 -1 -0.1999168 1
      0.61643 -0.7836116 -0.61643 1 0.86720247 1.503147e-16 -0.86720247 1 0.61643 0.7836116 -0.61643 1
      0.1999168 1 -0.1999168 1 1.2304236e-16 1 3.4154717e-17 1 ]
ObjectEnd  # }
#
# Start of instancer archives.
# End of instancer archives.
#

# Geometry archives output in -2.182698466e-13s
#

# }
# End of geometry archives.
#

#
# Start of RIB options.
# {
Option "limits" "integer[2] bucketsize" [ 16 16 ]
Option "limits" "integer gridsize" [ 256 ]
Option "limits" "integer texturememory" [ 32768 ]
Option "limits" "integer eyesplits" [ 10 ]
Option "limits" "color othreshold" [ 0.99608 0.99608 0.99608 ]
Option "trace" "integer maxdepth" [ 1 ]
Option "render" "string bucketorder" [ "horizontal" ]
Option "searchpath" "string shader" [ "@:" ] "string texture" [ "@" ] "string procedural" [ "@" ]
Option "searchpath" "string procedural" [ "&:$DELIGHT/lib" ]
Option "user" "integer delight_curr_frame" [ 1 ]
Option "user" "string delight_shader_collection" [ "" ]
Option "user" "string delight_renderpass_name" [ "PreviewRenderPass" ]
Option "statistics" "integer endofframe" [ 0 ] "string filename" [ "" ]
Option "render" "integer standardatmosphere" [ 0 ]
Orientation "rh"
ShadingInterpolation "smooth"
# RIB options output in -2.182698466e-13s
#

# }
# End of RIB options.
#


FrameBegin 1  # {
  ShadingRate 1
  PixelSamples 3 3
  Hider "hidden"
    "integer jitter" [ 1 ]
  Display "bustedImage.tif" "tiff" "rgba"
    "float[2] exposure" [ 1 1 ]
    "float[4] quantize" [ 0 0 0 0 ]
    "float dither" [ 0.5 ]
    "string filter" [ "gaussian" ]
    "float[2] filterwidth" [ 2 2 ]
    "string cameraname" [ "perspShape" ]
  Format 1024 778 0.9999975
  Projection "perspective"
    "fov" [ 54.432225 ]
  ScreenWindow -1 1 -0.75976754 0.75976754
  Clipping 0.1 1e3
  Attribute "user" "float _3dfm_near_clipping_plane" [ 0.1 ]
  Attribute "user" "float _3dfm_far_clipping_plane" [ 1e3 ]
  Shutter 1 1
  Option "shutter" "float[2] efficiency" [ 1 1 ]
  CropWindow 0 1 0 1

  #
  # maya cameras named coordinate systems
  TransformBegin  # {
    Identity
    Perspective 54.432225
    Scale 1 1 -1
    ConcatTransform [ 0.745476 0.19641381 -0.63693578 0 -1.6154007e-17 0.95559598 0.29468005 0 0.66653245 -0.21967691 0.71237386 0
        1.0751489e-14 1.11310293e-13 -14.368383 1 ]
    CoordinateSystem "mayaCamera:persp"
    Option "user" "float persp_camera_aspectRatio" [ 1.5 ]
  TransformEnd  # }
  #
  # render camera: perspShape
  Scale 1 1 -1
  CoordinateSystem "mayaCamera"
  ConcatTransform [ 0.745476 0.19641381 -0.63693578 0 -1.6154007e-17 0.95559598 0.29468005 0 0.66653245 -0.21967691 0.71237386 0
      1.0751489e-14 1.11310293e-13 -14.368383 1 ]

  WorldBegin  # {
    #
    # start coordinate systems
    TransformBegin  # {
      Transform [ 1 0 -0 0 -0 1.7932704e-16 -1 0 0 1 1.7932704e-16 0
          0 0 0 1 ]
      CoordinateSystem "delightCoordinateSystemShape1"
    TransformEnd  # }
    #
    # end coordinate systems
    #
    # start lights

    AttributeBegin  # {
      Attribute "identifier" "string name" [ "|persp|directionalLight1|directionalLightShape1" ]
      Transform [ 0.40645004 0.12453717 0.90514577 0 0.55511857 0.75319504 -0.35290306 0 -0.72570085 0.64590066 0.23700326 0
          -9.151737 4.234076 10.2356606 1 ]
      Scale 1 1 -1
      IfBegin "!defined(user:_3dfm_filter_lightsource) || $user:_3dfm_filter_lightsource == 0"
        LightSource "/film/setup/t4/hk/hk185/3d/maya/3delight/untitled/shaders/OBJ/directionalLightShape1" "directionalLightShape1"
          "string __category" [ "specular,diffuse" ]
          "string shadowmapname" [ "" ]
      IfEnd
    AttributeEnd  # }

    Illuminate "directionalLightShape1" 1
    #
    # end lights
    #
    # start geometry

    AttributeBegin  # {
      Attribute "identifier" "string name" [ "|nurbsSphere1|nurbsSphereShape1" ]
      Attribute "user" "string delight_shortest_unique_name" [ "nurbsSphereShape1" ]
      Transform [ 1 0 0 0 0 1 0 0 0 0 1 0
          0 0 0 1 ]
      # Start render stats {
      IfBegin "!defined(ShadowMapRendering)"
        # Casts Shadows render stats is on
        Attribute "visibility" "integer transmission" [ 1 ]
        Attribute "shade" "string transmissionhitmode" [ "opaque" ]
      IfEnd
      # Double Sided render stats
      Sides 2
      # } End render stats
      IfBegin "!defined(user:_3dfm_filter_surface) || $user:_3dfm_filter_surface == 0"
        ReadArchive "indirectDiffuseDebug1 surface"
      IfEnd
      ObjectInstance "|nurbsSphere1|nurbsSphereShape1"
    AttributeEnd  # }


    AttributeBegin  # {
      Attribute "identifier" "string name" [ "|nurbsSphere2|nurbsSphereShape2" ]
      Attribute "user" "string delight_shortest_unique_name" [ "nurbsSphereShape2" ]
      Transform [ 1 0 0 0 0 1 0 0 0 0 1 0
          -2.8038202 0 0 1 ]
      # Start render stats {
      IfBegin "!defined(ShadowMapRendering)"
        # Casts Shadows render stats is on
        Attribute "visibility" "integer transmission" [ 1 ]
        Attribute "shade" "string transmissionhitmode" [ "opaque" ]
      IfEnd
      # Double Sided render stats
      Sides 2
      # } End render stats
      IfBegin "!defined(user:_3dfm_filter_surface) || $user:_3dfm_filter_surface == 0"
        ReadArchive "reflectionDebug1 surface"
      IfEnd
      ObjectInstance "|nurbsSphere2|nurbsSphereShape2"
    AttributeEnd  # }

    #
    # end geometry
  WorldEnd  # }

  # World output (for frame 1) in 0.01s
  #

FrameEnd  # }
# Frame 1 output in 0.01s
#

# All RIB output completed in 0.1s
#

-------------------------------
Sam Hodge

Offline

 

#2 2009-02-24 21:53:59

samhodge
Member
From: Adelaide, South Australia
Registered: 2007-03-14
Posts: 100
Website

Re: indirectdiffuse as an method for convolving a map?

So I want to know, if I am using the indirect diffuse call wrong

And if not why is the dark spot occuring on the indirect sphere

Also why are the values so bright

Thanks in Advance

Sam


-------------------------------
Sam Hodge

Offline

 

#3 2009-02-24 22:06:04

samhodge
Member
From: Adelaide, South Australia
Registered: 2007-03-14
Posts: 100
Website

Re: indirectdiffuse as an method for convolving a map?

illustration

http://www.hodge.net.au/sam/blog/?p=72

http://www.hodge.net.au/sam/blog/wp-content/uploads/darkspot.jpg

Last edited by samhodge (2009-02-24 22:27:04)


-------------------------------
Sam Hodge

Offline

 

#4 2009-02-25 08:45:43

olivier
3Delight Developer
Registered: 2007-01-09
Posts: 1930

Re: indirectdiffuse as an method for convolving a map?

The dark spot is a bug which I've just fixed.

The values are bright overall because of the units and the convolution involved. This is not a simple lookup.

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