Thanks Will continue and currently working on the next features (this time the focus is helping modders).
Schmackbolzen
Posts
-
-
Regarding the SVN problem: My suggestion is to start the SVN server, check each repo out with git SVN brigde (e.g. Tortoisegit has it integrated right into the clone dialog) and then upload it as a git repo. You can have the full history from SVN this way. You just need to do this correctly. I have some SVN repos checked out as git repo just before it got shut down this way. But not all of them.
-
I finished beta 2.1: Download beta 2.1
The focus was mainly rendering bugs / improvements.
Changes are:- Fixed rendering bugs with old lighting (affects also starspheres etc.)
- Made old lighting very similar to FL lighting (including cubemaps)
- Had a nice idea for nebula ambient lighting. It now is complete PBR lighting
- Added option to enable point lights for new lighting. Make sure to remove e.g fake planet reflection point lights from FL system inis before enabling it (will look weird, since planets are like suns then). To enable it, set EnablePointLights=1 in config.cfg.
-
I updated the documentation thread with instructions how to fix problems with DPI scaling.
Also I forgot to mention which format the normal/rougness/metalness maps use. This is also in the documentation now. -
I had the explosion lights working before. The thing is FL likes to fake lighting stuff with vertex colors - so I do not want to answer that right now without further testing.
Edit: I tested it and explosion lights work again after enabling point lights. So I suggest you just test the next version I will release (should be in the next weeks).
-
To make this more clear I added it to the known issues list.
I disabled the point lights because vanilla FL uses them in many systems for fake planet ambient light reflections, which look weird without shadows. Also if those lights have shadows enabled they are too close to objects and the shadows break.I will add a developer menu soon where you will be able to enable them. But if you donât change the system inis lighting will be weird then at those places.
I never tested spot lights, so I will have to enable them and see if it works. They will for now not have shadows, though. If they work I will enable them by default.
I will add some other useful stuff to this menu, like reloading all textures (only in FLARDATA\textures), reloading the materials.json, reloading shaders and I also think about adding adoxaâs hook for reloading the system in case it also reloads the models (not tested yet). This should really help for live testing stuff.
Also as I already wrote in discord chat to @HeIIoween, you should not reduce metalness too much if the material is metal. I just write it here again so that people do not get bad advice. You can see here, what happens if you do that (it behaves more like e.g. plastic or ceramic).
I also added some more PBR links to the documentation (more to come).
-
The default settings in materials.json are more a rough orientation. They are used in our mod, where I have proper roughness and normal maps.
Note that I released the beta also so that people can understand better how PBR works. You will have to adapt your mod if you want to use it.
Also what you disabled there is the tonemapping, which just caps the maximum light value to 1. It is not a fix.
There will be another factor you can change soon: It is the exposure value, which already is used and currently set to a fixed value. I did not add this on purpose yet, because I am afraid people will use it wrong.
The idea is that you can change it in the config, or that I allow a value to be set per system. I also will experiment with automatic exposure control later. -
For PBR rendering this also depends on your light source. With old lighting, the light intensity was in range from 0-1. With PBR you can have 0-infinite (or rather max float, due to hardware limitations). This is why I added tonemapping. It makes it look more like film (yes, analog film) would behave. I will try to explain this later in more detail in my documentation.
In short if you donât want to have it so bright:
- Change roughness of material
- Reduce light color intensity of light source or reduce its range
Note that the viewing angle also plays a role.
-
Yes, if a constant value is not enough, then you need to craft special roughness/metalness maps. Otherwise just create a new entry in materials.json or use an existing one which is working for that.
Since a lot people asked about that (especially custom planet textures) I added some text about it to my release post.
@NeoTendar: Thanks! Yeah you can leave them empty if you do not need any text.
-
That is good to know! Can you give me the name of the plugin with the keymapping problems? Maybe I can fix the issue. It probably is one from adoxa, right?
@IrateRedKite: Thanks! I am very happy myself that it works so easily. Was expecting it to be more difficult. Also watching videos from others using it is very interesting. Very curios what people will do with the renderer.
-
Thanks I really hope so!
Regarding point 1:
It might actually be a good idea to link here. I will think about it. But currently it is up to you
As for point 2:
I added some more things I forgot to my original post. That includes instructions how to get the menu of the renderer open. Also I mentioned that the 1.1 patch is necessary. Do you have it installed? Plus I never tested whether SP works. Will do that later. -
Here is the promised version for everyone to test: Download beta 2
Update: Beta 2.1 is here: Download beta 2.1
Changes are in my post below.Screenshots what it does can be seen here: https://the-starport.com/forums/post/65081 (or if you want to know how it started read from the beginning)
You will need the 1.1 patch installed (including server.dll) as the renderer loads it (might change later on).
For showing the renderer menu you need to add this entry to your keymap.ini in DATA\INTERFACE\
[KeyCmd] nickname = USER_RESET ids_name = your id (add entry in your resource dll) ids_info = your id (add second entry in your resource dll) state = keydown
and pretty far down in section
[KeyMap] nickname = IDR_ALWAYS_PRESENT
you also need to add
key = USER_RESET
Also add this to your keylist.ini (same folder)
[key] id = USER_RESET
The group under which you insert it decides the page on which it appears. Also the order matters here. E.g. if you put it right under group 0 it will be on top on the first page.
Then you can choose a key for opening it in the controls menu of Freelancer.
For converting your models if you want to use normal maps etc. I uploaded a modified UTF editor (including source) here: https://github.com/Schmackbolzen/UTFEditor. You need to add Tangent/Binormal data to a model (there is a button) or use the mass processing in the Tools menu (last menu item). I also added a tool to scan your models for errors (the menu item above).
Important: Do not add Tangent/Binormal data to asteroids/mines etc. (ASTEROIDS\MODELS folder). It will crash FL. For them this data is automatically calculated by the renderer when loading the models.
I have written some documentation here: https://the-starport.com/forums/topic/6276/advanced-renderer-documentation-question-answer-thread
Other tools (with source) e.g. for mass converting textures etc. will follow. I did not have the time yet.
I also will add to the documentation later what I used to upscale the textures. A good starting point is https://github.com/ptrsuder/IEU.Winforms and https://github.com/JingyunLiang/SwinIR.
Feedback is highly appreciated! You can also write found bugs here.
Looking forward to some nice screenshots / videos!
P.S.:
You will probably have to adapt your light sources in the system ini files. Range and color play a role for the new lighting. You also can have color values larger that 255 if you want very bright light sources (original FL does not allow that).
Note also that point lights are ignored for now. Only directional lights work (and will be converted internally to point lights).The default materials is metal. This means If you have custom planet/atmosphere textures those planets appear metallic . You have to add those textures to the materials.json (I already added the default ones there at the first entry). Same applies to any other texture you donât want to be metal. If you have mixed materials where a constant value is not enough, then you have to create special metalness/roughness maps. More details are in my documentation thread. Also for bases this might not work yet (FL uses different rendering for most geometry there).
Also Freelancer has this weird bug that on some pcs it detects the maximum texture size as very small resulting in every texture being really blurred. In this you case you should use my offset hack here: https://the-starport.com/wiki/fl-binaries/limit-breaking/visibility offset 01AD6F in Freelancer.exe.
Known issues:
- Planets outside the light range of a light source can have bugged lighting
- Planet rings can have artifacts looking like gaps
- Light sources too close to objects can bug out the shadows
- Planets and static asteroids currently do not cast shadows (dynamic ones do)
- Planets currently do not occlude sun for light scattering
- I never tested single player (will come next), but seems to work
- There seem to be some weird shadow bugs in Vanilla FL sometimes (e.g. Starflier shadow on itself if you fly it)
- Currently only directional light sources (in system inis) are enabled. They are being converted to points lights internally. The rest will follow soon. This means spot and point lights in space do not work for now.
- Environment reflections in nebulas do not look as good as the ambient light is uniform
- I did not do much for bases yet (meaning when you are docked)
- Custom envmaps (e.g. for nomads) are currently not being used
- Some nomads ships do not use new shading yet
- (Stuff I forgot and will add later )
-
This text refers to my OpenGL renderer (https://the-starport.com/forums/post/65081). You can try it out yourself with our mod: http://www.flnu.net/
The text is a work in progress, so more will probably be added from time to time. Feel free to ask questions. Comments are also welcome
General questions
Will the renderer be usable for everyone / can I use it in my mod?
Can I make changes to the shaders?
Will you release all the tools you wrote?
Why did it take so long?
What DirectX Version does Freelancer originally use?
What does OpenGL 3.3 mean?
What exactly does PBR renderer mean?Technical background questions
What exactly does the renderer change?
What optimizations did you add?
Why did you chose OpenGL and not Direct3D?
Will there be Vulkan support?
How much reverse engineering did you have to do?Documentation for the renderer
Storing of the additional model data
Location of the additional texture maps
Supported kinds of texture maps
Unique texture names
Generation of the self shadowing normal maps
Material system
Format of normal/roughness/metalness maps
Changes needed to make DPI scaling workGeneral questions
Will the renderer be usable for everyone / can I use it in my mod?
If your mod does not use any stolen assets (meaning you have permission to use any of the 3D models / textures etc. and the authors are also mentioned in the credits of your mod) then yes, you are free to use my renderer in your mod. You just have to mention me in the credits (and also tolerate the small text overlay displaying the renderer version on game startup). Exact details are in the top section of the supplied âFLAR licenses.txtâ file along with the renderer.Can I make changes to the shaders?
Yes, you are free to do so under the following constraint: You must write in the top section and as comment in the code of each shader file you modified what you did change and that you are the author. If you implemented a technique from a paper / other author you have to mention it / the author and where you got it from. Exact details for this are in the top comment section of each shader file.
The graphics development scene from game development is very open and has a scientific approach of doing it (meaning many papers and presentations including citations). I fully support this approach and wrote down any source / paper I used including the author.Will you release all the tools you wrote?
Yes, I will release all the tools I wrote/modified (including the source code under GPL3 license). This includes tools for generating the additional textures, converting a mod to only have unique texture names, the modified UTF editor for recalculating normals and adding tangent space data to models.Why did it take so long?
I developed it during my spare time and when I was in the mood. This is basically a hobby of mine and was (mostly) a lot of fun. Developing it was not only just the graphics, but also solving the problems of how to convert an old renderer to a modern physical based render (e.g. it has to be gamma correct). This also included writing an algorithm for recalculating the 3D model normals (not ideally solved currently), modifying the TBN data calculation for models, upscaling the textures so they are not so pixelated and automatically generating additional texture maps, so that it looks at least good, while not being completely correct. I have a background in image processing (besides 3D rendering), so this helped a lot.
On top of that there is no source code of Freelancer, so I had to reverse engineer a lot of stuff. I tried to keep it at a minimum, because this always costs the most time. But still this caused a lot of slowdown.
More details about reverse engineering are in the âHow much reverse engineering did you have to do?â section.What DirectX Version does Freelancer originally use?
Freelancer originally uses DirectX 8.0.What does OpenGL 3.3 mean?
Think of it like Direct3D 10 (which is the rendering API of DirectX 10), but open and not owned by anyone. Thus also Mac OS and Linux support it. For phones there is OpenGL ES, which is a cut down version.What exactly does PBR renderer mean?
For reference: The renderer uses the metalness workflow.
Here are some a nice explanations:
https://marmoset.co/posts/physically-based-rendering-and-you-can-too/
https://marmoset.co/posts/pbr-texture-conversion/
https://www.a23d.co/blog/different-maps-in-pbr-textures/Technical background questions
What exactly does the renderer change?
The renderer is a full PBR renderer, meaning it can use modern 3D models with all the additional texture maps. The formulas used for lighting are what modern games use. Additionally it adds shadows to the game and also post processing effects like tone mapping and light scattering. The background (currently the starsphere) also is used for the ambient lighting and the roughness of the material directly influences its sharpness (you can create e.g. a perfect mirror).
For each frame all render calls are being stored, newly sorted and then rendered. This allows for fixing transparency bugs (e.g. the nomads now are being rendered correctly), use instancing as optimization and also render the scene multiple time for special effects like light scattering.
Also if this is not necessary (e.g. when docked) just directly rendering without saving (translated to OpenGL) is being done.What optimizations did you add?
Basically the complete pipeline is a modern rendering pipeline now. Where it is possible instancing is being used. The renderer also has an own state tracker which reduces unnecessary state switches for the graphics card. All the render calls are being sorted by texture usage so that unnecessary texture switches are avoided. Transparent objects are rendered at the end, fixing some weird transparency bugs from the original game. There also is an added vertex and index buffer cache, since Freelancer likes to unnecessarily render geometry without using a constant buffer on the graphics card.Why did you chose OpenGL and not Direct3D?
Basically OpenGL makes it easier to run on other operating systems like Linux and Mac OS. Plus I can dynamically use extensions if the hardware supports it. In DirectX terms this means I am not bound to just use Direct3D 10, but also features from Direct3D 11. In fact I already am doing this for optimizations. While the renderer uses OpenGL 3.3 (which means the same hardware features as Direct3D 10) if the hardware supports it features from Direct3D 11 are used.
Another plus is that a transition to Vulkan is not as difficult which also makes it easer for running it on other operating systems besides Windows. Vulkan would allow to include ray tracing support.Will there be Vulkan support?
This is another advantage of using OpenGL. Internally most of the renderer is already similar written to modern pipelines, and the shaders are nearly the same, so a transition would not be as difficult. Whether I will do it depends on many factors (e.g. how many mods/players use it etc.).
Vulkan would allow to include ray tracing support.How much reverse engineering did you have to do?
Since adoxa had not done any graphics rendering, there was not much to start with. FriendlyFire asked him back then, but he only could give us one function. This was at least a good starting point. FriendlyFire and me also exchanged some code, but since the Freeworlds renderer works a lot different than mine, there was not so much overlap.
For supporting shadows, you have to track all the objects in the game and know their geometry. This also means you have to know when they are being destroyed (meaning memory has been freed). This is not as easy as it sounds.
For the additional texture maps you have to know which textures are currently being used.
Also to render objects correctly (select the right shader etc.), you have to know which object is currently being rendered (3DB, CMP etc.).
I have reversed lot of the materials (sadly each type is an own class) and know which one is currently being used, but I had not the time to reverse all of them, so this is not implemented currently.
Dynamic asteroids are directly read from memory and rendered by me (not by the game). This allows instancing (meaning only one draw call and not one for each asteroid like originally). Reversing static asteroids is on my list and are hopefully similarly implemented in Freelancer. Since I save the render calls at least instancing is used here, too (but it costs more CPU time due to the overhead).
There still was a lot other stuff which was needed and I might add here later on.Documentation for the renderer
Storing of the additional model data
For some of the additional texture maps you need to do all the computation in tangent space. For this not only normal, but also binormal and tangent vectors are needed. This is documented very well, so I wonât explain it any further here. I use the same format as the UTF Editor already supports (additional texture coordinates), with the exception that I save one additional vector with 4 components instead two additional vectors with 3 components. You can calculate the binormal vector just with the cross product of tangent and normal vector in the shader. You just have to store the orientation of the binormal vector, meaning whether it is flipped or not. For this the tangent vector gets one addition component (the 4.) which stores either 1 or -1. This technique is also very well documented and nothing new. It is more graphics card friendly, meaning it is faster, despite doing more computations. This is because for graphics cards memory accesses are slower than computing a value (unless the computation is very slow, which is not the case here).
I will release a modified UTF editor (with source) which is able to generate the additional vector and also contains my normal vector recalculation algorithm (more on that later).Supported kinds of texture maps
In addition to the original textures Freelancer supports, currently supported are: Normal, height, roughness and metalness maps. If there is demand for more they can easily be added. The height maps are used for parallax occlusion mapping with offset limiting. Also they act as a base for the ssbump normal maps (see âGeneration of the self shadowing normal mapsâ).Location of additional texture maps
Additional texture maps (like normal maps) are loaded according to the name of the base texture. Meaning they have to have the same name as the texture they are made to be used with. The type of texture map is determined by the folder they are placed in. E.g. normals maps are located at âFLARDATA\Textures\Normalmapsâ. The names of all folders are:
⢠OverrideTextures
⢠NormalMaps
⢠RoughnesMaps
⢠MetalnessMaps
⢠HeightMaps
Textures located in OverrideTextures folder will be loaded instead of the one in a .mat, .txm etc. file. The other names are self explanatory.
The renderer can load lz4 compressed dds texture files, but also directly load dds textures. It will prefer lz4 and if that is not found it will look for the dds file. For compressing / decompressing lz4 files you can use e.g. https://github.com/mcmilk/7-Zip-zstd.Unique texture names
Since additional texture maps are loaded according to the name of the base texture, this means that each texture in the game has to have a unique name. I developed tools for making sure of this, but it still takes some effort to convert a mod.
There might be a better solution in the future. This was the fastest solution to implement and also has the plus side that textures can easily be reused.
For our mod I wrote a tool which replaced all the textures in the .mat files with 1x1 pixel textures and I just use the one from the override folder. Overall this saved a lot of disk space and also you easily notice if textures are duplicated / have the wrong name. The workaround with the 1x1 pixel textures is not ideal, but for the time being other features were more important.Generation of the self shadowing normal maps
The self shadow normal maps are based on Valveâs ssbump paper (Efficient self-shadowed radiosity normal mapping, DOI: https://doi.org/10.1145/1281500.1281664) and a forum post I found with nice c++ code (https://www.gamedev.net/forums/topic.asp?topic_id=557465) which applies this to tangent space normal maps. They work really well in Freelancer. I cleaned up the code, added png texture loading and also made it multi threaded. Of course I will release it.Material system
Note that the material system currently is more of a temporal solution and might be improved later on. You can store additional information about a material (currently based on the texture name or multiple texture names) in the materials.json file located in the FLARDATA directory. You can specify constant values for metalness and roughness (textures will override this). If you want to modify the roughness value of a texture you can use âRoughnessTextureBiasâ, which will be added in the shader (you can use negative values). Note that the final values in the shader are clamped between 0 and 1.
The âAlphaTestValueâ property is used for shadows and allows to have transparency enabled for textures. As the name suggest this is only an alpha test currently (so only full transparent or opaque).Format of normal/roughness/metalness maps
The normal map is stored as ati2n dds, whereas the other maps use ati1n dds.
Make sure that the normal map is properly normalized (not all tools do that before converting).Changes needed to make DPI scaling work
You need to add a manifest entry to your Freelancer.exe. The content is:<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> <asmv3:application> <asmv3:windowsSettings> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware> <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness> </asmv3:windowsSettings> </asmv3:application> </assembly>
-
Thank you guys for all the hard work moving this site!
I already wrote Laz some early feedback. More to come!
For those like me who did not see it, since it only is in the blog post: You need to reset your password. Otherwise you wonât be able to login. Maybe Laz should mention that in the post here, too?
-
I wanted to give you guys a quick update after my last post. I still am working on the renderer and have fixed many bugs (mostly visible rendering issues) since the public beta release. Also there has been a lot of optimization work and I am currently working on some more optimizations for the shadow calculation/rendering. After that the list of remaining bugs is very small (and are minor ones). It should be out of beta once the last ones are fixed. Then I hopefully can start working on releasing the tools so that everyone can use it.
One recent change is the improvement of the light scattering. Now it knows where the suns are and only is enabled for them (before that it only used the first light source (not sun!) in the system). Also you now can have up to 8 suns with light scattering in one scene (the maximum limit actually is currently arbitrary set from me). You can reduce the maximum number in the settings window of the renderer (e.g. if you have a slower graphics card).
If no sun is visible light scattering is disabled now (before it was always on when in an asteroid field or nebula).Example screenshot of 3 suns with light scattering:
One bug that has given me trouble for a very long time is some weird memory behaviour. After some time the renderer just could not reserve any more memory resulting in missing textures and crash of Freelancer shortly after. On some PCs this even was after 15 minutes when switching between many systems (I finally was able to reproduce it after switching nonstop systems for about 45 minutes on my PC). For the technically inclined: Address Sanitizer using VS2022 (https://learn.microsoft.com/de-de/cpp/sanitizers/asan?view=msvc-170 and Visual Leak Detector using VS2017) do not find anything. Also lets just say I usually know how to avoid and also find memory leaks.
My current (also not so good solution) is to enable the Large Adress Aware flag for the Freelancer.exe. After I have had the registry setting âMEM_TOP_DOWNâ on for some weeks I can at least confirm that Freelancer has no problem with the flag (while the registry setting funnily broke some windows 7 control panel applications, meaning they are not large address aware). For now that solved it for our players (unless you play for lots of hours).
I suspect memory fragmentaion going on here, but that remains to be seen. I will come back to this later and it also might have disappeared by then due to my optimization work and code cleanup process.
I was planning for some time now to post some sort of FAQ thread where I explain what the renderer can do and what you need to do to convert your mod, but (as always) I did not have the time to do that, yet.
-
Thanks! Give me some time to get the tools I wrote in shape so that I can upload the source code and binary files. Also I will explain to everyone how to use the new renderer in your mod. The latter will be some effort, though.
-
Thanks! I also am more than happy with the look. Now it mostly depends on the models and textures.
You can try the out the renderer yourself now! We are currently running a public beta test of our mod with the new renderer. The screens you see in the news post have some tweaked material settings and I also found some bugs during our initial testing which are fixed now.
@Traversal: The backgrounds are currently from âFreelancer: HD Editionâ mod. What do you mean with âWill it require vanilla or also work in HD?â?
Here is a video from one member of our server team: https://www.youtube.com/watch?v=3H1NDFXbw8w
Some new screenshots with current version:
-
Glad I could help And yes, those were good times!
-
Hi,
I still have old versions of our mod laying around. In 1.6 we had https://www.newgrounds.com/audio/listen/122039 as the music in unicon. Is that the track you were looking for?
P.S.: Glad there are still players of our mod around - Soon with a new renderer
-
Thanks and likewise!
I actually have been pretty busy and used most of the free time to work on the renderer. Also we mostly write in discord nowadays. Turned out Swinir is really good for planets as you can see in the screenshots below.
I currently am testing with a very small group of players. I am fixing the last crashes and some more severe rendering issues. So far it mostly runs on other hardware than mine. The goal is to launch the public beta of the mod including the new renderer in the next 1-2 weeks! Expect some more screenshots and videos for the announcement (this time not done by me).
Here are some screenshots of the version we are currently testing:
Release: Advanced Renderer public beta 2.1
TSP Community To-Do List
Release: Advanced Renderer public beta 2.1
Release: Advanced Renderer public beta 2.1
Release: Advanced Renderer public beta 2.1
Release: Advanced Renderer public beta 2.1
Release: Advanced Renderer public beta 2.1
Release: Advanced Renderer public beta 2.1
Release: Advanced Renderer public beta 2.1
Release: Advanced Renderer public beta 2.1
Release: Advanced Renderer public beta 2.1
Release: Advanced Renderer public beta 2.1
Advanced Renderer Documentation / Question - Answer thread
The Starport Has Moved!
New Renderer (OpenGL 3.3)
New Renderer (OpenGL 3.3)
New Renderer (OpenGL 3.3)
Looking for a specific soundtrack from a mod
Looking for a specific soundtrack from a mod
New Renderer (OpenGL 3.3)