-
Notifications
You must be signed in to change notification settings - Fork 14
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
Strange behaviour with shaders #19
Comments
Hey there! I suspect this is because materials apply to TileMapDual itself. But during execution TileMapDual hides itself, and what we see is TileMapDual.display_tilemap, which is essentially a displaced TileMapLayer with a copy of TileMapDual's tile_set. I have uploaded a quick fix as tag v4.0.2-dev1. You can see there that it applies an exported material to display_tilemap in the _set_display_tilemap() function (line 120 of addons/TileMapDual/TileMapDual.gd). Please test it and check if it works for you. Unfortunately my experience in shaders is none at all. If you have any other suggestion, I am all ears. Cheers! |
Thank you for the quick turnaround! :) It fixed the issue, at least in runtime, which works well enough for me. See image:
What I did:
Hopefully you can get it to work in the editor later, but for now I'm perfectly happy. Thank you! Happy new year! You can close this issue if you feel satisfied with it only being in runtime |
Great! Please let me know how does the last commit work for you. If it works properly, I will probably delete the exported variables, so that shaders can be used as usual. Cheers! |
What do you mean? I might be a little confused :o My shader only works when using the exported variable at the moment (even with the current main branch from just 5 min ago). Setting the material in the usual material slot for the node doesn't work, nor does using the tilemap select :( |
With the changes on the main branch, it is at least no longer necessary to set I also noticed that having # ...
# Make TileMapDual invisible without disabling it
#if not self.material: # Let's remove the IF to try to solve #19
###self.material = null # Apply comment HERE, line 125
self.self_modulate.a = 0.0
# Add the display TileMapLayer
# ... |
First of all, happy new year! Please let me know if the last commit works for you. I removed the exported variables, but in return the display tilemap should inherit all properties from DualTileMap directly, except for the alpha and the position of the tileset. Cheers! |
Happy new year :) Thank you. I'll take a look tonight I think :) |
…ate = null. Cleanup of old comments This should fix the issue in a minimal way. Hopefully it does not break other functionality.
Actually, this creates a new bug, where the material is unset after closing Godot. I'll try to see if there are other ways to prevent the rendering |
I have now attempted to address the new bug I ended up introducing. Read the PR for more details :) |
…ial = null. Cleanup of old comments This should fix the issue in a minimal way. Hopefully it does not break other functionality.
…to match new changes
Possible fix reimplementation for #19, by setting self.material = null
likely reintroduced in v5.0.0-dev: 289536a I'm going to try and reproduce the issue first on my end before doing anything else though. If the problem was in fact reintroduced, then we'd have to copy all relevant properties of the parent TileMapDual just like before. |
Everywhere I go, it haunts me No, but just let me know if you need me to give any input 😅 |
I would expect that copypasting the previous implementation of an exported material should work. Sadly my laptop is still under maintenance, this is getting annoying at this point :/ |
Hello! Love this project, great work :)
I have been trying to use jess::codes overlay shader on TileMapDual, but I've been struggling to make it work properly. Their shader works perfectly on everything but TileMapDual, and over the past couple weeks (when I've had time), I've been trying to make it work on TileMapDual without success.
When the shader is applied, it paints the entire tile even where transparent. I have tested it, and even if you simply just set the color to be whatever it sampled, it somehow manages to paint colors that aren't there. In the screenshot below, the mask color is a shade of gray. There should be transparency on certain pixels (compare with non-shaded texture).
Same area without shader applied:
Another example
Such is the case with any texture and any mask colors. The overlay in question is 128 x 128, and the tile size for the tilemap is 32 x 32 (128 x 128 for the whole tileset).
Unfortunately, I lack the shader knowledge required to fully understand why it is the way it is, so I figured I'd open an issue and see if there's a known workaround, or if this is related to another issue. The effect reminds me slightly of #11.
My shader is slightly modified, mainly to test things out. It has been slightly expanded from the jess::codes example, to allow for arbitrary filtering colors.
Using Godot 4.3 Mono, on Arch Linux.
Minimal test setup:
Material
to "new ShaderMaterial" -> create "new Shader" -> Edit -> Paste code from aboveI apologize if this is a noob question / issue, and if it is unrelated to this project :o
The reason I believe it to be relevant is that the shader works just fine on any other node I've tried.
The text was updated successfully, but these errors were encountered: