美文网首页
R语言rayrender包,microfacetMicrofac

R语言rayrender包,microfacetMicrofac

作者: youmigo | 来源:发表于2021-08-25 01:29 被阅读0次

    R语言rayrender包,microfacetMicrofacet材料

    # Sat Jul 17 00:10:41 2021 -
    
    # 字符编码:UTF-8
    # R 版本:R 4.1 x64 for window 11
    # cgh163email@163.com
    # 个人笔记不负责任,拎了个梨🍐🍈
    #.rs.restartR()
    require(rayrender)
    rm(list = ls());gc()
    
    ?   microfacet  #   Microfacet材料
    
    generate_cornell() %>%
     add_object(ellipsoid(x=555/2,555/2,y=150, a=100,b=150,c=100,
                          material=microfacet(roughness=0.1,
                                              eta=c(0.216,0.42833,1.3184), kappa=c(3.239,2.4599,1.8661)))) %>%
     render_scene(lookfrom=c(278,278,-800),lookat = c(278,278,0), samples=500,
                  aperture=0, fov=40, parallel=TRUE,clamp_value=10)
    
    #Make the roughness anisotropic (either horizontal or vertical), adding an extra light in front
    #to show off the different microfacet orientations
    generate_cornell() %>%
     add_object(sphere(x=555/2,z=50,y=75,radius=20,material=light())) %>%
     add_object(ellipsoid(x=555-150,555/2,y=150, a=100,b=150,c=100,
                          material=microfacet(roughness=c(0.3,0.1),
                                              eta=c(0.216,0.42833,1.3184), kappa=c(3.239,2.4599,1.8661)))) %>%
     add_object(ellipsoid(x=150,555/2,y=150, a=100,b=150,c=100,
                          material=microfacet(roughness=c(0.1,0.3),
                                              eta=c(0.216,0.42833,1.3184), kappa=c(3.239,2.4599,1.8661)))) %>%
     render_scene(lookfrom=c(278,278,-800),lookat = c(278,278,0), samples=500,
                  aperture=0, fov=40,  parallel=TRUE,clamp_value=10)
    
    #Render a rough silver R with a smaller golden egg in front
    generate_cornell() %>%
     add_object(obj_model(r_obj(),x=555/2,z=350,y=0, scale_obj = 200, angle=c(0,200,0),
                          material=microfacet(roughness=0.2,
                                              eta=c(1.1583,0.9302,0.5996), kappa=c(6.9650,6.396,5.332)))) %>%
     add_object(ellipsoid(x=200,z=200,y=80, a=50,b=80,c=50,
                          material=microfacet(roughness=0.1,
                                              eta=c(0.216,0.42833,1.3184), kappa=c(3.239,2.4599,1.8661)))) %>%
     render_scene(lookfrom=c(278,278,-800),lookat = c(278,278,0), samples=500,
                  aperture=0, fov=40, parallel=TRUE,clamp_value=10)
    
    #Increase the roughness
    generate_cornell() %>%
     add_object(obj_model(r_obj(),x=555/2,z=350,y=0, scale_obj = 200, angle=c(0,200,0),
                          material=microfacet(roughness=0.5,
                                              eta=c(1.1583,0.9302,0.5996), kappa=c(6.9650,6.396,5.332)))) %>%
     add_object(ellipsoid(x=200,z=200,y=80, a=50,b=80,c=50,
                          material=microfacet(roughness=0.3,
                                              eta=c(0.216,0.42833,1.3184), kappa=c(3.239,2.4599,1.8661)))) %>%
     render_scene(lookfrom=c(278,278,-800),lookat = c(278,278,0), samples=500,
                  aperture=0, fov=40, parallel=TRUE,clamp_value=10)
    
    

    相关文章

      网友评论

          本文标题:R语言rayrender包,microfacetMicrofac

          本文链接:https://www.haomeiwen.com/subject/stvipltx.html