-
Notifications
You must be signed in to change notification settings - Fork 11
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
Issue with 3D Perlin implementation #7
Comments
I spent today updating the library to bevy 0.11 (v0.5 on crates.io) and creating a new example that can generate some screenshots Here's a collection of the images that are currently being generated. I notice issues in Thanks for the issue! |
Awesome!! |
By the way @ChristopherBiscardi how are we supposed to import the shaders if we install the library by doing cargo add ..., I wasn't able to import it.. What I have done so far was copying the specific file to my assets directory and put a comment at the beginning with the url to this library for proper crediting, but I'd prefer to just install it like a regular library. |
@ndavd did you look at the shaders for the materials in the example application? I'll include a better README in the next release. Here's an example using the simplex noise function, which in bevy 0.11 can now be imported by name. #import bevy_pbr::mesh_vertex_output MeshVertexOutput
#import bevy_shader_utils::simplex_noise_3d simplex_noise_3d
struct Material {
scale: f32
};
@group(1) @binding(0)
var<uniform> material: Material;
@fragment
fn fragment(
mesh: MeshVertexOutput
) -> @location(0) vec4<f32> {
let f: f32 = simplex_noise_3d(material.scale * mesh.world_position.xyz);
let color_a = vec3(0.282, 0.51, 1.0);
let color_b = vec3(0.725, 0.816, 0.698);
let mixed = mix(color_a, color_b, f);
return vec4(mixed, 1.0);
} |
Oh amazing, I'll give it a try |
@ChristopherBiscardi I tried what you provided but I do get this: |
Update: It's working, was just missing the |
There seems to be an issue with the Perlin 3D implementation.
Passing the following data
world_position.xyz * 5.0
It seems to have something to do with the algorithm only using the decimal part on one of the parameters, the cube has length of 1, notice how I multiplied the input by 5 and we see 5 stripes in one of the directions...
The text was updated successfully, but these errors were encountered: