// This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 // International Public License. // Visit https://creativecommons.org/licenses/by-sa/4.0/. // SPDX-License-Identifier: CC-BY-SA-4.0 // yuqk blend_mode_5_06.pov +w450 +h450 (quick and ugly) // yuqk blend_mode_5_06.pov +w450 +h450 +a0.05 +am2 +r3 +j3.33 +d +p // // The blend_modes 4 and 5 were added to the yuqk fork with a set of possible // applications in mind. Blend mode 5, with blend_gamma settings larger than // one, uses only the middle of the interpolation segments in a map. This // capability can be used to define specific colors in media aligning in some // aspect with functions or patterns. // // The example herein uses scattering only media in front of a black plane and // with a light source. The pattern used here is a function setting up multiple // spherical regions of density >0. In this case the 8 defined spheres interact // in pairs to show how the colors (density map indexes) change in the // interacting regions. // // Scattering media as lit by a light uses the color we wish to see. Shadowed // region colors are inverted due the light being scattered between the light // source and the shadowed object. There are no shadows in this example due the // plane behind the media being black so we see only the media scatter color. // // Note! This example turns the light's media attenuation on. This a costly // option due the exponential nature of the sampling. Turn it off for scene // changes / development. #version unofficial 3.8; // yuqk #if (file_exists("version.inc")) #include "version.inc" #end #if (!defined(Fork_yuqk)) #error "This POV-Ray SDL code requires the yuqk fork." #end global_settings { assumed_gamma 1 } // Colors #declare White = srgb <1,1,1>; #declare Red = srgb <1,0,0>; #declare Green = srgb <0,1,0>; #declare Blue = srgb <0,0,1>; #declare ChristmasBlue0 = srgb <0.16471,0.56078,0.74118>; #declare ChristmasBlue1 = srgb <0.21176,0.31765,0.58039>; #declare ChristmasBrown0 = srgb <0.36471,0.16863,0.17255>; #declare ChristmasBrown1 = srgb <0.29804,0.12157,0.00784>; #declare ChristmasGold = srgb <0.79216,0.66275,0.02353>; #declare ChristmasGreen = srgb <0.17647,1,0>; #declare ChristmasGreen0 = srgb <0.23529,0.55294,0.05098>; #declare ChristmasGreen1 = srgb <0,0.45882,0.00784>; #declare ChristmasOrange0 = srgb <1,0.4,0>; #declare ChristmasOrange1 = srgb <0.83529,0.42353,0.16863>; #declare ChristmasPink0 = srgb <1,0.8,0.79608>; #declare ChristmasPink1 = srgb <0.8902,0.25882,0.52157>; #declare ChristmasPurple0 = srgb <0.4,0.2,0.59608>; #declare ChristmasPurple1 = srgb <0.30196,0.03137,0.29412>; #declare ChristmasRed = srgb <0.88235,0.11765,0>; #declare ChristmasRed0 = srgb <0.66667,0.00392,0.07843>; #declare ChristmasRed1 = srgb <0.6902,0.10588,0.18039>; #declare ChristmasSilver = srgb <0.88235,0.87451,0.87843>; #declare ChristmasYellow0 = srgb <1,0.8,0>; #declare ChristmasYellow1 = srgb <0.99608,0.94902,0>; // Inverted versions of the colors #declare Black = srgb <0,0,0>; background { Black } #declare VarOrthoMult = 4.0/max(image_width/image_height,image_height/image_width); #declare Camera01z = camera { orthographic location <0,0,-2> direction z right VarOrthoMult*x*max(1,image_width/image_height) up VarOrthoMult*y*max(1,image_height/image_width) } // Light defaults: media_interaction on, media_attenuation off. Scattering // attenuation is very expensive, but results are more accurate. Self shadows, // shadows. If light inside source container, a tiny void around it is required. #declare Light00 = light_source { <150,150,-1>, White media_interaction on media_attenuation on } #declare Plane00 = plane { -z, -5 pigment { Black } } #declare FinEmit0 = finish { ambient rgb <0,0,0> diffuse 0 emission Black } #declare ObjPlane0 = object { Plane00 finish { FinEmit0 } } #declare CylinderX = cylinder { -1*x, 1*x, 0.01 pigment { Red } } #declare CylinderY = cylinder { -1*y, 1*y, 0.01 pigment { Green } } #declare CylinderZ = cylinder { -1*z, 1*z, 0.01 pigment { Blue } } #declare DensityMapPos = density_map { blend_mode 5 blend_gamma 3 [ -10 ChristmasBlue0 ] [ -9 ChristmasBlue0 ] [ -9 ChristmasBlue1 ] [ -8 ChristmasBlue1 ] [ -8 ChristmasBrown0 ] [ -7 ChristmasBrown0 ] [ -7 ChristmasBrown1 ] [ -6 ChristmasBrown1 ] [ -6 ChristmasGold ] [ -5 ChristmasGold ] [ -5 ChristmasGreen ] [ -4 ChristmasGreen ] [ -4 ChristmasGreen0 ] [ -3 ChristmasGreen0 ] [ -3 ChristmasGreen1 ] [ -2 ChristmasGreen1 ] [ -2 ChristmasOrange0 ] [ -1 ChristmasOrange0 ] [ -1 ChristmasOrange1 ] [ 0 ChristmasOrange1 ] [ 0 ChristmasPink0 ] [ 1 ChristmasPink0 ] [ 1 ChristmasPink1 ] [ 2 ChristmasPink1 ] [ 2 ChristmasPurple0 ] [ 3 ChristmasPurple0 ] [ 3 ChristmasPurple1 ] [ 4 ChristmasPurple1 ] [ 4 ChristmasRed ] [ 5 ChristmasRed ] [ 5 ChristmasRed0 ] [ 6 ChristmasRed0 ] [ 6 ChristmasRed1 ] [ 7 ChristmasRed1 ] [ 7 ChristmasSilver ] [ 8 ChristmasSilver ] [ 8 ChristmasYellow0 ] [ 9 ChristmasYellow0 ] [ 9 ChristmasYellow1 ] [ 10 ChristmasYellow1 ] } #include "functions.inc" // Function f_sphere defined in functions.inc #declare Fn00 = function (x,y,z) { min(0.0,f_sphere(x-1,y-1,z,0.5)) } #declare Fn01 = function (x,y,z) { min(0.0,f_sphere(x-1,y+1,z,0.5)) } #declare Fn02 = function (x,y,z) { min(0.0,f_sphere(x+1,y-1,z,0.5)) } #declare Fn03 = function (x,y,z) { min(0.0,f_sphere(x+1,y+1,z,0.5)) } #declare Fn04 = function (x,y,z) { min(0.0,f_sphere(x-1.5,y-1.5,z,0.5)) } #declare Fn05 = function (x,y,z) { min(0.0,f_sphere(x-1.5,y+1.5,z,0.5)) } #declare Fn06 = function (x,y,z) { min(0.0,f_sphere(x+1.5,y-1.5,z,0.5)) } #declare Fn07 = function (x,y,z) { min(0.0,f_sphere(x+1.5,y+1.5,z,0.5)) } #declare FnSel = function (_v,_n) { select(_v,_v+_n,0,0) } #declare FnSum = function (x,y,z) { FnSel(Fn00(x,y,z),-4)+ FnSel(Fn04(x,y,z),+4)+ FnSel(Fn01(x,y,z),-5)+ FnSel(Fn05(x,y,z),+5)+ FnSel(Fn02(x,y,z),-6)+ FnSel(Fn06(x,y,z),+6)+ FnSel(Fn03(x,y,z),-7)+ FnSel(Fn07(x,y,z),+7) } #declare DensityPos = density { function { FnSum(x,y,z) } raw_wave density_map { DensityMapPos } } #declare MediaPos = media { method 3 samples 33 emission rgb <1,1,1> density { DensityPos } } #declare MediaPos_Scat1 = media { method 3 samples 33 scattering { 1, rgb <1,1,1> extinction 1 } density { DensityPos } } #declare MediaPos_Scat2 = media { method 3 samples 33 scattering { 2, rgb <1,1,1> extinction 1 } density { DensityPos } } #declare MediaPos_Scat3 = media { method 3 samples 33 scattering { 3, rgb <1,1,1> extinction 1 } density { DensityPos } } #declare MediaPos_Scat4 = media { method 3 samples 33 scattering { 4, rgb <1,1,1> extinction 1 } density { DensityPos } } #declare MediaPos_scat5_0 = media { method 3 samples 33 scattering { 5, rgb <1,1,1> eccentricity 0 extinction 1 } density { DensityPos } } #declare MediaPos_scat5_n1 = media { method 3 samples 33 scattering { 5, rgb <1,1,1> eccentricity -1 extinction 1 } density { DensityPos } } #declare MediaPos_scat5_p1 = media { method 3 samples 33 scattering { 5, rgb <1,1,1> eccentricity 1 extinction 1 } density { DensityPos } } //--- scene --- camera { Camera01z } light_source { Light00 } object { CylinderX } object { CylinderY } object { CylinderZ } object { ObjPlane0 } media { MediaPos } // media { MediaPos_Scat1 } // media { MediaPos_Scat2 } // media { MediaPos_Scat3 } // media { MediaPos_Scat4 } // media { MediaPos_scat5_0 } // media { MediaPos_scat5_n1 } // media { MediaPos_scat5_p1 }