© GMV 2021 , all rights reserved VALIDATION AND TEST PROGRAMS FOR THE OPENGL LIGHT CURVES SIMULATOR GRIAL Prepared by: Miguel Guereñu Mira Approved by: Iván Llamas de la Sierra Authorized by: Javier Carro Code: GRIAL - NT - 002 - GMV Version: 1.0 Date: 10/09/2021 Code: GRIAL - NT - 002 - GMV Date: 10/09/2021 Version: 1.0 Page: 2 of 30 Grial © GMV 2021 , all rights reserved Validation and test programs for the OpenGL ligh t curves simulator TABLE OF CONTENTS 1. INTRODUCTION ................................ ................................ ................................ .................. 5 1.1. PURPOSE ................................ ................................ ................................ ................... 5 1.2. SCOPE ................................ ................................ ................................ ...................... 5 1.3. DEFINITIONS AND ACRONYMS ................................ ................................ ..................... 6 1.3.1. Definitions ................................ ................................ ................................ ..... 6 1.3.2. Acronyms ................................ ................................ ................................ ...... 6 2. REFERENCES ................................ ................................ ................................ ...................... 8 2.1. APPLICABLE DOCUMENTS ................................ ................................ ............................ 8 2.2. REFERENCE DOCUMENTS ................................ ................................ ............................ 8 2.3. OTHER REFERENCES ................................ ................................ ................................ ... 9 3. TEST PROJECTS ................................ ................................ ................................ ................ 10 3.1. GRIAL_SATELLITE_1 ................................ ................................ ................................ .. 10 3.1.1. purpose ................................ ................................ ................................ ....... 10 3.1.2. behavior ................................ ................................ ................................ ....... 10 3.1.3. classes & shaders ................................ ................................ .......................... 11 3.1.4. conclusions ................................ ................................ ................................ ... 11 3.2. GRI AL_SATELLITE_2 ................................ ................................ ................................ .. 12 3.2.1. purpose ................................ ................................ ................................ ....... 12 3.2.2. behavior ................................ ................................ ................................ ....... 12 3.2.3. classes & shaders ................................ ................................ .......................... 12 3.2.4. conclusions ................................ ................................ ................................ ... 12 3.3. GRIAL_MODEL_LOADING ................................ ................................ ............................ 13 3.3.1. purpose ................................ ................................ ................................ ....... 13 3.3.2. behavior ................................ ................................ ................................ ....... 13 3.3.3. classes & shaders ................................ ................................ .......................... 13 3.3.4. c onclusions ................................ ................................ ................................ ... 14 3.4. GRIAL_CONFIGURATION ................................ ................................ ............................ 14 3.4.1. purpose ................................ ................................ ................................ ....... 14 3.4.2. behavior ................................ ................................ ................................ ....... 14 3.4.3. classes & shaders ................................ ................................ .......................... 15 3.4.4. conclusions ................................ ................................ ................................ ... 15 3.5. GRIAL_SPE ED_UP ................................ ................................ ................................ ...... 16 3.5.1. purpose ................................ ................................ ................................ ....... 16 3.5.2. behavior ................................ ................................ ................................ ....... 16 3.5.3. classes & shaders ................................ ................................ .......................... 17 3.5.4. conclusions ................................ ................................ ................................ ... 17 3.6. GRIAL_SHADOW_MAPPING ................................ ................................ ......................... 18 3.6.1. purpose ................................ ................................ ................................ ....... 18 3.6.2. behavior ................................ ................................ ................................ ....... 18 3.6.3. classes & s haders ................................ ................................ .......................... 19 3.6.4. conclusions ................................ ................................ ................................ ... 19 3.7. GRIAL_JAR_ANT & GRIAL_JAR_MAVEN ................................ ................................ ......... 20 3.7.1. purpose ................................ ................................ ................................ ....... 20 3.7.2. behavior ................................ ................................ ................................ ....... 20 Code: GRIAL - NT - 002 - GMV Date: 10/09/2021 Version: 1.0 Page: 3 of 30 Grial © GMV 2021 , all rights reserved Validation and test programs for the OpenGL light curves simulator 3.7.3. classes & shaders ................................ ................................ .......................... 21 3.7.4. conclusions ................................ ................................ ................................ .. 21 3.8. GRIAL_ADAPTED ................................ ................................ ................................ ....... 21 3.8.1. purpose ................................ ................................ ................................ ....... 21 3.8.2. Behavior ................................ ................................ ................................ ...... 21 3.8.3. classes & shaders ................................ ................................ .......................... 22 3.8.4. conclusions ................................ ................................ ................................ .. 22 4. VALIDATION PROJECTS ................................ ................................ ................................ .... 23 4.1. GRIAL_TRIANGLE ................................ ................................ ................................ ...... 23 4.1.1. purpose ................................ ................................ ................................ ....... 23 4.1.2. behavior ................................ ................................ ................................ ...... 23 4.1.3. classes & s haders ................................ ................................ .......................... 24 4.1.4. conclusions ................................ ................................ ................................ .. 24 4.2. GRIAL_COMPARISON_PERT ................................ ................................ ........................ 25 4.2.1. purpose ................................ ................................ ................................ ....... 25 4.2.2. behavior ................................ ................................ ................................ ...... 25 4.2.3. classes & Shaders ................................ ................................ ......................... 26 4.2.4. c onclusions ................................ ................................ ................................ .. 26 5. FINAL VALIDATION ................................ ................................ ................................ ........... 27 ANNEX A. EXAMPLE OF THE OUTPUT FILE ................................ ................................ ............. 29 Code: GRIAL - NT - 002 - GMV Date: 10/09/2021 Version: 1.0 Page: 4 of 30 Grial © GMV 2021 , all rights reserved Validation and test programs for the OpenGL ligh t curves simulator LIST OF TABLES AND FIGURES Table 1 - 1 Definitions ................................ ................................ ................................ ................ 6 Table 1 - 2 Acronyms ................................ ................................ ................................ ................. 6 Table 2 - 1 Applicable Documents ................................ ................................ ................................ 8 Table 2 - 2 Reference Documents ................................ ................................ ................................ 8 Table 2 - 3 Other references ................................ ................................ ................................ ....... 9 Table 3 - 1 Speed of the program for each different appoach (800 x 800 pixels). .............................. 16 Figure 5 - 1 : Geometric models use d for the light curves simulator program validation. .................... 28 Figure 5 - 2 : Fragment of the output file containing the grid with the results. ................................ .. 29 Code: GRIAL - NT - 002 - GMV Date: 10/09/2021 Version: 1.0 Page: 5 of 30 Grial © GMV 2021 , all rights reserved Validation and test programs for the OpenGL light curves simulator 1. INTRODUCTION This document contains a detailed explanation of the process carried out to create a program that calculates the visible light reflect ed by a satellite. The objective is to obtain, for a given satellite model, a table with the magnitude of the satellite for each combination of: ◼ Direction of the Sun with respect to the observer. ◼ Attitude of the satellite with respect to the observer. In order to achieve it , OpenGL will be used . It is a cross - language, cross - platform API for rendering 2D and 3D vector graphics , taking advantage of its pipeline to perform per vertex and/ or per pixel operations. This magnitude will be calculate d for all combinations depending on a user - defined angle step. Furthermore, the precision will also be controlled through the number of pixels of the window in which the calculations are executed. Once this program is finished and validated, it will be integrated into a program that aims to calculate the in - orbit visible light curves of a satellite, given its geometry and the ground stations from which it is intended to be observed. For it, this sim ulator will be integrated with a propagator that makes use of th e P atrius java library of CNES. Returning to this document, two types of project will be explained : ◼ Test projects → created throughout the process until obtaining the final simulator ◼ Valida tion projects → created with the objective of verifying results or the accuracy of the program. It is highly recommended to read t he sections 3 and 5 of the A D.1 document before reading this document, as it is considered to be essential information to un d erstand the content in a quick and clear way 1.1. PURPOSE The objective of this document is to explain in detail the entire process carried out to achieve the final light curve simulat or, as well as the validations to confirm the accuracy of the results. It has been written as clear as possible so that the reader can understand in a simple way the progress that has been followed throughout the process until reaching the final program. 1.2. SCOPE The document contains both the programs created with the objective of progressing and those created to validate results. However, the operation of the final simulator and the physical models used for the reflection of the light are not explained, since it is not considered essential information to understand wha t is explained here. The integration of the simulator with the propagator is not explained n either. All these issues are explained in the different applicable documents presented in section 2.1. Code: GRIAL - NT - 002 - GMV Date: 10/09/2021 Version: 1.0 Page: 6 of 30 Grial © GMV 2021 , all rights reserved Validation and test programs for the OpenGL ligh t curves simulator 1.3. DEFINITIONS AND ACRONYMS 1.3.1. DEFINITIONS Concepts and terms used in this document and needing a definition are included in the following table: Table 1 - 1 Definitions Concept / Term Definition Culling Process of selecting all the faces that are front facing towards the viewer and rendering them, while discarding those that are back facing the viewer. Displaylist Group of OpenGL commands that have been stored for later execution. When a display list is invoked, the commands in it are executed in the order in which they w ere issued. HashMap Java class that allows to store pairs of objects (key or identifying object and its value) with an undefined order. Interleaved array OpenGL array that contains all the vertex attributes in a user - defined order (position, normal, colo ur, user - defined properties, etc.). Magnitude Unitless measure of the brightness of an object in a defined passband, often the visible or infrared spectrum, but sometimes across all wavelengths. The scale is logarithmic and defined such that each step of one magnitude changes the brightness by a factor of the fifth root of 100. Maven Build automation tool used primarly for Java projects. Unlike earlier tools lije Apache Ant, it uses conventions for the build procedure, and only exceptions need to be written down. OpenGL It stands for Open Graphics Library. Cross - language, cross - platform API (Application Programming Interface) for rendering 2D and 3D vector graphics. Typically used to interact with a graphics processing unit (GPU) in order to achieve hardware - accelerated rendering. Patrius Software made up of several Java libraries covering different areas of flight dynamics. It contains both basic classes and methods as well as much higher level code, making easy to perform orbit propagation, timin g, diagram calculations, attitude guide law calculations, etc. PERT Software from the CNES aimed at calculating surface forces. One of its modules obtains the apparent magnitude of an object from its surface properties, geometry and orientation, as well as the Sun direction. Peter panning Shadow artifact that causes the objects seem slightly detached from their shadows, due to the bias used when calculating the shadows. Shader Simple program that describes the traits of either a vertex or a pixel. Shadow acne Shadow artifact that causes the objects present black lines i n an alternating fashion. Texture coordinates Vertex attributes that specify the point in the texture image that will correspond to the vertex it is being specified them for. Vertex attribute Values that are provided per vertex in OpenGL and that are use d to communicate from outside to the vertex shader. 1.3.2. ACRONYMS Acronyms used in this document and needing a definition are included in the following table: Table 1 - 2 Acronyms Acronym Definition API Application Programming Interface . Software intermediary that allows two applications to talk to each other. It is also defined as a set of definitions and protocols for building and integrating application software. CNES Centre National d’ É tudes Spatial es . It is a public industrial and commercial establishment responsible for developing and proposing the French space program to the French government, as well as for implementing it. Code: GRIAL - NT - 002 - GMV Date: 10/09/2021 Version: 1.0 Page: 7 of 30 Grial © GMV 2021 , all rights reserved Validation and test programs for the OpenGL light curves simulator Acronym Definition CPU Central Processing Unit . Electronic circuitry that executes instruc tions comprising a computer program. It performs basic arithmetic, logic, controlling and input/output (I/O) operations specified by the instructions in the program. DMA Direct Memory Access . Method that allows an I/O device to send or receive data directly to or from the main memory, bypassing the CPU to speed up memory operations. The process is managed by a chip known as DMA controller (DMAC). FBO FrameBuffer Object OpenGL object that allows the creation of user - defined framebuffers. With them, one can render to non - default locations, and thus render without disturbing the main screen. It is often used for off - screen rendering. FPS Frames Per Second . Frequency at which consecutive images appear on a display. GLSL Graphics Library Shading Language . Language that gives programmers the ability to modify pipeline shaders, controlling the behaviour of the program when carrying out the per - vertex or per - pixel operations. GPU Graphics Processing Unit . Specialized electronic circuit desi gned to rapidly manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display device. It is very efficient at manipulating computer graphics and image processing due to its highly parallel structure. JOGL Java OpenGL . Wrapper library that allows OpenGL to be used in the Java programming language. It allows access to most OpenGL features available to C language programs through the use of the Java Native Interface (JNI). JVM Java Virtual Machine . Virt ual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. PBO Pixel Buffer Object . OpenGL buffer object that is used for asynchronous pixel transfer operations. By all owing OpenGL to manage the memory used as the source or destination of pixel transfer operations, OpenGL is able to avoid explicit synchronization until the user accesses the buffer object. RGBA Red, Green, Blue, Alpha . Three - channel RGB colour space or model supplemented with a fourth alpha channel that indicates how opaque each pixel is and allows an image to be combined over others using alpha compositing, with transparent areas and anti - aliasing of the edges of opaque regions. VAO Vertex Array Objec t . OpenGL object that stores all of the state needed to supply vertex data. It stores the format of the vertex data as well as the buffer objects providing the vertex data arrays. VBO Vertex Buffer Object . Common term for an OpenGL buffer object when it is used as a source for vertex array data. It is no different from any other buffer object, and a buffer object used for transform feedback or asynchronous pixel transfers can be used as source values for vertex arrays. Code: GRIAL - NT - 002 - GMV Date: 10/09/2021 Version: 1.0 Page: 8 of 30 Grial © GMV 2021 , all rights reserved Validation and test programs for the OpenGL ligh t curves simulator 2. REFERENCES 2.1. APPLICABLE DOCUMENT S The following documents form part of this document to the extent specified herein. They are those referenced in the Contract or approved by the Approval Authority, and are referenced as [AD.x]: Table 2 - 1 App licable Documents Ref. File Year [AD.1] Grial 2021 [AD.2] P atrius p ropagator v alidation 2021 [AD.3] Final program validation 2021 2.2. REFERENCE DOCUMENTS The following documents amplify or clarify the content of this document. They are referenced as [RD.x]: Table 2 - 2 Reference Documents Ref. Title Year [RD.1] A machine learning approach to spacecraft attitude and identification based on RCS. 2021 [RD.2] Algorithms analysis for the estimation of the reflected light, RCS and laser distance. 2021 [RD.3] Attitude estimation from Light Curves. C. J. Wetterer, M. Jah. 2009 [RD.4] Attitude Observability from Light Curve Measurements. American Institute of Aeronautics and Astronautics J. Hinks, R. Linares, J.L. Crassidis 2013 [RD.5] Attitude Stat es of Space Debris determined from Optical Light Curve Observations. Schildknecht, Thomas et al. 2017 [RD.6] CIC exchange protocol V2.0. 2015 [RD.7] Description of the algorithms for the estimation of the reflected light, RCS and laser distance. 2021 [RD.8] Determining and Modelling Space Debris Attitude States by Fusing Data from different Observation. T. Schildknecht, J. Šilha. 2017 [RD.9] Extensive light curve database of Astronomical Institute of the University of Bern. Silha, J., Schildknecht, Thomas et Pit tet, J.N. 2017 [RD.10] Fundamentals of the physical theory of diffraction. P. Y. Ufimtsev. 2007 [RD.11] Gnuplot 5.4. 2020 [RD.12] Light Curve Analysis and Attitude Estimation of Space Objects Focusing on Glint. First International Orbital Debris Conference. Matsushita, Arakawa et al. 2019 [RD.13] Light Curves of Retired Geosynchronous Satellites. Benson, C., et al 2017 [RD.14] Models of light reflection for computer synthesized pictures. J.F. Blinn. 1977 [RD.15] Particle filtering light curve based attitude estimation for non - resolved space objects. R. Linares, J. L. Crassidis, M. Jah. 2010 [RD.16] Phong Normalization Factor Derivation. F. Glesen. 2 005 [RD.17] Rapport de fin de stage : Modélisation de l’attitude d’un objet spatial. P. Massu. 2018 [RD.18] Real - Time Shading with Phong BRDF Model. Dokuz Eylul University. Murat Kurt 2019 [RD.19] VTS user manual. 2020 Code: GRIAL - NT - 002 - GMV Date: 10/09/2021 Version: 1.0 Page: 9 of 30 Grial © GMV 2021 , all rights reserved Validation and test programs for the OpenGL light curves simulator 2.3. OTHER REFERENCES The following references do not consist of documents, but of web pages used in important parts of the project with the same function as the documents in the previous table, so they will be referenced following the same nomenclature. They are referenced in this document in the form [RD.x] : Table 2 - 3 Other references Ref. Url Goal [RD.20] https://ant.apache.org Learning how to create an executable jar file through the apache ant package. [RD.21] https://aras - p.info/blog/2009/07/30/encoding - floats - to - rgba - the - final Encoding and decoding a floating point value in the RGB palette. [RD.22] https://www.celestrak.com/SpaceTrack Obtaining the orbital parameters for the validation cases of the propagator and the final program. [RD.23] https ://commons.apache.org/proper/commons - cli Implementing the possibility to pass the arguments to the program through the command line. [RD.24] https://www.cosmos.esa.int/web/hipparcos/ java - tools/light - curve App that plots the phase - folded Hp light curve for a user - defined Hipparcos star. [RD.25] http://docs.gl OpenGL API documentation. [RD.26] https://github.com/demoscenepassivist/SocialCoding Coding the wavefront object loader in order to load the model of the satellite in the program. [RD.27] https://www.glprogramming.com/red Learning OpenGL. [RD.28] https://hal.inria.fr/inria - 00281388/document Reviewing the different algorithms for the cast shadows implementation. [RD.29] https://jogamp.org/jogl/www Learning how to use OpenGL in Java through JOGL. [RD.30] https://www.khronos.org/opengl/wiki/Framebuffer_O bject_Extension_E xamples Accelerating the program through the use of framebuffer objects. [RD.31] https://www.khronos.org/opengl/wiki/Rendering_Pipel ine_Overview Understanding the pipeline of OpenGL. [RD.32] https://www.khronos.org/registry/OpenGL/specs/gl/G LSLangSpec.4.50.pdf Guide for the OpenGL shading language. [RD.33] https://l earnopengl.com Solving various problems related to OpenGL, especially the implementation of the cast shadows. [RD.34] https://learnopengl.com/Advanced - OpenGL/Framebuffers Accelerating the progr am through the use of framebuffer objects. [RD.35] https://logiciels.cnes.fr/sites/default/files/javadoc/149 5105532/documentation/index.html Patrius library documentation and javadoc. [RD.36] https://ogldev.org/www/tutorial23/tutorial23.html Implementing the shadow mapping algorithm for the cast shadows. [RD.37] https://ogldev.org/www/tutorial24/tutorial24.html Implementing the shadow mapping algorithm for the cast shadows. [RD.38] https://patrius.cn es.fr/index.php/Accueil Creating the Patrius propagator. It is a complete guide with all the documentation and tutorials. [RD.39] http://www.paulsprojects.net/tutorials/smt/smt.html Implementing the shadow mapping algorithm for the cast shadows. [RD.40] http://www.songho.ca/opengl/gl_pbo.html Accelerating the program through the use of pixel buffer objects (PBOs). [RD.41] https://stackoverflow.com/questions/20765098/openg l - offscreen - rendering - in - linux - is - slow Accelerating the program through the use of the off - screen rende ring technique. [RD.42] https://subscription.packtpub.com/book/game_develo pment/97817 82167020/1/ch01lvl1sec14/sending - data - to - a - shader - using - vertex - attributes - and - vertex - buffer - objects Loading the material properties of each element of the satellite’s model in the program and passing them to OpenGL. Code: GRIAL - NT - 002 - GMV Date: 10/09/2021 Version: 1.0 Page: 10 of 30 Grial © GMV 2021 , all rights reserved Validation and test programs for the OpenGL ligh t curves simulator 3. TEST PROJECTS In this section , the projects created up to the final light curve simulator will be presented in chronological order. For each of them, the reason why it was carried out, its behavior, the classes and shaders that compose it and the conclusions obtained after carrying it out will be explained. It should be noted that the level of de tail of each explanation varies depending on its importance and its level of complexity, ranging from a simple summary of the behavior and objectives to a step - by - step detailed exp lanation of th e process 3.1. GRIAL_SATELLITE_1 3.1.1. PURPOSE The scope of this project was to learn how to create a maven project with JOGL (OpenGL implementation) in eclipse and explore the basic OpenGL functionalities. In this way, the program would become a good base on which to start the project. The main objectives were: ◼ Create a first program using OpenGL in Java and obtain a simple geometric model with default lighting on the screen. ◼ Implement user - defined shaders in order to control the operations carried out when processing each vertex and thus be able to calculate the position and colour of each pixel through user - defined functions. ◼ Read the value of the colours of the pixels that appear on the screen and write them in an output file. ◼ Loop through all the possible combinations (sun direction and satellite ’s attitude) and create an output file with one line of information per iteration. 3.1.2. BEHAVIOR The program consists of 5 different and independent executable classes that make use of 2 other non - executable classes to achieve the objectives defined above. In all of them, the fi rst step is the definition of some parameters that allow the creation of a very simple satellit e model made of 3 parallelepipeds representing th e body of the satellite and two solar panels. The us er can define the dimensions of each one of them, as well as the r otation angle of each solar panel Next, the behavior of each of the cases is summarized : ◼ SatelliteDefault.java → This program is the only one that does not make use of the 2 non - executable classes mentioned above. First, it defines the characteristics of the light (directional white light considered at infinity , so all the rays are parallel) and the camera , adjusting its field of view to the size of the model (the projection of the model is done orthographically, since the receiver is considered to be loc ated at infinity). Once all the necessary OpenGL func tionalities have been initialized (culling, depth test, normal ize ...), the model is painted in a window taking into account both the attitude of the satellite and the direction of the light, defined by the user. It should be noted that the program has links to the keyboard and mouse that allow the user t o rotate the model around its geometric center ◼ SatelliteDefined.java → This program does exactly the same as the previous one but making use of user - defined shaders to determine both the position and the color of the model. The vertex shader determines the final posi tion of each vertex in the output window, while the fragment shader determines the color of each of the pixels that are painted on the screen. The interpolation necessary to pass from vertices to pixels is performed by OpenGL between these two processes, f ollowing a barycentric model. It should be noted that the implemented vertex shader is the same as the one in OpenGL by default, while the fragment shader defines the color of each pixel on a gray - red scale depending on the dot product between the no rmal t o the surface to which the pixel belongs and the direction of the light. Code: GRIAL - NT - 002 - GMV Date: 10/09/2021 Version: 1.0 Page: 11 of 30 Grial © GMV 2021 , all rights reserved Validation and test programs for the OpenGL light curves simulator ◼ SatelliteDefinedOutImage.java → In this case, the use r interaction through the mouse/ keyboard is disabled (the out put is an image, not an animation) and a single orientation is obtained, the rest of the program being the same as the previous. In addition, the 4 components of the color of each pixel (RGBA) are sav ed in a variable and later written in an outpu t file ◼ SatelliteDefinedOutLoopSc.java → As in the previou s case, the user interaction is still d isabled. T he satellite model changes its attitude in each frame based on a user - defined step angle, so the output is an animation that moves automatically through all the possible combinations. In each of the iteratio ns, both the light direction and the satellite orientation, as well as the sum of all the red color components of each pixel (R), are saved and written in to an output file. ◼ SatelliteDefinedOutLoopScSun.java → T his last program does exactly the same as the previous one, but going through all the light direction combinations as well, being m ore similar to what is desired in the final program. It should be remembered that in all the previous cases , t he observer is fixed (representing the antenna, camera or re ceiver on the ground) and both the attitude of the satellite and the direction of the Sun vary . In addition, the Sun and the receiver are considered at infinity with respect to the s atellite, so the light rays travel parallel. 3.1.3. CLASSES & SHADERS ◼ Non - executable classes: - ShaderProgram.java → It represents a program containing the vertex and fragment shaders that will be used in the executable classes. It contains the program ID, as well as the vertex shade r ID and the fragment shader ID, as well as some methods to manage the attributes (getters and setters). - ShaderUtils.java → It contains some useful methods to manage t he shader programs. The method loadResource() allows to read the files containing the code, createShader() creates the shader program and links the vertex and fragment shader to it, and link() attaches the program to the OpenGL context. ◼ Executable classes: - SatelliteDefault.java → (See 3 .1.2) - SatelliteDefined.java → (See 3 .1.2) - SatelliteDefinedOutImage.java → (See 3 .1.2) - SatelliteDefinedOutLoopSc.java → (See 3 .1.2) - SatelliteDefinedOutLoopScSun.java → (See 3 .1.2) ◼ Shaders: - vertexshaderRGB.txt → it determines the position of each vertex in w indow coordinates (see section 3 of the AD.1 document ) and passes the normals as outp ut so that they can be used by the fragment shader. - fragmentshaderRGB.txt → It determines the color of e ach pixel based on the dot product between the normal of the surface to which it belongs and the direction of the Sun. 3.1.4. CONCLUSIONS A ll the objectives considered at the beginning of the project have been achieved, which has allowed to acquire a greater knowledge about the operation of OpenGL and its use in Java. In addition, the different classes created constitute a very good base on which to start developing the final program, since they provide very useful tools for debugging in case of errors, with different types of output : free mouse - controlled animation, image with the value of the pixels written in a file, automatic animation with all t he orientations of the Sun and satellite, etc. It is highly recommended to read the section 4.1 before continuing. Code: GRIAL - NT - 002 - GMV Date: 10/09/2021 Version: 1.0 Page: 12 of 30 Grial © GMV 2021 , all rights reserved Validation and test programs for the OpenGL ligh t curves simulator 3.2. GRI AL_SATELLITE_2 3.2.1. PURPOSE The goal of this project was very simple: to integrate all the new functionalities of the grial_triangle project (s ee 4.1.) into the grial_satellite_1 project in order to make it evolve. The structure of the project is pretty much the same as its predecessor (5 executable classes and 2 non - executable classes) but including the vertex and fragment shaders explained in t he grial_triangle project. 3.2.2. BEHAVIO R The operation of the classes is basically the same as in the first pro ject, so depending on the class , an animation with mouse control, an image or an automatic animation can be obtained. Besides, a s output file, the val ue of the pixels and the decoded magnitude are obta ined in the case of the image and one line per iteration is obtained in the case of the automatic animation s The most important difference is the use of user - defined shaders (vertex and fragment shader) to control the position and color of each pixel based on user - defined functions. T he color may represent a user - defined attribute (no physical sense) or the dimension - less intensity of light reflected depending on the chosen vertex shader, and it is defined as a red - scale 8 - bit precision or as a 24 - bit float encoded in the RGB triplet depending on the chosen fragment shader. 3.2.3. CLASSES & SHADERS ◼ Non - executable classes: - Sh aderProgram.java → (See 3 .1.3.) - ShaderUtils.java → (See 3 .1.3.) ◼ Executable classes: - SatelliteDefault.java → (See 3 .1.2) - SatelliteShader.java → (See SatelliteDefault.java in 3 .1.2 with new shaders) - SatelliteShaderOutImage.java → (See SatelliteDefault.java in 3 .1.2 with new shaders) - SatelliteShaderOutLoopSc.java → (See SatelliteDefault.java in 3 .1.2 with new shaders) - SatelliteShaderOutLoopScSun.java → (See SatelliteDefault.java in 3 .1.2 with new shaders) ◼ Shaders: - vertexShaderAttri bute.txt → (See 4.1 .3.) - vertexShaderIllumination.txt → (See 4.1 .3.) - fragmentShaderRed8bit.txt → (See 4.1 .3.) - fragmentShaderRGB24bit → (See 4.1 .3.) 3.2.4. CONCLUSIONS All the new functionalities were successfully added to the first project, which meant a good evolution of the same and another step to reach the final program. Code: GRIAL - NT - 002 - GMV Date: 10/09/2021 Version: 1.0 Page: 13 of 30 Grial © GMV 2021 , all rights reserved Validation and test programs for the OpenGL light curves simulator 3.3. GRIAL_MODEL_LOADING 3.3.1. PURPOSE This project was created in order to learn how to read a model of an object and import it so that OpenGL can draw it in a window or process it as if it had been created using OpenGL functionalities. 3.3.2. BEHAVIO R The project contains 1 executable class that makes use of 2 other non - executable classes to load the model. When executing the ModelLoaderDefault.java class the desired model is loaded, a window is opened , an d the model is drawn in it. Furthermore, the mouse/keyboard user interaction to rotate the model around its geometric center is enabled. This program, therefore, does not perform any function other than the SatelliteDefault.java class of the grial_satellit e1 an d grial_satellite2 projects, but it implements the possibility of loading a model from outside the program, so the important thing is to focus on how this is done. This is what the 2 other classes ( WavefrontObjectLoader.java and WavefrontObjectLoader2 .java ) are for. They are not complementary, but the first one is optimized to load models composed by triangles, while the second can also load models formed by other primitives such as quadrilaterals or polygons, but performing a greater number of operati ons. The interest of these classes is that they have a method to load the model directly into a displaylist , which means that once loaded, the program only has to call this displaylist in order to paint the entire model. Only wavefront object models (with .obj extension) can be loaded , as the class takes advantage of their structure to do it . When calling the method of the class to read the model, the program goes line by line thr ough the file and: ◼ If the line starts with v , it interprets it as the coordinates of a vertex. ◼ If the line starts with vt , it interprets it as the texture coordinates of a vertex. ◼ If the line starts with vn , it interprets it as the coordinates normal to a vertex. ◼ If the line starts with f , it interprets it as the index of the vertices that form a primitive (triangle in the case of the present project). Later , it saves all the data in an array called interleaved array, which is nothing more than a vector with all t he information ordered in a certain way that must be communicated to OpenGL. It is with this array that the displaylist containing the model is finally created. It can be seen, therefore, that loading a model only consists of loading vertices with their at tributes, saving them in an organized way and communicating the order to OpenGL. 3.3.3. CLASSES & SHADERS ◼ Non - executable classes: - WavefrontObjectLoader.java → It loads the object.obj file into an OpenGL displaylist that can be called at any time afterwards. It accepts only triangulated models. - WavefrontObjectLoader2.java → It does exactly the same than the previous class, but it accepts models made out of quads and polygons too. ◼ Executable classes: - ModelLoaderDefaul t.java → It opens a window and draws the loaded model in it. The mouse/keyboard interaction for rotating the model is enabled. Code: GRIAL - NT - 002 - GMV Date: 10/09/2021 Version: 1.0 Page: 14 of 30 Grial © GMV 2021 , all rights reserved Validation and test programs for the OpenGL ligh t curves simulator 3.3.4. CONCLUSIONS The implementation of a class that is capable of loading a model is considered a success. Furthermore, as a function that saves the model directly in a displaylist has been created , only 2 lines are needed to paint the model: one to load it into the displaylist and another to paint it. The only defect is that it only accepts one format ( .obj ), which is not a problem sinc e this is one of the most standard formats in the industry and the one that GMV uses. In addition, there are methods and programs to change from one format to another, which makes the model reader capable of reading any model in practice. 3.4. GRIAL_CONFIGURATI ON 3.4.1. PURPOSE The main goal of this project was to learn how to use the apache.commons.cli package, but there were other objectives as well: ◼ Implement the apache.commons.cli package in order to be able to run the program and pass the inputs/outputs as arguments through the command line. ◼ Organize the c ode of the main class: c reate a class with static methods in order to access them from the main class and be able to reduce the amount of code in it, making it more readable and understandable. ◼ Implement the class that loads the geometric models in the program. 3.4.2. BEHAVIO R The program consists of 1 executable clas s and 6