• Chinese Optics Letters
  • Vol. 21, Issue 5, 052201 (2023)
Haisong Tang1、2, Zexin Feng1、2、*, Dewen Cheng1、2, and Yongtian Wang1、2
Author Affiliations
  • 1Beijing Engineering Research Center of Mixed Reality and Advanced Display, School of Optics and Photonics, Beijing Institute of Technology, Beijing 100081, China
  • 2MOE Key Laboratory of Optoelectronic Imaging Technology and Systems, Beijing Institute of Technology, Beijing 100081, China
  • show less
    DOI: 10.3788/COL202321.052201 Cite this Article Set citation alerts
    Haisong Tang, Zexin Feng, Dewen Cheng, Yongtian Wang. Parallel ray tracing through freeform lenses with NURBS surfaces[J]. Chinese Optics Letters, 2023, 21(5): 052201 Copy Citation Text show less
    Flow chart of our parallel ray-tracing algorithm.
    Fig. 1. Flow chart of our parallel ray-tracing algorithm.
    (a) Zenith angle θ and azimuth angle φ of a randomly sampled ray. (b) The illustration of two different sampling strategies, θ ∼ sin θ and θ ∼ U (0, 0.5π), where φ is uniformly sampled. (c) The distribution of the sampling points with azimuth and zenith angles corresponding to the uniform spatial sampling.
    Fig. 2. (a) Zenith angle θ and azimuth angle φ of a randomly sampled ray. (b) The illustration of two different sampling strategies, θ ∼ sin θ and θ U (0, 0.5π), where φ is uniformly sampled. (c) The distribution of the sampling points with azimuth and zenith angles corresponding to the uniform spatial sampling.
    Refraction on freeform surface.
    Fig. 3. Refraction on freeform surface.
    Schematic of the ray tracing from the source, through the entrance and exit surfaces of the freeform lens, to the target, generating a complex irradiance pattern.
    Fig. 4. Schematic of the ray tracing from the source, through the entrance and exit surfaces of the freeform lens, to the target, generating a complex irradiance pattern.
    Illustration of (a) the spherical-freeform lens and an extended light source and (b) the continuous change of the freeform exit surface.
    Fig. 5. Illustration of (a) the spherical-freeform lens and an extended light source and (b) the continuous change of the freeform exit surface.
    Simulated irradiance distributions of the first example under different settings of the number of rays, the number of cells, and the source size. Each simulated irradiance distribution is in the range of {(x,y) | −1000 mm x y < 1000 mm} and filtered by a 3 × 3 uniform mask.
    Fig. 6. Simulated irradiance distributions of the first example under different settings of the number of rays, the number of cells, and the source size. Each simulated irradiance distribution is in the range of {(x,y) | −1000 mm < x <1000 mm, −1000 mm < y < 1000 mm} and filtered by a 3 × 3 uniform mask.
    The second simulation example. (a) The double-freeform lens with a point-like source and (b) its simulation result.
    Fig. 7. The second simulation example. (a) The double-freeform lens with a point-like source and (b) its simulation result.
    Variations of the runtime with (a) the number of rays, (b) the number of receiver cells, (c) the source size, and (d) the number of control points (of each surface) for the first example.
    Fig. 8. Variations of the runtime with (a) the number of rays, (b) the number of receiver cells, (c) the source size, and (d) the number of control points (of each surface) for the first example.
    Number of rays 107106108107107107107
    Source size (0.001,0.001)(0.001,0.001)(0.001,0.001)(0.001,0.001)(0.001,0.001)(0.001,2.0)(2.0,2.0)
    Number of bins (128,128)(128,128)(128,128)(64,64)(256,256)(128,128)(128,128)
    Time cost (s)11.161.30112.8611.1311.1211.1111.17
    Intersection precision (mm)max2.80 × 10−42.40 × 10−42.83 × 10−42.75 × 10−42.70 × 10−42.72 × 10−42.64 × 10−4
    mean5.33 × 10−85.31 × 10−85.35 × 10−85.33 × 10−85.32 × 10−85.34 × 10−85.34 × 10−8
    Success rate τ0.999780.999780.999730.999780.999780.999650.99945
    Table 1. Performances of the Proposed PRT Algorithm Evaluated by the Time Consumption, the Intersection Precision, and the Success Rate τ
    Input: length and width of the rectangular light source (a,b)
    Output: starting points s^, ray directions r^, weights w
    1:  function RRS(a,b)
    2:    σ1RAND(), σ2RAND(), σ3RAND(), σ4RAND()
    3:    x0(σ10.5)a, y0(σ20.5)b, z00
    4:    θarccos(1σ3), φ2πσ4
    5:    rxsinθcosφ, rysinθsinφ, rzcosθ
    6:    s^(x0,y0,z0),r^(rx,ry,rz)
    7:    wcosθ
    8:    returns^,r^,w
    9:  end function
    Table 1. Random rays sampling (RRS) process. The function RAND( ) denotes the generation of a uniformly distributed random number in [0,1]
    Input: incident ray parameters s^,r^,w, surface control points P, refractive indices n1,n2
    Output: outgoing ray parameters s^,r^,w
    1:  function TRACE(s^,r^,w,P,n1,n2)
    2:    u,vINTER(s^,r^,P),i^r^
    3:    Q,Q/u,Q/vNURBS(u,v,P)
    4:    get surface normal vectors n^
    5:    get refraction directions t^ by Eq. (14)
    6:    get reflectances Rs and Rp based on Eq. (15)
    7:    T1(Rs+Rp)/2
    8:    s^Q,r^t^,wT·w
    9:    returns^,r^,w
    10: end function
    11: function INTER(s^,r^,P)     intersection acquisition
    12:    generate rough mesh grids u0,v0[0,1]
    13:    A,A/u,A/vNURBS(u0,v0,P)
    14:    d1dot(As^,r^)/As^2
    15:    dmin=min(d)
    16:    iindex(d,dmin)
    17:    uku0(i),vkv0(i),dk=dmin     initial solution
    18:    αkln(1/uk1)/4, βkln(1/vk1)/4
    19:    whiledk>εdo    ε is the allowed error
    20:     Q,Q/u,Q/vNURBS(uk,vk,P)
    21:     dk1dot(Qs^,r^)/Qs^2
    22:     get Jacobian matrix J by Eqs. (9) and (12)
    23:     get αk+1,βk+1 by Eq. (13)
    24:     αkαk+1,βkβk+1
    25:     uk1/(e4αk+1),vk1/(e4βk+1)
    26:    end while
    27:    returnuk,vk
    28: end function
    29: function NURBS(u,v,P)     surface interpolation
    30:    generate quasi-uniform node vectors (u1,u2,…,ui,…) and (v1,v2,…,vj,…) using shape (P)
    31:    get Ni,p(u),Nj,q(v) based on Eq. (3)
    32:    get interpolation points Q and the partial derivatives Q/u,Q/v, while Ri,j=1 based on Eq. (2)
    33:    returnQ,Q/u,Q/v
    34: end function
    Table 2. Light transport simulation through a freeform NURBS surface. During the parallel ray-tracing process, we specify a fixed number of iterations in the INTER( ) function and record the number of rays that satisfy dkε
    Input: light source size (a,b), total energy W0, number of rays n, control points (P1,P2) of the two surfaces, refractive indices (n1,n2) of air and lens, z-coordinate zr of receiver, range {[xmin,xmax],[ymin,ymax]} of the receiver, number of cells (mc,nc)
    Output: the irradiance distribution on the receiver E
    1:  xryrwrZEROS(n), ws0
    2:  fori=1 to ndo
    3:    s^0,r^0,w0RRS(a,b)
    4:    wsws+w0
    5:    s^1,r^1,w1TRACE(s^0,r^0,w0,P1,n1,n2)
    6:    s^2,r^2,w2TRACE(s^1,r^1,w1,P2,n2,n1)
    7:    (x,y,z)s^2,(rx,ry,rz)r^2     decomposition
    8:    t(zrz)/rz
    9:    xr(i)x+t·rx,yr(i)y+t·ry,wr(i)w2
    10:  end for
    11:  wr(W0/ws)·wr
    12:  ESTATIC(xr,yr,wr,mc,nc,xmin,xmax,ymin,ymax)
    13:  function STATIC(x,y,w,mc,nc,xmin,xmax,ymin,ymax)
    14:    EZEROS(mc,nc)
    15:    fori=1 to mcdo
    16:     forj=1 to ncdo
    17:      Scell=(xmaxxmin)·(ymaxymin)/(mc·nc)
    18:      wij sum w of the rays on the ijth cell
    19:      Eijwij/Scell
    20:     end for
    21:   end for
    22:   returnE
    23:  end function
    Table 3. Pseudo-code for PRT. We use the GPU to trace batches of light rays simultaneously. The function ZEROS(mc,nc) means generating an mc×nc zeros matrix
    Haisong Tang, Zexin Feng, Dewen Cheng, Yongtian Wang. Parallel ray tracing through freeform lenses with NURBS surfaces[J]. Chinese Optics Letters, 2023, 21(5): 052201
    Download Citation