Replies: 1 comment
-
The vsgmeshshader example's data/shaders/meshshader.mesh uses the standard projection and modelview matrices that are set up by the VSG (passed in by vsg::State updating the associated push constants.) This is same mechanism and approach used for non mesh shader subgraphs such as the data/shaders/standard.vert. I can't say what might be going wrong in your setup, it may be simply that you are making assumptions about what is happening and expecting things to work that simple won't. I don't know what you are expecting or what you scene graph setup is, or what the data so I can't really provide any advice. The best guess I can come up with is that perhaps you are expecting a loading model to automatically work with mesh shaders when it's been setup for a standard GraphicsPipeline with a vertex and fragments shader. This is what vsgXchange::assimp will do when loading a .glb file, unless you've assigned a custom ShaderSet to change this. However, I basically have no clue what you are doing beyond a mesh shader which is in complete isolation from the rest your scene graph setup and your application, it's basically not helpful information at this point. My advice is learn tools like RenderDoc and see if that can give you insights. You can use the new vsg::GpyAnnotation instrumentation to help with this, please look at my recent explain of this here on this forum. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have been studying mesh shaders based on the vsgmeshshader.cpp recently. Currently, I can load models and render them using mesh shaders. However, I've encountered some issues. For example, I have a GLB model file with two meshes. It seems that these two meshes are using the same projection and modelView matrices, unlike other vsg examples where these matrices are automatically updated. In the mesh shader, how should I update these two matrices?
#version 450
#extension GL_EXT_mesh_shader : require
#extension GL_ARB_separate_shader_objects : enable
#extension GL_EXT_debug_printf : enable
#extension GL_EXT_shader_16bit_storage: require
#extension GL_EXT_shader_8bit_storage: require
#extension GL_GOOGLE_include_directive: require
layout(push_constant) uniform PushConstants {
mat4 projection;
mat4 modelView;
} pc;
layout(location = 0) in vec3 vsg_Vertex;
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
layout(triangles, max_vertices = 64, max_primitives = 64) out;
struct s_meshlet
{
// vec3 keeps Meshlet aligned to 16 bytes which is important because C++ has an alignas() directive
vec3 center;
float radius;
int8_t cone_axis[3];
int8_t cone_cutoff;
};
layout(set = 0, binding = 0) buffer CellColors {
vec4[] Positions;
};
layout(set = 0, binding = 1) buffer VertexIndex {
uint meshletData[];
};
layout(set =0, binding = 1) readonly buffer MeshletData8
{
uint8_t meshletData8[];
};
layout (std430, binding = 2) buffer _meshlets {
s_meshlet meshlets[];
} mbuf;
layout(location = 0) out VertexOutput {
vec4 color;
} vertexOutput[];
void main() {
}
Beta Was this translation helpful? Give feedback.
All reactions