-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Add NoiseTexture3D #4946
Add NoiseTexture3D #4946
Comments
See #2261 (comment). Note that in a lot of cases, using 2D noise to adjust fog density will look good enough. This is especially true since volumetric fog isn't designed to represent high-frequency detail. cc @clayjohn |
I think the best approach would be to create a NoiseTexture3D resource that has pretty much the same API as the current NoiseTexture2D. I believe the current Noise API is designed to make implementing this fairly straightforward. |
Exactly what i need |
Last year, I started working on adding a NoiseTexture3D resource, but I couldn't get it working: https://github.com/Calinou/godot/tree/add-noisetexture3d This was before the transition from OpenSimplexNoise to FastNoise, so the underlying code will have to change significantly. Feel free to look at that branch for inspiration nonetheless 🙂 |
I've stumbled upon a design decision and i don't know what would be a better approach for a godot resource. Would it be better to modify a "noise_texture" code or to make a modified copy for a 3D usage? |
NoiseTexture3D will need to be an entirely different class, as it's creating a different resource type (Texture3D instead of Texture2D). Feel free to copy-paste code if needed, still. |
I have a problem. It looks like noise as a whole need some precompiled(?) files because when i forked the main branch then downloaded it there wasn't dependencies of noise. On docs i haven't seen anything about this, maybe i missed something? |
All third-party libraries in Godot are included in the repository, and are compiled as part of its buildsystem. You don't need to manually download and compile third-party libraries before you can compile Godot itself. Can you paste the full error message here? |
Okay but i still don't have a needed files to even compile a unmodified noise or maybe they are created during compilation. |
Missclick. I will give it another try tommorow and if it wouldn't work i will send an error message. |
I don't have problems with compilation now, but i don't know what could be better: creating extra functions in noise.cpp or to use existing ones and just stack generated noise images. From what i have in my code you can confidently say that there is stacking images in code, but i think doing it with existing functions could make noise look sliced or maybe i don't understand something. |
Okay so 256x256x256 is making my pc cry for help |
A 256×256×256 Texture3D has the same amount of pixels as a 4096×4096 Texture2D, which is understandably quite demanding (especially when no VRAM compression is used). I'd suggest sticking to 64×64×64 in most cases (or maybe 128×64×128). |
I have a issues with maximum value of Vector3 (i use it as size) so i don't think i even can. I will try to remove this cap by using something else. |
@Lasuch69 Looks great! You can probably open a pull request now 🙂 |
No. It is stable BUT seamless creation isn't done (only in 2 dimensions) and i get a lot of errors with mipmapping and texture format. I also need to look into code a little bit more. |
Is mipmapping even useful in 3D textures? |
Yes it is. It is important both for memory efficiency, but also for smoothing out aliasing over distance. |
1 similar comment
This comment was marked as duplicate.
This comment was marked as duplicate.
i got defeated by git.... lmao |
I assume this should be reopened then? |
This proposal was reopened already, but @Lasuch69 needs to open another pull request as godotengine/godot#64660 was automatically closed (it was not merged to upstream |
I will work on this more because i thought that i don't have much time for PR (that this could be merged in 4.0 and not 4.x) and i wanted to continue with my other projects. In the meantime i will work on polishing and i think that in 4.1 this will be merged as full featured texture (seamless generation, fix bugs etc.) |
The math is going to be a nightmare with seamless generation and probably a new function in noise.cpp. Maybe not math but reading code for seamless generation xD. |
I gave it another shot. I will make updates on this. |
@Lasuch69 I've tried to apply the latest commit of https://github.com/Lasuch69/add_noisetexture3d/tree/add-noisetexture3d to the latest
|
@Calinou I was testing something before and i haven't made it working again. I can fix it today. Maybe I will hopefully come up with a solution to my problems with this resource. |
Rebased to latest commit https://github.com/Lasuch69/add_noisetexture3d/tree/add-noisetexture3d Works fine. Now let's do some mipmapping. :( |
Tested locally, it still crashes on creating a NoiseTexture3D. This occurs even if I create the resource directly in the inspector, without assigning it to any node. |
That's weird. What is your platform? Nevermind, I recreated it. |
Fixed the problem with crashing. I will update it in a moment. Done! For now disable mipmaps to generate texture, and i will make mipmaps later as i need to learn how to make everything go nicely before adding all features. GDScript binding needs to be fixed in this resource. |
@Lasuch69 I still get a crash on commit
|
@Calinou I am currently taking a break from programming. I will be back in a couple of days, after that I will be fully dedicated to it. |
Okay so I made GDScript bindings work based on ImageTexture3D implementation. I will try to test some things then move on to mipmaps. I will update repo in a moment. Done! |
Tested locally, it works great this time! Nice work 🙂 Testing project: test_noisetexture3d.zip There are two issues I noticed, but these are not critical for using a NoiseTexture3D as a density map within a FogVolume:
|
@Calinou I think that mipmaps are higher priority right now so I wasn't trying to implement seamless generation yet. Also good point with changing format with color ramp :) |
Made it work the same way as 2D equivalent, L8 normally and RGBA8 with color ramp. I tried to make mipmaps... no progress so far, now I am doing seamless generation. |
When I think about how much iterations are required for making seamless generation without modifying noise class I doubt that it is going to be usable on something higher than maybe 256x256x256. I need to iterate over a lot of images and arrays, arrays aren't that bad but I need to blend every single pixel on a lot of images. |
I've managed to make seamless generation work but it is performance hog, definitely needs rewriting. It is so heavy that on my CPU (ryzen 5 3400g) 128x128x128 texture isn't updating in real time with seamless generation turned on. |
Describe the project you are working on
Just testing features before release.
Describe the problem or limitation you are having in your project
Fog volumes could be procedural for nice vfx but lacks an option to do so OOTB (maybe custom material will work but it would be awesome anyway to have built-in). I am talking about using noise in density texture but noise doesn't have 3D output, and isn't even an option to choose (there is a 3D mode in noise but output is projected onto 2D texture).
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Adding support for using noise texture with something like a real 3D mode in a FogVolume's material. This change could greatly increase volume usability and as i stated before, allow to create really nice visual effects easier.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
NoiseTexture with maybe something like "3D" parameter could be used inside FogVolume density texture.
If this enhancement will not be used often, can it be worked around with a few lines of script?
I think that it is possible but it is inconvenient.
Is there a reason why this should be core and not an add-on in the asset library?
i think that it is a basic feature that would be used not only in fog volumes because "NoiseTexture3D" could be used in a variety of shaders
The text was updated successfully, but these errors were encountered: