- 
                Notifications
    You must be signed in to change notification settings 
- Fork 331
New rendering for starfield #1952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Draft
      
      
            375gnu
  wants to merge
  53
  commits into
  master
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
askaniys-stars
  
      
      
   
  
    
  
  
  
 
  
      
    base: master
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Draft
                    Changes from 1 commit
      Commits
    
    
            Show all changes
          
          
            53 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      3a112ab
              
                wip
              
              
                375gnu 7e49d11
              
                Update shaders/star_vert.glsl
              
              
                375gnu 791a109
              
                [skip ci] Merge branch 'master' into askaniys-stars
              
              
                375gnu 6036e69
              
                wip
              
              
                375gnu 11ed2a0
              
                wip
              
              
                375gnu 6cbd344
              
                use br in psf instead of br0, fix point size
              
              
                375gnu 70890c8
              
                wip
              
              
                375gnu 60e7495
              
                Merge branch 'master' into askaniys-stars
              
              
                375gnu 3d78893
              
                Merge branch 'askaniys-stars' of github.com:CelestiaProject/Celestia …
              
              
                375gnu b2d23fb
              
                New code for dim stars, clean-up
              
              
                Askaniy 2ca7268
              
                Update PSF core
              
              
                Askaniy f2fd102
              
                Remove AutoMag and replace faintest magnitude with exposure (wip)
              
              
                Askaniy e92bc38
              
                More transition to the exposure system (wip)
              
              
                Askaniy 3daa0ba
              
                Added getFluxInVegas
              
              
                Askaniy 5d472cc
              
                Continuing the transition to the exposure system
              
              
                Askaniy da37d6f
              
                fixes
              
              
                375gnu dc57069
              
                Clear irradiance-irradiation system, fixes
              
              
                Askaniy f9bc0ed
              
                missing declaration fix
              
              
                Askaniy 08f22f9
              
                wip
              
              
                Askaniy 4474b4a
              
                wip
              
              
                Askaniy 25052db
              
                wip
              
              
                Askaniy 1b7a795
              
                wip
              
              
                Askaniy 84e6b43
              
                wip
              
              
                Askaniy 462c18d
              
                wip
              
              
                Askaniy 7d9332a
              
                wip
              
              
                Askaniy 66b7031
              
                Controls update (all languages)
              
              
                Askaniy f613993
              
                Start deleting star styles
              
              
                Askaniy 32b64ce
              
                Delete star styles and legacy star colors, set solar whitepoint by de…
              
              
                Askaniy 317f973
              
                fixes
              
              
                Askaniy 85ee257
              
                New label brightness formula
              
              
                Askaniy be3cc07
              
                wip
              
              
                Askaniy 197b77b
              
                Simpler fragment shader for 9 px mode
              
              
                Askaniy cbd67e6
              
                Deleting as much legacy stellar code as possible
              
              
                Askaniy be55064
              
                Merge the limb-darkening branch
              
              
                Askaniy cb13c27
              
                Copyright updates
              
              
                Askaniy 98ee734
              
                Update astro constants with actual standards
              
              
                Askaniy 34e8927
              
                clarification
              
              
                Askaniy 73281f2
              
                clarification
              
              
                Askaniy 2bd203f
              
                fixes
              
              
                Askaniy 7719c66
              
                (semi)fixes
              
              
                375gnu e203600
              
                labels fixing
              
              
                Askaniy 1050ea2
              
                Revert the computation of LN_MAG
              
              
                Askaniy 264fc23
              
                Merge branch 'master' into askaniys-stars
              
              
                ajtribick 345adf3
              
                Some random fixes
              
              
                375gnu ec70d89
              
                Merge branch 'master' into askaniys-stars
              
              
                375gnu 7bf6254
              
                Merge branch 'master' into askaniys-stars
              
              
                375gnu d18896f
              
                Merge branch 'master' into askaniys-stars
              
              
                375gnu 8430822
              
                fix merge issues
              
              
                375gnu 6843fe6
              
                Merge branch 'master' into askaniys-stars
              
              
                375gnu a0b4044
              
                change exposure adjusting
              
              
                375gnu 683baa2
              
                Merge branch 'master' into askaniys-stars
              
              
                ajtribick 71eb489
              
                Fix Imgui interface
              
              
                ajtribick 63172e4
              
                Merge branch 'master' into askaniys-stars
              
              
                375gnu File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,7 +1,59 @@ | ||
| uniform sampler2D starTex; | ||
| varying vec4 color; | ||
| const float degree_per_px = 0.05; | ||
| const float br_limit = 1.0 / (255.0 * 12.92); | ||
|  | ||
| varying vec3 v_color; | ||
| varying vec3 v_max_tetha_hk; | ||
| varying float pointSize; | ||
|  | ||
| float psf_square(float theta, float min_theta, float max_theta, float h, float k, float b) | ||
| { | ||
| // Human eye's point source function, optimized to fit a square. | ||
| // Lower limit on brightness and angular size: 1 Vega and 0.05 degrees per pixel. | ||
| // No upper limits. | ||
|  | ||
| if (theta < min_theta) | ||
| return 1.0; // overexposed | ||
|  | ||
| if (theta < max_theta) | ||
| { | ||
| float brackets = b / (theta - h) - 1.0; | ||
| return brackets * brackets / k; | ||
| } | ||
|  | ||
| return 0.0; // after max_theta function starts to grow again | ||
| } | ||
|  | ||
| /* | ||
| float psf_fullscreen(float theta, float min_theta): | ||
| { | ||
| // Human eye's point source function, optimized to be a full-screen shader. | ||
| // The price to pay for simplification is a brightness reduction compared to the original PSF. | ||
|  | ||
| if (theta2 < min_theta) | ||
| return 1; // overexposed | ||
|  | ||
| return 4.43366571e-6 / theta; | ||
| } | ||
| */ | ||
|  | ||
| void main(void) | ||
| { | ||
| gl_FragColor = texture2D(starTex, gl_PointCoord) * color; | ||
| float max_theta = v_max_tetha_hk.x; | ||
| if (max_theta == -1.0) | ||
| { | ||
| gl_FragColor = vec4(v_color, 1.0); | ||
| } | ||
| else | ||
| { | ||
| float h = v_max_tetha_hk.y; | ||
| float k = v_max_tetha_hk.z; | ||
|  | ||
| float b = max_theta - h; | ||
| float min_theta = h + b / (sqrt(k) + 1.0); | ||
|  | ||
| vec2 offset = (gl_PointCoord.xy - vec2(0.5)) * pointSize; | ||
| float theta = length(offset) * degree_per_px; | ||
|  | ||
| gl_FragColor = vec4(v_color * psf_square(theta, min_theta, max_theta, h, k, b), 1.0); | ||
| } | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,11 +1,45 @@ | ||
| attribute vec3 in_Position; | ||
| attribute vec4 in_Color; | ||
| attribute float in_PointSize; | ||
| varying vec4 color; | ||
|  | ||
| const float degree_per_px = 0.05; | ||
| const float br_limit = 1.0 / (255.0 * 12.92); | ||
|  | ||
| varying vec3 v_color; // 12 | ||
| varying vec3 v_max_tetha_hk; // 24 | ||
| varying float pointSize; // 28 | ||
|  | ||
| uniform vec2 viewportSize; | ||
|  | ||
| attribute vec4 in_Position; | ||
| attribute vec3 in_Color; | ||
| attribute float in_PointSize; // scaled brightness measured in Vegas | ||
|  | ||
| float psf_max_theta(float br) | ||
| { | ||
| return 0.012 + 1.488 / (sqrt(br_limit * 1000000.0 / (11.0 * br)) + 1.0); | ||
| } | ||
|         
                  375gnu marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
|  | ||
| void main(void) | ||
| { | ||
| gl_PointSize = in_PointSize; | ||
| color = in_Color; | ||
| set_vp(vec4(in_Position, 1.0)); | ||
| float linearBr = pow(10.0, 0.4f * in_PointSize) * br_limit; | ||
| vec3 color0 = in_Color * (linearBr / in_Color.g); // scaling on brightness and normalizing by green channel | ||
|  | ||
| vec3 check_vec = step(vec3(1.0), color0); // step(edge, x) - For element i of the return value, 0.0 is returned if x[i] < edge[i], and 1.0 is returned otherwise. | ||
| float check = check_vec.x + check_vec.y + check_vec.z; | ||
| if (check == 0.0) | ||
| { | ||
| pointSize = 1.0; | ||
| v_max_tetha_hk = vec3(-1.0); | ||
| } | ||
| else | ||
| { | ||
| float max_theta = 0.33435822702992773 * sqrt(max(color0.r, max(color0.g, color0.b))); // glare radius | ||
| pointSize = 2.0 * ceil(max_theta / degree_per_px); | ||
|  | ||
| float h = 0.0082234880783653 * pow(max_theta, 0.7369983254906639); // h, k, b - common constants, depending originally on star brightness | ||
| float k = 38581.577272697796 * pow(max_theta, 2.368787717957141); | ||
| v_max_tetha_hk = vec3(max_theta, h, k); | ||
| } | ||
|  | ||
| gl_PointSize = pointSize; | ||
| v_color = color0; | ||
| set_vp(in_Position); | ||
| } | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.