No VertexElement for semantic NORMAL0 in shader

Problems building or running the engine, queries about how to use features etc.
Post Reply
Niubbo
Goblin
Posts: 211
Joined: Sat Jan 23, 2016 11:26 am
x 17

No VertexElement for semantic NORMAL0 in shader

Post by Niubbo »

Ogre Version: 1.12.6
Operating System: Win10
Render System: :?:

I'm testing the load of spritesheet of other post in the billboardset; I created a material with only line of texture (see below); I created the test application using the ogrebites application context and the other voices of first tutorial.

material XXXXXX
{
technique
{
pass
{

texture_unit
{
texture YYYY.png
}
}
}
}

At the moment of start of rendering I receive the exception: Ogre::RenderingAPIException::RenderingAPIException: No VertexElement for semantic NORMAL0 in shader 6fb42c45f14a02c8fcfd397e05ab249f_VS found in Ogre::D3D11VertexDeclaration::getD3DVertexDeclaration.

The same happened for every other texture file I use (also the ogre example texture); at the end I discovered that adding the line lighting off in the material, I have not exception. Do you know why have the lighting on will generate the crash during the rendering of material in the billboard? Thanks.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1993
Joined: Sun Mar 30, 2014 2:51 pm
x 1073
Contact:

Re: No VertexElement for semantic NORMAL0 in shader

Post by paroj »

billboards have no normal (VertexElement) which is required to do lighting calculations in the generated shader (semantic NORMAL)
rpgplayerrobin
Gnoll
Posts: 617
Joined: Wed Mar 18, 2009 3:03 am
x 353

Re: No VertexElement for semantic NORMAL0 in shader

Post by rpgplayerrobin »

This looks a bit weird.
It seems the error has to do with D3D11, how can it even render a material without a shader on it?
Obviously in the error it specifies a shader, like it somehow creates one from the non-shader material you posted.

Also, I think you can add the vertex elements you need in "BillboardSet::_createBuffers" and "BillboardSet::genVertices". I would copy the class from Ogre source and then alter it (I have spherical billboards in my game for some particles that I made this way, and they use normals).
Niubbo
Goblin
Posts: 211
Joined: Sat Jan 23, 2016 11:26 am
x 17

Re: No VertexElement for semantic NORMAL0 in shader

Post by Niubbo »

rpgplayerrobin wrote: Wed May 13, 2020 12:54 am Also, I think you can add the vertex elements you need in "BillboardSet::_createBuffers" and "BillboardSet::genVertices". I would copy the class from Ogre source and then alter it (I have spherical billboards in my game for some particles that I made this way, and they use normals).
So you mean is possible to create a not flat billboardset adding deep with new vertex like for a manualobject? Thanks
paroj
OGRE Team Member
OGRE Team Member
Posts: 1993
Joined: Sun Mar 30, 2014 2:51 pm
x 1073
Contact:

Re: No VertexElement for semantic NORMAL0 in shader

Post by paroj »

rpgplayerrobin wrote: Wed May 13, 2020 12:54 am It seems the error has to do with D3D11, how can it even render a material without a shader on it?
This is the RTSS in action, see e.g.:
https://www.ogre3d.org/2020/02/07/rtss- ... e-ogre-way

rpgplayerrobin wrote: Wed May 13, 2020 12:54 am I would copy the class from Ogre source and then alter it (I have spherical billboards in my game for some particles that I made this way, and they use normals).
I would actually prefer if you do the change directly in Ogre and the create a pull-request, so everyone wins..
rpgplayerrobin
Gnoll
Posts: 617
Joined: Wed Mar 18, 2009 3:03 am
x 353

Re: No VertexElement for semantic NORMAL0 in shader

Post by rpgplayerrobin »

paroj wrote: Wed May 13, 2020 11:18 am This is the RTSS in action, see e.g.:
https://www.ogre3d.org/2020/02/07/rtss- ... e-ogre-way
Ah, I see! :)

paroj wrote: Wed May 13, 2020 11:18 am I would actually prefer if you do the change directly in Ogre and the create a pull-request, so everyone wins..
My version is very specific... It can add different kind of vertex elements based on what it needs, it depends on the material it is used with.
It can add uv1, tangent and normal.
"uv1" used in a shader is to know how far in percentage it is from the middle position, "tangent" is the middle position and "normal" is the normal used to calculate the new curved normal to be able to make it spherical with lighting.
So this version I am using is very specific, it does not just add a normal to it, and it requires shaders to be able to do anything with it.

Also, is it not just better to skip normals in the Ogre source? If you are not using them in a shader or anything it is more optimized to have it as it is?
rpgplayerrobin
Gnoll
Posts: 617
Joined: Wed Mar 18, 2009 3:03 am
x 353

Re: No VertexElement for semantic NORMAL0 in shader

Post by rpgplayerrobin »

Niubbo wrote: Wed May 13, 2020 7:44 am
rpgplayerrobin wrote: Wed May 13, 2020 12:54 am Also, I think you can add the vertex elements you need in "BillboardSet::_createBuffers" and "BillboardSet::genVertices". I would copy the class from Ogre source and then alter it (I have spherical billboards in my game for some particles that I made this way, and they use normals).
So you mean is possible to create a not flat billboardset adding deep with new vertex like for a manualobject? Thanks
No, you will have way less control over billboardsets as far as I know. If I remember correctly, aren't they always just 2x triangles?
Check BillboardSet::_createBuffers, the indices created seems to only make it a quad.

What I meant with spherical billboards is that they are still quads, but they can through shaders have a cheated "volume" to be able to get lighting from sources, making them appear almost like clouds do in the real world with lighting (it actually looks amazing).
Niubbo
Goblin
Posts: 211
Joined: Sat Jan 23, 2016 11:26 am
x 17

Re: No VertexElement for semantic NORMAL0 in shader

Post by Niubbo »

What I meant with spherical billboards is that they are still quads, but they can through shaders have a cheated "volume" to be able to get lighting from sources, making them appear almost like clouds do in the real world with lighting (it actually looks amazing).
So you use the shaders functions to change the vertex positions in a different Z coordinate? Correct?
rpgplayerrobin
Gnoll
Posts: 617
Joined: Wed Mar 18, 2009 3:03 am
x 353

Re: No VertexElement for semantic NORMAL0 in shader

Post by rpgplayerrobin »

Niubbo wrote: Wed May 13, 2020 1:26 pm
What I meant with spherical billboards is that they are still quads, but they can through shaders have a cheated "volume" to be able to get lighting from sources, making them appear almost like clouds do in the real world with lighting (it actually looks amazing).
So you use the shaders functions to change the vertex positions in a different Z coordinate? Correct?
No, I do not alter their vertex positions.
As a particle is only a quad (or 2 triangles), there is no way I could make it spherical without adding those vertices to the code itself, and that would be VERY slow as I have 10 000+ particles at a time.
The only thing the shader does is convert the quad into a sphere to fake lighting using that. It is still a quad though.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1993
Joined: Sun Mar 30, 2014 2:51 pm
x 1073
Contact:

Re: No VertexElement for semantic NORMAL0 in shader

Post by paroj »

Niubbo wrote: Wed May 13, 2020 1:26 pm So you use the shaders functions to change the vertex positions in a different Z coordinate? Correct?
see this for a general explanation of the approach:
https://paroj.github.io/gltut/Illuminat ... %2013.html
Niubbo
Goblin
Posts: 211
Joined: Sat Jan 23, 2016 11:26 am
x 17

Re: No VertexElement for semantic NORMAL0 in shader

Post by Niubbo »

thanks you both
dragostej
Gnoblar
Posts: 19
Joined: Wed Mar 31, 2021 8:36 am
x 1

Re: No VertexElement for semantic NORMAL0 in shader

Post by dragostej »

I ran into the same error, when i want to render billboards.
My question is, what is the best solution to solve the problem?
-define own shader to render billboards without normal?
-set lighting off in billboard materials?
-or any other ?

Guys, do you have advices for me?
Post Reply