Sky Filter

My first Vue Python script. Not exactly earth shattering as all it does is let you apply a colour filter to the sky or make the sky a solid block of one colour.

Note: This script does not work with Spectral Atmospheres.

[codesyntax lang=”python”]

#**********************************************
# Simple Sky Colour Filter
# - skyfilter.py
# - Simple Colour Modification of Sky
# - By Mark Caldwell
# - Version 0.1
# - 2nd March 2006
# - Checked with Vue 5 Infinite Version 5.11 and Vue 6 Infinite Pre Release
# - Note this script will not affect Vue6 Spectral Atmospheres
#**********************************************

#**********************************************
#
# How to Use Simple Sky Colour Filter
# -----------------------------------
#
# Save this Python script onto your computer
#
# Go To Python -> Run Python Scripts
#
# Locate skyfilter.py
#
# Enter values requested
#
# Render scene to see effect
#
#**********************************************

#--------------------------------------------
# Get Input and Test Value for valuse 0-255
#--------------------------------------------

def TestVal (messagetxt,titletxt,default):
    hit=-2
    val=-1

    while hit<0:
        try:
            if int(val) in range (0,256):
                hit=1;
            elif hit==-2:
                val=Prompt (messagetxt,default,true,titletxt)
                hit=-1
            else:
                val=Prompt ("Error: Value must be an integer between 0 and 255\n\n"+messagetxt,val,true,titletxt)
        except:
            hit=-1
            val=Prompt ("Error: Value must be an integer between 0 and 255\n\n"+messagetxt,val,true,titletxt)

    return val

#--------------------------------------------
# Get Input and Test Value for valuse 0 or 1
#--------------------------------------------

def TestValZO (messagetxt,titletxt,default):
    hit=-2
    val=-1

    while hit<0:
        try:
            if int(val) in range (0,2):
                hit=1;
            elif hit==-2:
                val=Prompt (messagetxt,default,true,titletxt)
                hit=-1
            else:
                val=Prompt ("Error: Value must be either 0 or 1\n\n"+messagetxt,val,true,titletxt)
        except:
            hit=-1
            val=-3

    return val

#-------------------------------------
# Create Sky Callback Function
#-------------------------------------

def SkyFilterCallback(x_pos, y_pos, z_pos, x_dir, y_dir, z_dir):
    return (int(red),int(green),int(blue),int(behind),float(trans))

#------------------------------------
# Ininitialise
#------------------------------------

red=TestVal ('Enter the Red Sky Filter Value (0-255)','Select Red Value','0')
green=TestVal ('Enter the Green Sky Filter Value (0-255)','Select Green Value','0')
blue=TestVal ('Enter the Blue Sky Filter Value (0-255)','Select Blue Value','0')
trans=TestVal ('Enter the Transparancy Value (0-255)','Select Transparancy Value','0')
trans=float(trans)/255
behind=TestValZO ('Enter 0 for in front of clouds\nEnter 1 for behind clouds','Filter Position','1')

SetSkyFilterCallback  (  SkyFilterCallback  )

Message("Simple Sky Colour Filter")

[/codesyntax]

impworks © Copyright Mark Caldwell 1996 - 2024