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.

  1. #**********************************************
  2. # Simple Sky Colour Filter
  3. # - skyfilter.py
  4. # - Simple Colour Modification of Sky
  5. # - By Mark Caldwell
  6. # - Version 0.1
  7. # - 2nd March 2006
  8. # - Checked with Vue 5 Infinite Version 5.11 and Vue 6 Infinite Pre Release
  9. # - Note this script will not affect Vue6 Spectral Atmospheres
  10. #**********************************************
  11.  
  12. #**********************************************
  13. #
  14. # How to Use Simple Sky Colour Filter
  15. # -----------------------------------
  16. #
  17. # Save this Python script onto your computer
  18. #
  19. # Go To Python -> Run Python Scripts
  20. #
  21. # Locate skyfilter.py
  22. #
  23. # Enter values requested
  24. #
  25. # Render scene to see effect
  26. #
  27. #**********************************************
  28.  
  29. #--------------------------------------------
  30. # Get Input and Test Value for valuse 0-255
  31. #--------------------------------------------
  32.  
  33. def TestVal (messagetxt,titletxt,default):
  34. hit=-2
  35. val=-1
  36.  
  37. while hit<0:
  38. try:
  39. if int(val) in range (0,256):
  40. hit=1;
  41. elif hit==-2:
  42. val=Prompt (messagetxt,default,true,titletxt)
  43. hit=-1
  44. else:
  45. val=Prompt ("Error: Value must be an integer between 0 and 255\n\n"+messagetxt,val,true,titletxt)
  46. except:
  47. hit=-1
  48. val=Prompt ("Error: Value must be an integer between 0 and 255\n\n"+messagetxt,val,true,titletxt)
  49.  
  50. return val
  51.  
  52. #--------------------------------------------
  53. # Get Input and Test Value for valuse 0 or 1
  54. #--------------------------------------------
  55.  
  56. def TestValZO (messagetxt,titletxt,default):
  57. hit=-2
  58. val=-1
  59.  
  60. while hit<0:
  61. try:
  62. if int(val) in range (0,2):
  63. hit=1;
  64. elif hit==-2:
  65. val=Prompt (messagetxt,default,true,titletxt)
  66. hit=-1
  67. else:
  68. val=Prompt ("Error: Value must be either 0 or 1\n\n"+messagetxt,val,true,titletxt)
  69. except:
  70. hit=-1
  71. val=-3
  72.  
  73. return val
  74.  
  75. #-------------------------------------
  76. # Create Sky Callback Function
  77. #-------------------------------------
  78.  
  79. def SkyFilterCallback(x_pos, y_pos, z_pos, x_dir, y_dir, z_dir):
  80. return (int(red),int(green),int(blue),int(behind),float(trans))
  81.  
  82. #------------------------------------
  83. # Ininitialise
  84. #------------------------------------
  85.  
  86. red=TestVal ('Enter the Red Sky Filter Value (0-255)','Select Red Value','0')
  87. green=TestVal ('Enter the Green Sky Filter Value (0-255)','Select Green Value','0')
  88. blue=TestVal ('Enter the Blue Sky Filter Value (0-255)','Select Blue Value','0')
  89. trans=TestVal ('Enter the Transparancy Value (0-255)','Select Transparancy Value','0')
  90. trans=float(trans)/255
  91. behind=TestValZO ('Enter 0 for in front of clouds\nEnter 1 for behind clouds','Filter Position','1')
  92.  
  93. SetSkyFilterCallback ( SkyFilterCallback )
  94.  
  95. Message("Simple Sky Colour Filter")

impworks © Copyright Mark Caldwell 1996 - 2017