GarageGames / Torque3D Public
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
3 textures blending fix #710
3 textures blending fix #710
Conversation
|
Looks sweet. Haven't reviewed the code yet. Not sure how my commit snuck its way into your branch. Maybe basing off an old head? The build status icon was reverted a while ago. EDIT: Hmm. On a cursory glance there are a lot of whitespace changes... |
|
Is it the whitespaces again? Dammit! My IDE wants to be smart and does that stuff on its own :( I'll be removing stupid commits and whitespaces again.. sigh |
|
Cheers! Yeah I wanted to ignore all that because I prefer your whitespace settings to the existing format, but it made it very difficult to actually check the PR since most lines were touched :P. |
|
Summary of IRC discussion: This fix is specific to 3 textures, if we ever had 4 textures blending at once we'd still have trouble. I personally would be interested in seeing a general solution. @lukaspj agreed to look into it. |
|
@eightyeight To be fair I actually never answered you... I kind of ignored you.. To no avail it seems.. ;) Fixed it now though! Generalized and might work for more textures. |
|
Oh, I thought you said you would do it! Maybe I'm psychic. EDIT: I quote:
Anyway, if it's proven to work for 3 textures, then it's at least as good as the previous non-generic fix! |
|
Nah you just read my thoughts silly! |
|
Making a small change to this stand by.. |
|
Doing another fix, an unforeseen case where detailBlend < 0 gives some weird issues, this change should give the best blending possible :P |
|
should also note, needed to default that detailBlend%d to something in order to prevent crashes this end when porting it on over for cases where detailCount = 0. |
…ed_shading up to andr3wmac@8505413#diff-d41d8cd98f00b204e9800998ecf8427e , development head up to GarageGames@84ebe88#diff-d41d8cd98f00b204e9800998ecf8427e , included PR variants for: GarageGames#723 GarageGames#737 GarageGames#721 GarageGames#722 GarageGames#710 GarageGames#703, and https://github.com/Azaezel/Torque3D/tree/tsstatic_DynamicCubemaps
|
This PR has a major issue, as I misunderstood how the terrain renders the materials.. Basically I think I'll need change how the blending values are calculated because there are issues when several different shaders are run over the same pixel because it introduces loss of information.. |
ff8623e
to
7f475fb
Compare
|
Looks fantastic! |
d3018f0
to
4659d67
Compare
…ageGames#710 b) linear gamma correction courtesy of @andr3wmac
4659d67
to
53f2419
Compare
|
Worth noting, this PR also fixes the ´visual result of the terrain textures, because you get the expected results instead of the previous. Tl;DR textures generally look better: BeforeAfter |
|
@eightyeight that issue dissappear is you paint something on the terrain right? |
|
Yep, forgot to mention that :P. |
|
Hmm that shouldn't happen, though I recognize the issue.. I'll look into it. |
|
@RichardsGameStudio great to know you're merging changes from development into your game - it's really helpful to get tests/reports like this! I'll see if I can reproduce what you're seeing. |
|
You're welcome. |
|
@RichardsGameStudio could you upload the basetexture generated? It should be next to the terrain file. |
|
I think I found the issue. Seems like it would only apply to textures rendered in the same batch. OUT.col = lerp( OUT.col, baseColor + detailColor, detailBlend1 );Should be this OUT.col += detailColor * detailBlend1;In the generated shaders I believe. Seems like it fixes the issue on my end. |
|
@RichardsGameStudio could you test the change at #920 ? Then you'd make me a happy developer :P |
|
I have tried the changes you suggested, but I am sorry to say that the issue still exists. In any case the basetex file is included with this email Thanks |
|
Have you made sure to delete the basetex file before testing it? To ensure it gets generated again. |
|
I didn't, but now I have, still having the same issue. |
|
Okay, my next guess is trying to clean the shaders and see if that works. I replicated the issue on my end and fixed it.. Can't figure out how to replicate it after that fix. |
|
After cleaning the shaders still no improvement. Are you using the D3D9 refactor? Otherwise it' might be a hardware issue? |
|
No I pulled it straight out of the development branch. Hmm.. What about the generated shaders? Just every terrain)related shader, could you send that to me somehow? |
|
@RichardsGameStudio can you reproduce this in the development branch, or would it be too much effort to test it? |
|
I believe that to reproduce this, you have to use MacroTextures.. But it's all pretty weird and fuzzy. @RichardsGameStudio do you use macrotextures? And what happens if you turn macro off? |
|
@RichardsGameStudio It's been a while, but in case you are still available, could you have a look at #920? I just added a new commit with some new changes in it. I've not been able to reproduce the seams after those changes. |
|
@lukaspj Sorry for the late reaction, but it got into the pile of things I had to do and it was growing faster than I realized. I will try to find some time this weekend to test it. |
|
That'd be great :). @lukaspj would you be able to put all the terrain blending changes into a single branch for easier testing? Separate PRs was good to review each of them individually, but I've started to forget which order they happen in and which ones need to be merged :P. |
|
@lukaspj I've tried the suggested solution, deleted all the procedural shaders, deleted the basetex file, but still the same fuzzy borders. I am using terrainmaterials with all the maps set (diffuse, macro, detail and normal). |
|
@RichardsGameStudio I'd love to get a minimal working example, like if you could reproduce the effect in the empty terrain level and send the whole project to me! |
|
@lukaspj I'll see what I can do. The problem is that there are parts of the engine that I have modified which I can not make public, but as said I'll see what I can do for you. |
|
@RichardsGameStudio I don't need the actual source code.. Just like, a mission with a flat terrain and textures which can be used to reproduce the issue. I'd use the stock repo to test the mission anyway, as I only need to test the terrain rendering :) |








While working with the terrain blending, I found some artifacts when having more than 2 textures blended together.
Steve_Yorkshire in IRC confirmed that he had also seen the issue, so I dug into it and found that the textures aren't blended properly. This PR fixes specifically the blending between the 2nd and the third texture.
Image of the issue here:

With this PR it looks like this:
