Hi guys, the thing is that I recently wanted to make my billboard shader for particles whose source should rotate freely. Well, I’m using a bit of self-written logic for rotations and calculating the rotation angle, but I needed the vertex normal to do it. I tried to use the semantics of the normal in the shader settings and get it in the code:
Material file in text editor:
name: "particle"
tags: "particle"
vertex_program: "/root/render/Billboard/particles/particlefx.vp"
fragment_program: "/builtins/materials/particlefx.fp"
vertex_space: VERTEX_SPACE_WORLD
vertex_constants {
name: "mvp"
type: CONSTANT_TYPE_WORLDVIEWPROJ
value {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
}
vertex_constants {
name: "v"
type: CONSTANT_TYPE_VIEW
value {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
}
fragment_constants {
name: "tint"
type: CONSTANT_TYPE_USER
value {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
}
max_page_count: 0
attributes {
name: "local_position"
semantic_type: SEMANTIC_TYPE_POSITION
element_count: 3
normalize: false
data_type: TYPE_FLOAT
coordinate_space: COORDINATE_SPACE_LOCAL
double_values {
v: 0.0
v: 0.0
v: 0.0
}
}
attributes {
name: "worldVertexNormal"
semantic_type: SEMANTIC_TYPE_NORMAL
element_count: 3
normalize: false
data_type: TYPE_FLOAT
coordinate_space: COORDINATE_SPACE_WORLD
double_values {
v: 0.0
v: 0.0
v: 0.0
}
}
//my vertex shader
uniform highp mat4 mvp;
uniform highp mat4 v;
attribute highp vec3 local_position;
attribute highp vec3 worldVertexNormal;
attribute highp vec4 position; // positions are in world space
attribute mediump vec2 texcoord0;
attribute lowp vec4 color;
But I got a list of unfilled vectors:
I’m not sure how to use this in the end, did I get the correct data at all ?