POV-Ray : Newsgroups : povray.binaries.images : Lamp with SSLT Figure : Re: Lamp with SSLT Figure Server Time
31 Jul 2024 02:27:32 EDT (-0400)
  Re: Lamp with SSLT Figure  
From: Bruno Cabasson
Date: 16 Feb 2011 06:10:00
Message: <web.4d5bb0225b9896bb4aa45fdf0@news.povray.org>
Stephen <mcavoys_at@aoldotcom> wrote:
> On 15/02/2011 10:32 PM, Robert McGregor wrote:
>
> >
> > That's looking good Steven. How does it look with the lamp switched on?
> >
>




> But thanks for asking ;-)
>
>
> --
> Regards
>      Stephen

Here is another version of the SSLT candle experiment with corresponding code,
if this can help.

The big candle is 8cm high, and the checkered dome is 5m radius. Attempt for
flame is not satisfactory.

The monitor I used for this render is not calibrated, so I cannot guarantee for
light settings. I assumed the dome be lit by a very small amount, but
significantly visible. There is a balance to find between light power of flames,
fade_distance, and 'depth' of the light within the wax. In RL, the eye
compensates the relative illumination between dark scenes and to full day light.

Still trying to render what the eye actually sees in RL ...


Bruno


// -------------------------------------------

#version 3.7;

#include "colors.inc"

#declare m = 1;
#declare cm = m/100;
#declare mm = m/1000;
#declare FLAME_COLOR = (2*Orange+Yellow)/3;
#declare FLAME_POWER = 4;
#declare FLAME_FADE_DIST = 0.15*m;
#declare RAD_COUNT = 1600;
#declare SSLT_SAMPLES = <100, 50>*8;

#default { finish{ambient 0 emission 0}}

global_settings
{
    //assumed_gamma 2.2
    mm_per_unit 1/mm
    subsurface { samples SSLT_SAMPLES.x, SSLT_SAMPLES.y}

    radiosity
    {
        pretrace_start 32/image_width
        pretrace_end 4/image_width
        count RAD_COUNT
        error_bound 0.5
        nearest_count 15
        recursion_limit 2
        low_error_factor 1
        media on
    }
}

// ----------------------------------------

camera {
  location  <0.0, 1.5, -4.0>*8*cm
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.5, 1.0,  0.0>*8*cm
}

#declare O_Skysphere = sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

#declare LS_Lamp = light_source {<-5, 5, -5>*m color rgb 0.2}

#macro makeLSCandle(_power)
    #local _ret = light_source
    {
      0
      color rgb FLAME_POWER*FLAME_COLOR*_power
      area_light 1*cm*x, 2*cm*y, 20, 20
      adaptive 1 circular orient
      area_illumination on
      fade_power 2
      fade_distance FLAME_FADE_DIST
      //looks_like {sphere {0, 0.03 pigment {Red}}}
      translate 2.2*y
      scale 1/2
      scale 8*cm
      translate 0.3*cm*y
    }
    _ret
#end

// ----------------------------------------

// a checkered white marble / grey "plastic" plane
#declare O_Floor_ss = plane
{
  y, -1*cm
  texture
  {
    checker
    texture
    {
      pigment { color rgb 1 }
      finish
      {
        specular 0.6
     ambient 0
        //reflection { 0.2 }
        // marble physical parameters from Jensen et al. "A Practical Model for
Subsurface Light Transport", Siggraph 2001
        subsurface { <2.19,2.62,3.00>,<0.0021, 0.0041, 0.0071> }
      }
    }
    texture
    {
      pigment { color rgb 1 }
      finish
      {
        specular 0.6
        diffuse 0.9
        //reflection { 0.2 }
        ambient 0
      }
    }
    scale 1*m
  }
  interior { ior 1.5 }
}

#declare O_Floor = plane
{
    y, -1*cm
    pigment {rgb 1}
}
// the classic chrome sphere
#declare O_ChromeSphere = sphere
{
    <1.5,0.7,1>*m, 0.7*m
    pigment { color rgb 1 }
    finish
    {
        ambient 0 diffuse 0
        specular 0.7  roughness 0.01
        reflection { 0.7 metallic }
  }
}

// a candle...
#declare O_CandleBody = blob
{
  threshold 0.5
  cylinder { <0.0, 0.0,  0.0>,
             <0.0, 2.0,  0.0>,  1.0,   1.0 } // candle "body"
  sphere   { <0.0, 2.5,  0.0>,  0.8,  -2.0 } // (used to shape the candle top)
  sphere   { <0.0,-0.52, 0.0>,  0.8,  -2.0 } // (used to shape the candle
bottom)
  sphere   { <0.0, 2.0, -0.5>,  0.1,  -0.2 } // the "notch" where wax runs over
  cylinder { <0.0, 1.88,-0.52>,
             <0.0, 1.5, -0.52>, 0.05,  0.2 } // a streak of wax running over
  sphere   { <0.0, 1.5, -0.55>, 0.07,  0.2 } // a drop of of wax running over
  texture
  {
    //pigment {wrinlkles scale 0.1 color_map {[ 0.3 Blue] [0.3 Red]}}
    pigment {rgb 1}
    finish
    {
      specular 0.2 roughness 0.2
      ambient 0
      // "artificial" wax parameters
      subsurface { < 1.6732, 1.2806, 0.6947>,< 0.0005, 0.0018, 0.0131> }
    }
  }
  scale 1/2
  scale 8*cm
  interior { ior 1.45 }
  rotate -y*45
}

// ... and the wick
#declare O_Wick = cylinder
{
    0, 1*cm*y, 1*mm
    pigment {rgb 0.05}
    translate 7.5*cm*y
}

#declare O_Flame = ovus
{
    3.5*mm, 3*mm
    pigment {rgbt 1}
    //finish {emission 1}
    hollow
    interior
    {
        media
        {
            samples 50
            scattering {1, 3/(1*cm)}
            absorption 6/(1*cm)
            density {spherical scale 2 warp {turbulence 0.7 octaves 8} scale 1/2
scale 0.3*cm scale 2*y translate -1*mm*y }
            density {spherical scale 0.3*cm scale 2*y translate -1*mm*y }
            density {spherical scale 0.3*cm scale 2*y translate -1*mm*y }
        }
    }
    scale 3
    translate 9*cm*y
    no_shadow
}


#macro makeCandle(_power)
    union
    {
        light_source {makeLSCandle(_power)}
        object {O_CandleBody}
        object {O_Wick}
        object {O_Flame}
    }
#end

#declare O_Dome = sphere
{
    0, 5*m
    hollow
    pigment {checker scale 0.1*m}
}

//light_source {LS_Lamp}
object {O_Floor}
object {makeCandle(1) rotate 45*y}
object {makeCandle(0.5) scale 1/2 translate 5*cm*x - 5*cm*z}
object {O_Dome}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.