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
Terrain normalmapping #1847
Terrain normalmapping #1847
Conversation
This pull request introduces 2 alerts when merging 6b7b284 into 44631a1 - view on LGTM.com new alerts:
|
@amelentev This is a tremendous effort, and the result is amazing! 🥳 It looks like our traditional merge method of "Rebase and merge" is unavailable with the current commit history (likely the merge commits), and I'd hate to squash everything. I can try poking at rebasing / rewriting the commit history (and eliminating the merge commits) at some point if no one else gets to it first. EDIT: It does look like there might be an illumination bug with the old terrain rendering, as you noted on the YouTube video. But the new mode looks fantastic. |
Thanks Artem for crazy efforts here.
fix: I don't know how we are going to handle new textures. If we will use 1 pack of textures then this fix will work, If we will use old diffuse textures for classic mode then no need to multiply by 1.75. |
That was one of the things I was wondering. How far along are the new terrain textures? If we have replacements for everything, and they look fairly similar in "classic" mode, I don't see why we can't ship a single pack of textures. (Also, where is the latest set of new textures so I can test?) EDIT: Maybe we can make this classic diffuse parameter a uniform and then allow it to be provided by the set of textures, if we need to support more than 1 pack of textures... |
They don't look similar(and can't)... well, they look acceptable, I removed any shadows and highlights from them, so they look a bit unnatural without normal and specular maps. https://www.youtube.com/watch?v=69oiW1tm8qo
WIP
I'll upload them to my google drive, so everyone could give 'em a try. Also, for now I think we could use specular level = 0.1 instead of specular maps. They aren't needed everywhere, so I need to decide which of them we need to use. This will save a lot of space and video memory. Have tested the game on old GF GTS250 512mb and it works good only with 1024 textures option, not enough memory for 2048.
Or other texture packs should have adjusted brightness to look right. |
Hmmm. We may want to keep the prior textures around for "classic" terrain mode, then. We could always ship 1024x1024 versions of them as a compromise between file size and quality. If we do support different terrain texture packs for each quality level, then we probably want to restrict changing the terrain quality to the main menus (i.e. not during a game - even if we added support for loading+replacing textures on the fly this would likely cause a freeze for other players due to the "stop the world sync" in multiplayer games so shouldn't be permitted there).
Makes sense to me. (We also need to add support for uploading textures in a compressed format to the GPU, but that can come later.) |
You can create 1x1 pixel specular map for constant speculars. And it should take 1 pixel in video memory. Or you can create lower res *maps with bigger res textures. It will work for terrain and water textures, but not for decals because of texture atlas. Default decals specular = 0.1. About texturepacks. I think it can be just regular mods. And we can set terrainShaderQuality parameter/uniform from mod somehow. Or, just put shaders in the mod.. |
I'm less concerned about size and more about quality and ensuring all the necessary pieces are built-in. (We have already received complaints that the videos aren't bundled with all of the downloads and that an Internet connection is required during install to fetch them.) Given the current quirks with the mod system, it's probably best that we build it in (similar to the faction texture switching) based on the terrainShaderQuality mode. If classic is the "lower quality" option, I think we can easily reduce the size of the textures such that it's not an overwhelming portion of the distribution. (Classic could be shrunk to 1024x1024.) The new textures do look exceedingly flat / unnatural in places without the normal-mapping, so I think this'll produce the best compromise. Overall, though, I just want to reiterate how awesome this. 😎 |
6b7b284
to
e7fd995
Compare
@amelentev I've gone ahead and rebased this on current master (eliminating the merge commits) and force-pushed to your branch. (In case I made a mistake somewhere, I've backed up what was previously on this branch at https://github.com/past-due/warzone2100/tree/new_terrain_normals_backup_before_rebase1) (See suggestions here for how to reset your local branch to the remote force-pushed branch if you aren't familiar: https://stackoverflow.com/questions/9813816/git-pull-after-forced-update)
|
This pull request introduces 2 alerts when merging e7fd995 into de33e81 - view on LGTM.com new alerts:
|
e7fd995
to
281a711
Compare
This pull request introduces 2 alerts when merging 281a711 into 4eefd78 - view on LGTM.com new alerts:
|
281a711
to
20de4a2
Compare
This pull request introduces 2 alerts when merging 20de4a2 into 023229b - view on LGTM.com new alerts:
|
20de4a2
to
db6c492
Compare
This pull request introduces 2 alerts when merging db6c492 into 023229b - view on LGTM.com new alerts:
|
Composed all latest work as Past-due asked for https://drive.google.com/file/d/1cKRjLujumzo7x_SvBZ0BeIGHdm6cIdJ_/view?usp=sharing |
3b4eec8
to
a1dce8f
Compare
Force-pushed another rebase to fix a merge conflict. (Thanks for the terraindepth catch, @amelentev!) |
This pull request introduces 2 alerts when merging a1dce8f into f31c930 - view on LGTM.com new alerts:
|
a1dce8f
to
8ba4abe
Compare
This pull request introduces 2 alerts when merging 8ba4abe into 1fc08cd - view on LGTM.com new alerts:
|
Pre-final or even final one. I'm pretty happy with look of terrain textures but some decals like roads require too much time and probably complete redraw. Did only basic editing for most of the decals. EDIT: Final - I mean that it's ready to merge. Without parallax mapping at this state. Later, from time to time, I (or someone else) will update textures which I think can be enhanced. Also, as I understand we don't have a way to change texture quality right. As Past-due said, new textures should be packed into mod with its shaders and have a button in menu to swap through available options. Or use this textures by default and pack old textures into LQ mod. |
What else could be done to raise up quality is to move central vertex of each crater down a bit for all craters. At least for campaign... |
d6e5760
to
6b989a0
Compare
Here is an experimental terrainDecails.vert/.frag combined shader: Some details:
|
Looks exactly as I wanted and as was shawn in link you provided. Will look into it soon. Thanks! |
Awesome. 🥳
My understanding (and please correct me if I'm wrong) is that would mean bumping minimum requirements on the GL side to:
While OpenGL 3.0+ is probably doable, I'm a bit more concerned about bumping OpenGL ES from 2.0 to 3.0 as the minimum requirement at this point in time. (Main source of concern: libANGLE requires DirectX 11 to translate OpenGL ES 3.0, while only DirectX 9 is required for OpenGL ES 2.0. And we use libANGLE as a fallback on Windows when Windows OpenGL drivers aren't great, often with older hardware.) Also, we may not be able to bump above OpenGL ES 3.0 as a base minimum requirement at this time (because of libANGLE, again, but I believe OpenGL ES 3.0 has the 2d texture array support needed? @amelentev)
Theoretically we could then maintain compatibility with OpenGL 2.1 and OpenGL ES 2.0, and only offer the new terrain rendering if a system meets the minimum requirements. Just need a switch, and a bit of GL init-time detection to set a flag as to whether 2d texture arrays (and, thus, the new terrain rendering shaders) are available. That would basically solve the compatibility concerns. 👍
And obviously we need this too 😁, but overall this is very exciting (if we can just maintain that backwards compatibility). |
For unknown reasons it doesn't work on my system. Tried portable build 5921ec5. Win10, gtx1080ti, ogl |
@MaNGusT- it seems the issue is in |
About backward compatibility. I don't know much about OpenGL ES. |
* float(lambertTerm > 0) doesn't work and can't, tested it alot in wmit. |
Implemented
Now the shader blends everything (color, normal, gloss) of ground and decals. And bumpmapping is performed only once on resulted blended data: amelentev@de8c1cf |
Works good but we still can't split cliff decals from terrain decals to apply different blending. I have no idea how to implement this with current terrain engine. |
zip! tested on latest availble build(de8c1cf). Mostly reduced size of all textures and updated water.
|
actually it's darker, but now it reflects the light. May be we should set spec light to zero for terrain to exclude this "wet" effect. idk
Could |
I like the way snow looks. Very realistic snow on a sunny day. But on such bright ground it will be very difficult to play. |
update for terrain_all5.zip |
I understand what you are talking about, but currently I see no way to make them look good from each side. I mean that they look good on shaded side and bad on lightened. The best way to create and variate cliffs is using feature objects - example P.S. Well, I have only theoretical solution, but it's only shader related:
|
Also, there is bug with cliff decals. Some decals were rotated by map designer, in game this results that normal maps of these decals are also rotated what breaks lightning. |
A continuation and refactoring of PR Warzone2100#1847. - Adds optional support of normalmaps (_nm.png), specularmaps (_sm.png) and heightmaps (_hm.png) for terrain, decals(tiles) and water. - New config option "terrainShaderQuality" to control new rendering / shaders (also available in the Graphics Options menu). - Decals automipmap. Only highest available resolution decals (up to 512) are used. - New combined, single-pass shader that draws terrain + decals. Requires 2d texture array support + certain functionality that necessitates OpenGL 3.0+ or OpenGL ES 3.0+. - Previous shaders retained for compatibility with older systems (but lack the new terrain quality mode). Co-Authored-By: Artem Melentyev <57016+amelentev@users.noreply.github.com>
A continuation and refactoring of PR Warzone2100#1847. - Adds optional support of normalmaps (_nm.png), specularmaps (_sm.png) and heightmaps (_hm.png) for terrain, decals(tiles) and water. - New config option "terrainShaderQuality" to control new rendering / shaders (also available in the Graphics Options menu). - Decals automipmap. Only highest available resolution decals (up to 512) are used. - New combined, single-pass shader that draws terrain + decals. Requires 2d texture array support + certain functionality that necessitates OpenGL 3.0+ or OpenGL ES 3.0+. - Previous shaders retained for compatibility with older systems (but lack the new terrain quality mode). Co-Authored-By: Artem Melentyev <57016+amelentev@users.noreply.github.com>
A continuation and refactoring of PR Warzone2100#1847. - Adds optional support of normalmaps (_nm.png), specularmaps (_sm.png) and heightmaps (_hm.png) for terrain, decals(tiles) and water. - New config option "terrainShaderQuality" to control new rendering / shaders (also available in the Graphics Options menu). - Decals automipmap. Only highest available resolution decals (up to 512) are used. - New combined, single-pass shader that draws terrain + decals. Requires 2d texture array support + certain functionality that necessitates OpenGL 3.0+ or OpenGL ES 3.0+. - Previous shaders retained for compatibility with older systems (but lack the new terrain quality mode). Co-Authored-By: Artem Melentyev <57016+amelentev@users.noreply.github.com>
A continuation and refactoring of PR Warzone2100#1847. - Adds optional support of normalmaps (_nm.png), specularmaps (_sm.png) and heightmaps (_hm.png) for terrain, decals(tiles) and water. - New config option "terrainShaderQuality" to control new rendering / shaders (also available in the Graphics Options menu). - Decals automipmap. Only highest available resolution decals (up to 512) are used. - New combined, single-pass shader that draws terrain + decals. Requires 2d texture array support + certain functionality that necessitates OpenGL 3.0+ or OpenGL ES 3.0+. - Previous shaders retained for compatibility with older systems (but lack the new terrain quality mode). Co-Authored-By: Artem Melentyev <57016+amelentev@users.noreply.github.com>
A continuation and refactoring of PR Warzone2100#1847. - Adds optional support of normalmaps (_nm.png), specularmaps (_sm.png) and heightmaps (_hm.png) for terrain, decals(tiles) and water. - New config option "terrainShaderQuality" to control new rendering / shaders (also available in the Graphics Options menu). - Decals automipmap. Only highest available resolution decals (up to 512) are used. - New combined, single-pass shader that draws terrain + decals. Requires 2d texture array support + certain functionality that necessitates OpenGL 3.0+ or OpenGL ES 3.0+. - Previous shaders retained for compatibility with older systems (but lack the new terrain quality mode). Co-Authored-By: Artem Melentyev <57016+amelentev@users.noreply.github.com>
A continuation and refactoring of PR #1847. - Adds optional support of normalmaps (_nm.png), specularmaps (_sm.png) and heightmaps (_hm.png) for terrain, decals(tiles) and water. - New config option "terrainShaderQuality" to control new rendering / shaders (also available in the Graphics Options menu). - Decals automipmap. Only highest available resolution decals (up to 512) are used. - New combined, single-pass shader that draws terrain + decals. Requires 2d texture array support + certain functionality that necessitates OpenGL 3.0+ or OpenGL ES 3.0+. - Previous shaders retained for compatibility with older systems (but lack the new terrain quality mode). Co-Authored-By: Artem Melentyev <57016+amelentev@users.noreply.github.com>
Superseded by #3127, which has now been merged! 🥳 Huge thanks to @amelentev for all of this amazing work. |
This is continuation of #643
Demo with @MaNGusT-'s textures: https://www.youtube.com/watch?v=NjzMcK9Oqmk
Thanks @MaNGusT- for help.
in new rendering:
ambientLight*0.5
in shaders to compensate.There is a minor performance impact. Benchmarks:
Standard textures without optional maps. cam_1a, first alpha mission. resolution=4k, gpu=GF 1060 3G
tsq - this PR with specified terrainShaderQuality.
I got similar results on win10 (opengl worse, vk better).
Possible future work (out of scope of this PR):