-
Notifications
You must be signed in to change notification settings - Fork 60
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
Switch to "OpenGL" normalmap direction? #274
Comments
|
About the engine, the internal representation in glsl shaders can be switched to the OpenGL representation or any format we want from now. The issue is about the default format expected from a material described in a file stored as Maps from games using another way to describe materials, another material file naming scheme or another material file syntax would allow us to import their normal map the expected way whatever the internal format we choose and the format the use. This distinction is very important, because it means we can have an engine having an OpenGL-like internal normal representation, even if we expect our For other material DarkPlaces does not use The biggest issue I see is that other idTech 3 engines may use DirectX normal map format by default and they may use the same syntax we use… If that's true, it would be sad but we may have to accept they chose for us. I'm doing some investigations. Also, we have to consider the normal format conversion to be free. The GLSL code computes a normal scale even if there is no scaling applied (scaling factor of |
|
One important thing to know is that XreaL did huge efforts to read Doom3 assets, especially material files. Because of that, XreaL chose the Doom3 formats as default formats for many things, and basically idTech3 renderers are likely to mimic XreaL in their implementations, hence choosing what Doom3 chosen (spoilers: DirectX normal map format). |
|
One important reason about agreeing on formats is not only the ability to port data, it's to reduce work required to make compatible third party tools. Many games would not see any interest in reading other's file and may do choices they think they would be the only ones to have to assume them… It's not true. When some cool tool happens, everyone wants it, and everyone wants the same tool, so they wants the same tool to know all formats. That will is difficult to fulfill when people do not agree on formats and every ones reinvent the wheel. One good example of such third-party tool is https://github.com/SomaZ/Blender_BSP_Importer who just came to life days ago. This is a BSP level importer for Blender, with work in progress texturing support. This tool is a project by @SomaZ who is also working on OpenJK, so this tool supports OpenJK first then others games. By reducing differences between games we increase the possibility of being properly supported by such tools. That Blender BSP importer is a huge step towards lightmap baking in OpenCL engines like Cycles. This is awesome we know we can do that: Solarium Xonotic Map in Blender: Solarium Xonotic Map in Dæmon: Solarium Xonotic Map in DarkPlaces: Then, it would be good to avoid to introduce undecidable problems about format textures because we would use different format with same material syntax. Even without the need to port assets between engines or games we need to avoid that. |
|
So, that said, the issue is basically about the differences between:
Since maintained assets can be edited, there is nothing to mind about them, we can use whatever format, the assets would follow. The real question is about interoperability with other engines, and in that topic, the biggest concern would be interoperability on import. So, what we would take care about would be to make the best choices to load legacy unedited assets. So, I investigated some games. idTech1-based DarkPlaces-based games like XonoticDarkPlaces, so Xonotic, uses OpenGL normal map format. As DarkPlaces normal map loading is very different from our engine (it does not rely on Quake3 shaders but on filename suffix), it's very easy to implement an engine that would load the DP's filename-suffix-based normal map one way and the shader-based normal map another way. Our engine already reached that point. DarkPlaces so Xonotic is a kind of engine that uses another way to describe their materials than we do. So there is absolutely no issue to have different formats. DarkPlaces and Xonotic can use idTech3-like So, while it would be cool to support the same format internally, we don't have to. If a Xonotic game on Dæmon engine becomes a thing, legacy assets would be loaded the DarkPlaces way, with the proper format, and newer assets, hence maintained, can be converted, or use special keywords to switch format. Note: Xonotic uses IBSP46 for its official maps while DarkPlaces support other formats, I guess Quake 1 and Quake 2 formats but I've not checked. idTech2-based QFusion-based games like WarsowThere is no plan for any port, but it is one major game out there using Warsow uses OpenGL normal map format. Warsow also stores materials in They basically have a We can stick to DirectX format for the default format for normal map found the way we always did ( They also use Note: Warsow uses the FBSP1 format, which is very close to IBSP46 (major difference is that the internal lightmaps are larger). idTech2-based CRX-based games like AlienArenaAlienArena uses normal map OpenGL format. When the normal map suffix is Since it's an arena shooter game, and this genre is popular, it may be possible one day someone wants to port such maps to another game. What seems to look like an suffix for autodetection looks to be pretty unique, and the material files use an unique naming pattern and an unique wording pattern. An engine would be able to select the right normal map format very easily. Note: map format is IBSP38. idTech2-based Quetoo-based games like QuetooThe Quetoo game running on Quetoo engine uses the DirectX normal map format. The Materials are defined in files named like I've already seen Quetoo maps ported to Xonotic, which is not surprising since they are both arena shooters. Note: map format is IBSP69. idTech3-based games like World of PadmanQuake III Arena, Quake Live, Reaction, World of Padman, do not use normal maps at all. Note: those games usually uses IBSP46 while Quake Live uses IBSP47. Those formats are almost, if not, the same. Our engine supports both. idTech3-based games like Smokin' GunsSmokin' Guns does not use normal maps at all. In any way, if a port on Dæmon becomes a thing, they want to port the assets. So, there is nothing to care about. Note: map format is IBSP46. idTech3-based games like Bumpy UrbanTerrorClassic UrbanTerror did not used normal maps at all. The Bumpy version of it used DirectX normal map format. There is no material file describing them, they are loaded a bit like the DarkPlaces engine does, looking for files with given suffix. The suffix is Note that their heightmaps are embedded in normal map alpha channel and are a bit weird: they seem to define an elevation (black being the floor and white an elevation above the floor level) while parallax is usually implemented the other way (white being the floor and black being a lowering under the floor level). That Bumpy version was just a showcase I highly doubt it had been played on a large case, we don't have to take care that much about this. Urban Terror Resurgence will be an UT4 game, a complete move in all file format, we don't have to take care about that. Note: map format is IBSP46. idTech3-based games like RealRCTWReturn to Castle Wolfenstein, the WildWest mod etc. did not used normal maps at all. The RealRTCW project which improves the renderer and ships new textures seems to not ship any normal map at all. I don't know what's their plans. idTech4-based games like TheDarkModDoom 3, Quake 4, TheDarkMod use normal map DirectX format. They store materials in files named Those maps are not distributed the And even if Dæmon was able to load maps and materials the idTech4 way, that would not conflict with our own material language. They also use As we remember XreaL was attempting to use native idTech4 formats, our engine may be already able to partially parses idTech4's idTech3-based games like ET:LegacyWolfenstein: Enemy Territory did not used normal maps at all. ET:Legacy work in progress assets are using the DirectX normal map format. They have not released any normal map officially so they can still decide what normal map format to chose. Their assets are using the DirectX normal map format because their renderer was also based on ET:XreaL, like us. As material file naming and syntax, they used the exact same file naming and syntax we used in 0.51.1 and before. They seem interested to use the pre-collapsed stage syntax (see #216). So, it would be very bad if we do not agree with ET:Legacy on a normal map format as there would be no way to guess the normal map format. ET:Legacy renderer is based on XreaL like us. They are not against merging our renderer if it's possible. They haven't yet released any asset with normal map. So the best way to make sure there is no issue is to work together. idTech3-based OpenJK based games like Jedi KnightThey use almost the same shader format we introduced in master (pre-collapsed stage, see #216). We may have differences with them, but the normal map syntax is exactly the same. This is their syntax: This is our new syntax: And our engine supports also this (uncollapsed normal map): Which… is the same. Exactly the same format. If we don't use the same normal map format together, we are screwed: there would be no way to guess the normal map format only by reading the files. OpenJK games stores shaders in files named like Because that's one important thing to mind: even if the dæmon engine does not load assets from those listed games, we can imagine map editors, and other tools for artists that manage all or part of them, this making a requirement for a way to know what is what. |
|
So, to sum it up:
|
|
The status is: The Quake 3/Doom 3 material parser assumes DirectX normal map format if nothing else is said because of the huge legacy of XreaL and Doom 3 but anyone can use normal map in OpenGL format with the use of Most Unvanquished normal maps are known to use DirectX format, some having been designed for XreaL/Dæmon in mind, some may have been ported directly from texture packs targeting engines with DirectX convention like Unreal Engine, some others following the DirectX convention for unknown reasons. Some normal maps like the ones from the Vega texture set use custom format with appropriate material keyword being used (maybe that custom format was an export mistake). The Darkplaces compatibility layer of the Quake 3 material parser assumes OpenGL format because that's what does the DarkPlaces engine. As seen as a blackbox, the renderer considers that all per-channel factors being unset means Unlike The GLSL code itself is written the DirectX way for historical purpose and no one took the risk to modify it. Because the renderer as a blackbox assumes OpenGL if per-channels factors are set to |
|
This issue is about the internal engine representation, not the input format for shaders. |
|
Never mind, I think I confused this issue with something else. |
|
The thread started about internal representations but now all aspects if this problem have an answer and can be considered as “decided”. We would have to turn my previous comment into documentation written in the wiki. |
|
Someone can still pick the task to revert orientation in GLSL shader internal representation and validate the change if he wants. But for now, the engine can already feed the GLSL shader with normal map data using OpenGL orientation without needing to tell the GLSL shader to revert some channel. |



This is a thread to decide whether we should keep the default interpretation of normalmaps the way it is now (so-called DirectX style), or switch to OpenGL style, which interprets the y-axis (green channel) as pointing the opposite direction. Note that the direction chosen doesn't really have any relation to the rendering library you use - it's up to the GPU shader code to decide how to interpret things.
Advantages of switching to OpenGL direction:
Advantages of staying on DirectX:
The text was updated successfully, but these errors were encountered: