-
Notifications
You must be signed in to change notification settings - Fork 0
Vertex data packing #60
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wip
chunk_position: Vec3, | ||
mesh_type: MeshType, | ||
material_handle: Handle<StandardMaterial>, | ||
material_handle: Handle<ExtendedMaterial<StandardMaterial, MyExtension>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Define Type Alias for the material
material_handle: Handle<ExtendedMaterial<StandardMaterial, MyExtension>>, | |
material_handle: Handle<ChunkMaterial>, |
assets/shaders/my_material.glsl
Outdated
@location(0) position: vec3<f32>, | ||
@location(1) blend_color: vec4<f32>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use packed data
@location(0) position: vec3<f32>, | |
@location(1) blend_color: vec4<f32>, | |
@location(0) packed_data: f32, |
src/client/terrain/materials.rs
Outdated
// We need to ensure that the bindings of the base material and the extension do not conflict, | ||
// so we start from binding slot 100, leaving slots 0-99 for the base material. | ||
#[uniform(100)] | ||
pub quantize_steps: u32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No parameter needed, wie just override the vertex shader
// We need to ensure that the bindings of the base material and the extension do not conflict, | |
// so we start from binding slot 100, leaving slots 0-99 for the base material. | |
#[uniform(100)] | |
pub quantize_steps: u32, |
This PR has been abandoned in favour of implementing own RayTracer |
Vertex Data Packing
Currently the terrain uses up a lot of memory. This could be the cause for all the lag spikes when rendering the world.
One optimization is reducing the amount of data each vertex holds by packing multiple attributes into one number and extracting the individual values in a vertex shader, adding a little overhead to every render.
The following plan is based on the Information Theory class from ZHAW: