POV-Ray : Newsgroups : povray.text.scene-files : Grid fade out with mask Server Time
4 May 2024 01:21:53 EDT (-0400)
  Grid fade out with mask (Message 1 to 1 of 1)  
From: Sebastian
Subject: Grid fade out with mask
Date: 10 Jul 2006 08:53:48
Message: <pan.2006.07.10.12.46.42.773769@gmx.de>
Fade out of a grid with a semitransparent mask.

See the TRON Game Grid thread in p.newuser

Sebastian






#include "colors.inc"
#include "screen.inc"

#declare CLOCK = clock;


/* 
 *  Scene control settings
 *-------------------------------------------------------------- 
 */
#declare ANIMATION = off;

#declare USE_PHOTONS = off;
#declare USE_RADIOSITY = off;


/* 
 *  Scene parameters
 *-------------------------------------------------------------- 
 */
#declare G_W = 35;       // Width and depth for detailed ground


/* 
 *  Global settings
 *-------------------------------------------------------------- 
 */
global_settings {
  charset utf8
  
  max_trace_level 16
  assumed_gamma 2.2
  
  #if (USE_RADIOSITY)
    radiosity {
      pretrace_start 0.08
      pretrace_end   0.04
      count 35
      
      nearest_count 5
      error_bound 1.8
      recursion_limit 1
      
      low_error_factor 0.5
      gray_threshold 0.0
      minimum_reuse 0.015
      brightness 1
      
      adc_bailout 0.01/2
    }
  #end
  
  #if (USE_PHOTONS)
    photons {
      count 20000
      autostop 0
      jitter 0
    }
  #end
}
background { rgb <1, 1, 1> }


/*
 *  Camera
 *-------------------------------------------------------------- 
 */
#declare cam_pos     = <-5, 4, -13>;
#declare cam_look_at = <1, 1.0, 0>;
#declare cam_angle   = 45;

#if(ANIMATION)
  #declare cam_pos     = vaxis_rotate(cam_pos,     <0,1,0>, CLOCK*360);
  #declare cam_look_at = vaxis_rotate(cam_look_at, <0,1,0>, CLOCK*360);
#end

Set_Camera(cam_pos, cam_look_at, cam_angle) // set location, look_at and angle
Set_Camera_Aspect(16,9) // set width in relation to height
Set_Camera_Sky(<0,1,0>) // set the sky vector


/*
 *  Static lightsources
 *--------------------------------------------------------------
 */


light_source {
  <100, 200, -100> rgb <1, 1, 1>
  fade_distance 800
  fade_power 2
}


/*
 *
 * Objects
 *--------------------------------------------------------------
 */   


#declare O_Ground_Plane =
plane { y, 0 }


/*
 *
 * Textures
 *--------------------------------------------------------------
 */   

// Not used but intended for to be the
// center point of the fade-out mask
#declare ground_camera_focus =
trace(
  O_Ground_Plane, 
  cam_pos, 
  vnormalize(cam_look_at - cam_pos)
);


#declare grid_line_width     = 0.1;
#declare grid_line_col       = rgb  <0.95, 0.95, 1.00>;
#declare grid_area_col       = rgbt <0.00, 0.00, 0.10, 1.0>;
#declare grid_fade_disc_rad  = 40.0;
// #declare grid_fade_disc_pos  = ground_camera_focus;
   #declare grid_fade_disc_pos  = <cam_pos.x, 0, cam_pos.z>;


#declare P_Lines =
  pigment {
    gradient x
    color_map {
      [0.0             grid_line_col]
      [grid_line_width grid_line_col]
      [grid_line_width grid_area_col]
      [1.0             grid_area_col]
    }
  }


#declare T_Grid =
  texture { pigment {Black}   }
  texture { pigment {P_Lines} }
  texture { pigment {P_Lines rotate 90*y} }


#declare T_Actual_Grid =
  texture { T_Grid     finish {ambient 0.1}}
  texture {
    pigment {
      cylindrical 
      color_map {
        [0.0 rgb  grid_line_col]
        [1.0 rgbt 1.0]
      }
      scale grid_fade_disc_rad
      translate grid_fade_disc_pos
    }
    finish {ambient 0.1}
  }


/*
 *
 * Scene Object collection
 *--------------------------------------------------------------
 */   


sphere {
  0, 1/4
  pigment {Red}
  translate grid_fade_disc_pos
}


object {
  O_Ground_Plane
  texture {
    T_Actual_Grid
  }
}



#declare w_dist = 50;

#declare O_Wall =
plane {
   -x, 0
   pigment {hexagon rgb 1.0, rgb 0.8, rgb 0.6 rotate 90*z}
   finish {ambient 0.45}
   translate w_dist*x
   no_shadow
}


object { O_Wall }
object { O_Wall rotate 90*y}
object { O_Wall rotate 180*y}
object { O_Wall rotate 270*y}


Post a reply to this message

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