GregroxMun

sun def example

May 11th, 2017
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.91 KB | None | 0 0
  1. @Kopernicus:FOR[WHATEVER]
  2. {
  3. @Body[Sun]
  4. {
  5.  
  6. DefineStar
  7. {
  8. //Define a Main Sequence Star from mass in SmallSolar Units.
  9. SolarMass = 0.2
  10. }
  11. StellarProperties
  12. {
  13. mass = 1.988435e28
  14. @mass *= #$../DefineStar/SolarMass$
  15.  
  16. radius = #$../DefineStar/SolarMass$
  17. @radius != 0.74
  18. @radius *= 6.957e7
  19.  
  20. SurfaceArea = #$../StellarProperties/radius$
  21. @SurfaceArea != 2
  22.  
  23. RelativeSurfaceTemperature = #$../DefineStar/SolarMass$
  24. @RelativeSurfaceTemperature != 0.505
  25.  
  26. SurfaceTemperature = #../StellarProperties
  27. @SurfaceTemperature *= 5772
  28.  
  29. TempRatio = #$../StellarProperties/SurfaceTemperature$
  30. @TempRatio /= 5772
  31.  
  32. TempRatioToTheFourth = #$../StellarProperties/TempRatio
  33. @TempRatioToTheFourth != 4
  34.  
  35. StarLuminosity = #$../StellarProperties/TempRatioToTheFourth$
  36. @StarLuminosity *= #$../StellarProperties/SurfaceArea$
  37.  
  38. SqrtStarLuminosity = #$../StellarProperties/StarLuminosity$
  39. @SqrtStarLuminosity != 0.5
  40. }
  41.  
  42. @Properties
  43. {
  44. %mass = #$../StellarProperties/mass$
  45. %radius = #$../StellarProperties/radius$
  46. }
  47.  
  48. !COLOR,* {}
  49. COLOR
  50. {
  51. Temperature = #$../StellarProperties/SurfaceTemperature
  52. //BELOW THIS POINT I CHANGE NOTHING THAT MAKES MM ERRORS HAPPEN.
  53. RED = 0
  54. GREEN = 0
  55. BLUE = 0
  56. }
  57.  
  58. @COLOR
  59. {
  60. // Set Temperature = Temperature \ 100
  61. @Temperature /= 100
  62. @Temperature = #$Temperature$.0
  63. @Temperature = #$Temperature[0,.]$
  64. }
  65.  
  66.  
  67.  
  68. // Calculate Red:
  69.  
  70. // If Temperature <= 66 Then
  71. @COLOR:HAS[~Temperature[>66]]
  72. {
  73. // Red = 255
  74. @RED = 1
  75. }
  76. // Else
  77. @COLOR:HAS[#Temperature[>66]]
  78. {
  79. // Red = Temperature - 60
  80. @RED = #$Temperature$
  81. @RED -= 60
  82.  
  83. // Red = 329.698727446 * (Red ^ -0.1332047592)
  84. @RED != -0.1332047592
  85. @RED *= 329.698727446
  86. @RED /= 255
  87. }
  88. // If Red < 0 Then Red = 0
  89. @COLOR:HAS[#RED[<0]]
  90. {
  91. @RED = 0
  92. }
  93. // If Red > 255 Then Red = 255
  94. @COLOR:HAS[#RED[>1]]
  95. {
  96. @RED = 1
  97. }
  98.  
  99.  
  100.  
  101. // Calculate Green:
  102.  
  103. // If Temperature <= 66 Then
  104. @COLOR:HAS[~Temperature[>66]]
  105. {
  106. // Green = Temperature
  107. // Green = 99.4708025861 * Ln(Green) - 161.1195681661
  108. // APPROX TO Green = -0.0431*Temperature^2 + 6.9703*Temperature - 0.206
  109. // REWRITE AS Green = Temperature * (-0.0431*Temperature + 6.9703) - 0.206
  110. @GREEN = #$Temperature$
  111. @GREEN *= -0.0431
  112. @GREEN += 6.9703
  113. @GREEN *= #$Temperature$
  114. @GREEN -= 0.206
  115. @GREEN /= 255
  116. }
  117. // Else
  118. @COLOR:HAS[#Temperature[>66]]
  119. {
  120. // Green = Temperature - 60
  121. @GREEN = #$Temperature$
  122. @GREEN -= 60
  123.  
  124. // Green = 288.1221695283 * (Green ^ -0.0755148492)
  125. @GREEN != -0.0755148492
  126. @GREEN *= 288.1221695283
  127. @GREEN /= 255
  128. }
  129. // If Green < 0 Then Green = 0
  130. @COLOR:HAS[#GREEN[<0]]
  131. {
  132. @GREEN = 0
  133. }
  134. // If Green > 255 Then Green = 255
  135. @COLOR:HAS[#GREEN[>1]]
  136. {
  137. @GREEN = 1
  138. }
  139.  
  140.  
  141.  
  142. // Calculate Blue:
  143.  
  144. // If Temperature >= 66 Then
  145. @COLOR:HAS[~Temperature[<66]]
  146. {
  147. // Blue = 255
  148. @BLUE = 1
  149. }
  150. // If Temperature <= 19 Then
  151. @COLOR:HAS[~Temperature[>19]]
  152. {
  153. // Blue = 0
  154. @BLUE = 0
  155. }
  156. @COLOR:HAS[#Temperature[<66],#Temperature[>19]]
  157. {
  158. // Blue = Temperature - 10
  159. @Temperature -=10
  160.  
  161. // Blue = 138.5177312231 * Ln(Blue) - 305.0447927307
  162. // APPROX TO Blue = -0.0784*Temperature^2 + 10.274*Temperature - 73.434
  163. // REWRITE AS Blue = Temperature*(-0.0784*Temperature+10.274)-73.434
  164. @BLUE = #$Temperature$
  165. @BLUE *= -0.0784
  166. @BLUE += 10.274
  167. @BLUE *= #$Temperature$
  168. @BLUE -= 73.434
  169. @BLUE /= 255
  170.  
  171. // RESTORE Temperature
  172. @Temperature += 10
  173. }
  174. // If Blue < 0 Then Blue = 0
  175. @COLOR:HAS[#BLUE[<0]]
  176. {
  177. @BLUE = 0
  178. }
  179. // If Blue > 255 Then Blue = 255
  180. @COLOR:HAS[#BLUE[>1]]
  181. {
  182. @BLUE = 1
  183. }
  184.  
  185. // APPLY CHANGES
  186.  
  187. %ScaledVersion
  188. {
  189. %Material
  190. {
  191. %emitColor0 = #$../../COLOR/RED$,$../../COLOR/GREEN$,$../../COLOR/BLUE$
  192. %emitColor1 = #$emitColor0$
  193. @emitColor1[*] *= 0.9
  194. %rimColor = #$../../COLOR/RED$,$../../COLOR/GREEN$,$../../COLOR/BLUE$
  195. @rimColor[*] *= 1.7
  196. rimBlend = 0.8
  197. rimPower = 1
  198. %sunspotColor = #$../../COLOR/RED$,$../../COLOR/GREEN$,$../../COLOR/BLUE$
  199. @sunspotCOlor[*] *= 0.01
  200. }
  201. %Light
  202. {
  203. %sunLensFlareColor = #$../../COLOR/RED$,$../../COLOR/GREEN$,$../../COLOR/BLUE$
  204. @sunLensFlareColor[*] *= 0.3
  205. %IVASunColor = #$../../COLOR/RED$,$../../COLOR/GREEN$,$../../COLOR/BLUE$
  206. %scaledSunlightColor = #$../../COLOR/RED$,$../../COLOR/GREEN$,$../../COLOR/BLUE$
  207. %sunlightColor = #$../../COLOR/RED$,$../../COLOR/GREEN$,$../../COLOR/BLUE$
  208. }
  209. %Coronas
  210. {
  211. %Corona
  212. {
  213. %Material
  214. {
  215. texture = RealisticStars/PluginData/NoCorona.png
  216. }
  217. }
  218. %Corona
  219. {
  220. %Material
  221. {
  222. texture = RealisticStars/PluginData/NoCorona.png
  223. }
  224. }
  225. }
  226. }
  227. }
  228. }
Advertisement
Add Comment
Please, Sign In to add comment