GregroxMun

RGBs

Jul 9th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.01 KB | None | 0 0
  1. @Kopernicus:FOR[RedGiantSun]
  2. {
  3. @Body[Sun]
  4. {
  5. @Properties
  6. {
  7. //Red Giant Branch sun, based upon page 3 of this arxiv.org paper: https://arxiv.org/pdf/0801.4031.pdf
  8. displayName = The Dun
  9. radius = 256
  10. mass = 0.668
  11. @radius *= 6.957e7
  12. @mass *= 1.988435e28
  13. description = In the ancient times, the Dun was a small, bright yellow-white orb in the Kerbin sky. At that time, the sun was in the main sequence, fusing hydrogen into helium. It's done now, so it's not really the Sun anymore, it's the monstrous, cooler, reddish Dun.
  14. }
  15. !COLOR,* {}
  16. COLOR
  17. {
  18. Temperature = 2602
  19. RED = 0
  20. GREEN = 0
  21. BLUE = 0
  22. }
  23. @COLOR
  24. {
  25. // Set Temperature = Temperature \ 100
  26. @Temperature /= 100
  27. @Temperature = #$Temperature$.0
  28. @Temperature = #$Temperature[0,.]$
  29. }
  30. // Calculate Red:
  31. // If Temperature <= 66 Then
  32. @COLOR:HAS[~Temperature[>66]]
  33. {
  34. // Red = 255
  35. @RED = 1
  36. }
  37. // Else
  38. @COLOR:HAS[#Temperature[>66]]
  39. {
  40. // Red = Temperature - 60
  41. @RED = #$Temperature$
  42. @RED -= 60
  43. // Red = 329.698727446 * (Red ^ -0.1332047592)
  44. @RED != -0.1332047592
  45. @RED *= 329.698727446
  46. @RED /= 255
  47. }
  48. // If Red < 0 Then Red = 0
  49. @COLOR:HAS[#RED[<0]]
  50. {
  51. @RED = 0
  52. }
  53. // If Red > 255 Then Red = 255
  54. @COLOR:HAS[#RED[>1]]
  55. {
  56. @RED = 1
  57. }
  58. // Calculate Green:
  59. // If Temperature <= 66 Then
  60. @COLOR:HAS[~Temperature[>66]]
  61. {
  62. // Green = Temperature
  63. // Green = 99.4708025861 * Ln(Green) - 161.1195681661
  64. // APPROX TO Green = -0.0431*Temperature^2 + 6.9703*Temperature - 0.206
  65. // REWRITE AS Green = Temperature * (-0.0431*Temperature + 6.9703) - 0.206
  66. @GREEN = #$Temperature$
  67. @GREEN *= -0.0431
  68. @GREEN += 6.9703
  69. @GREEN *= #$Temperature$
  70. @GREEN -= 0.206
  71. @GREEN /= 255
  72. }
  73. // Else
  74. @COLOR:HAS[#Temperature[>66]]
  75. {
  76. // Green = Temperature - 60
  77. @GREEN = #$Temperature$
  78. @GREEN -= 60
  79. // Green = 288.1221695283 * (Green ^ -0.0755148492)
  80. @GREEN != -0.0755148492
  81. @GREEN *= 288.1221695283
  82. @GREEN /= 255
  83. }
  84. // If Green < 0 Then Green = 0
  85. @COLOR:HAS[#GREEN[<0]]
  86. {
  87. @GREEN = 0
  88. }
  89. // If Green > 255 Then Green = 255
  90. @COLOR:HAS[#GREEN[>1]]
  91. {
  92. @GREEN = 1
  93. }
  94. // Calculate Blue:
  95. // If Temperature >= 66 Then
  96. @COLOR:HAS[~Temperature[<66]]
  97. {
  98. // Blue = 255
  99. @BLUE = 1
  100. }
  101. // If Temperature <= 19 Then
  102. @COLOR:HAS[~Temperature[>19]]
  103. {
  104. // Blue = 0
  105. @BLUE = 0
  106. }
  107. @COLOR:HAS[#Temperature[<66],#Temperature[>19]]
  108. {
  109. // Blue = Temperature - 10
  110. @Temperature -=10
  111. // Blue = 138.5177312231 * Ln(Blue) - 305.0447927307
  112. // APPROX TO Blue = -0.0784*Temperature^2 + 10.274*Temperature - 73.434
  113. // REWRITE AS Blue = Temperature*(-0.0784*Temperature+10.274)-73.434
  114. @BLUE = #$Temperature$
  115. @BLUE *= -0.0784
  116. @BLUE += 10.274
  117. @BLUE *= #$Temperature$
  118. @BLUE -= 73.434
  119. @BLUE /= 255
  120. // RESTORE Temperature
  121. @Temperature += 10
  122. }
  123. // If Blue < 0 Then Blue = 0
  124. @COLOR:HAS[#BLUE[<0]]
  125. {
  126. @BLUE = 0
  127. }
  128. // If Blue > 255 Then Blue = 255
  129. @COLOR:HAS[#BLUE[>1]]
  130. {
  131. @BLUE = 1
  132. }
  133. // APPLY CHANGES
  134. %Orbit
  135. {
  136. %color = #$../COLOR/RED$,$../COLOR/GREEN$,$../COLOR/BLUE$
  137. }
  138. @ScaledVersion
  139. {
  140. Material
  141. {
  142. %emitColor0 = #$../../COLOR/RED$,$../../COLOR/GREEN$,$../../COLOR/BLUE$
  143. %emitColor1 = #$emitColor0$
  144. @emitColor1[*] *= 0.9
  145. %rimColor = #$../../COLOR/RED$,$../../COLOR/GREEN$,$../../COLOR/BLUE$
  146. @rimColor[*] *= 1.7
  147. rimBlend = 0.8
  148. rimPower = 1
  149. %sunspotColor = #$../../COLOR/RED$,$../../COLOR/GREEN$,$../../COLOR/BLUE$
  150. @sunspotColor[*] *= 0.01
  151. }
  152. Light
  153. {
  154. %IVASunColor = #$../../COLOR/RED$,$../../COLOR/GREEN$,$../../COLOR/BLUE$
  155. %scaledSunlightColor = #$../../COLOR/RED$,$../../COLOR/GREEN$,$../../COLOR/BLUE$
  156. %sunlightColor = #$../../COLOR/RED$,$../../COLOR/GREEN$,$../../COLOR/BLUE$
  157. %sunAU = #$../../Properties/radius$
  158. %sunLensFlareColor = #$../../COLOR/RED$,$../../COLOR/GREEN$,$../../COLOR/BLUE$
  159. !brightnessCurve {}
  160. brightnessCurve
  161. {
  162. key = 0.0000005 0 0 0
  163. key = 0.00001 0.007 0 0
  164. key = 0.0001 0.1 0 0
  165. key = 0.001 0.3 0 0
  166. key = 0.01 0.4 0 0
  167. key = 0.1 4 0 0
  168. key = 0.2 6 0 0
  169. key = 0.3 10 0 0
  170. }
  171. }
  172. Coronas
  173. {
  174. Corona
  175. {
  176. Material
  177. {
  178. texture = NowItsOver/PluginData/SwirlCorona.png
  179. }
  180. }
  181. Corona
  182. {
  183. Material
  184. {
  185. texture = NowItsOver/PluginData/SwirlCorona.png
  186. }
  187. }
  188. }
  189. }
  190. }
  191. }
Advertisement
Add Comment
Please, Sign In to add comment