-
-
Notifications
You must be signed in to change notification settings - Fork 22.8k
Implement RasterizedMeshTexture (RenderingDevice) #106331
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
base: master
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
640ce03
to
86c5ddf
Compare
This comment was marked as outdated.
This comment was marked as outdated.
520549c
to
cab9b28
Compare
This comment was marked as outdated.
This comment was marked as outdated.
8991649
to
cf91792
Compare
I couldn't reproduce the crash on Linux. However I tested on Windows and found it throws errors and can't run at all. (Fixed now, and it doesn't crash, either). |
cf91792
to
d98c196
Compare
2025-05-17.12-07-33.mp4hey here are all the steps to repro this and here is my specs in case. im also on linux Godot v4.5.dev.mono (59a9f4c) - Pop!_OS 22.04 LTS on X11 - X11 display driver, Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4060 Laptop GPU - 12th Gen Intel(R) Core(TM) i7-12650H (16 threads) fwiw moving the main window also seems to cause a crash. weird |
Are you able to compile with dev_build=yes to get a backtrace? I can't reproduce Vulkan 1.4.305 - Forward+ - Using Device #0: AMD - AMD Radeon Graphics (RADV RENOIR) |
I have encountered crash when trying to copy paste the node between scenes. godot.windows.editor.dev.x86_64_8BCCvefFns.mp4 |
And another crash when I try to remove the material. godot.windows.editor.dev.x86_64_2JHCZwxR2C.mp4 |
5e82592
to
dac9ee8
Compare
Fixed now. |
dac9ee8
to
f628176
Compare
Perfect, I can confirm it's no longer crashing but when I add a shader, the texture stops showing up. godot.windows.editor.x86_64_wCui41KOOc.mp4 |
It's because the projection is actually zero matrix until modifying or reloading the scene. I opened a separate issue #106561 |
f628176
to
69b7359
Compare
This comment was marked as outdated.
This comment was marked as outdated.
You can also modify the ww component to globally scale. |
I did not realized that but that makes total sense. |
5a0cf31
to
25e8e17
Compare
82fa3ff
to
f821274
Compare
Implemented drawable texture in my opinion that works with the mesh rasterizer. See also godotengine/godot-proposals#12443 (comment) In addition:
TODO: In addition, this PR chooses to do nothing for the conversion between sRGB and linear( source_color hint also does nothing ). There is a difference in RGBAF/RGBAH texture colors in the 2D and 3D renderers. But RGBA8/RGBA8_SRGB textures displays the same in 2D and 3D. I think it's expected. Test project: And use mesh rasterizer with https://github.com/Auburn/FastNoiseLite/blob/master/GLSL/FastNoiseLite.glsl: shader_type mesh_rasterizer;
uniform vec2 size = vec2(256,256);
uniform int noise_seed = 0;
#include "include/FastNoiseLite.gdshaderinc"
void fragment() {
fnl_state state = fnlCreateState(noise_seed);
state.noise_type = FNL_NOISE_OPENSIMPLEX2;
state.fractal_type = FNL_FRACTAL_FBM;
state.frequency = 0.01f;
state.octaves = 4;
state.lacunarity = 2.0f;
state.gain = 0.5f;
FNLfloat val = fnlGetNoise2D(state, UV.x*size.x, UV.y*size.y)/ 2.0f + 0.5f;
COLOR = vec4(val, 0.0, 0.0, 1.0);
} |
896a8ae
to
faf55fd
Compare
faf55fd
to
024e2d5
Compare
024e2d5
to
a970b63
Compare
a970b63
to
abbef01
Compare
Pushed a simplified implementation (just a single Removed blend state and MSAA settings. |
Ported from https://github.com/beicause/GodotMeshTextureRd(very different now).Current MeshTexture is just a wrapper for canvas_item_add_mesh() and doesn't store texture data itself, which means it can't be used in shader uniform or 3D scene. And it can't do regional drawing.
This PR implements a more powerful rasterized mesh texture, which provides more flexible control than the MeshTexture. And should have better performance compared to ViewportTexture (#102028).
RasterizedMeshTexture reads one surface from mesh and supports shader material (both vertex shader and fragment shader) with the new shader type "rasterize_mesh".
This is only implemented in RenderingDevice (Forawrd+&Mobile renderer) for now, not Compatibility.