No VertexElement for semantic NORMAL0 in shader
-
- Goblin
- Posts: 211
- Joined: Sat Jan 23, 2016 11:26 am
- x 17
No VertexElement for semantic NORMAL0 in shader
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.
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.
-
- OGRE Team Member
- Posts: 1995
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1075
- Contact:
Re: No VertexElement for semantic NORMAL0 in shader
billboards have no normal (VertexElement) which is required to do lighting calculations in the generated shader (semantic NORMAL)
-
- Gnoll
- Posts: 619
- Joined: Wed Mar 18, 2009 3:03 am
- x 355
Re: No VertexElement for semantic NORMAL0 in shader
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).
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).
My project: https://imagindar.com/
-
- Goblin
- Posts: 211
- Joined: Sat Jan 23, 2016 11:26 am
- x 17
Re: No VertexElement for semantic NORMAL0 in shader
So you mean is possible to create a not flat billboardset adding deep with new vertex like for a manualobject? Thanksrpgplayerrobin 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).
-
- OGRE Team Member
- Posts: 1995
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1075
- Contact:
Re: No VertexElement for semantic NORMAL0 in shader
This is the RTSS in action, see e.g.: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?
https://www.ogre3d.org/2020/02/07/rtss- ... e-ogre-way
I would actually prefer if you do the change directly in Ogre and the create a pull-request, so everyone wins..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).
-
- Gnoll
- Posts: 619
- Joined: Wed Mar 18, 2009 3:03 am
- x 355
Re: No VertexElement for semantic NORMAL0 in shader
Ah, I see!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
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?
My project: https://imagindar.com/
-
- Gnoll
- Posts: 619
- Joined: Wed Mar 18, 2009 3:03 am
- x 355
Re: No VertexElement for semantic NORMAL0 in shader
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?Niubbo wrote: ↑Wed May 13, 2020 7:44 amSo you mean is possible to create a not flat billboardset adding deep with new vertex like for a manualobject? Thanksrpgplayerrobin 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).
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).
My project: https://imagindar.com/
-
- Goblin
- Posts: 211
- Joined: Sat Jan 23, 2016 11:26 am
- x 17
Re: No VertexElement for semantic NORMAL0 in shader
So you use the shaders functions to change the vertex positions in a different Z coordinate? Correct?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).
-
- Gnoll
- Posts: 619
- Joined: Wed Mar 18, 2009 3:03 am
- x 355
Re: No VertexElement for semantic NORMAL0 in shader
No, I do not alter their vertex positions.Niubbo wrote: ↑Wed May 13, 2020 1:26 pmSo you use the shaders functions to change the vertex positions in a different Z coordinate? Correct?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).
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.
My project: https://imagindar.com/
-
- OGRE Team Member
- Posts: 1995
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1075
- Contact:
Re: No VertexElement for semantic NORMAL0 in shader
see this for a general explanation of the approach:
https://paroj.github.io/gltut/Illuminat ... %2013.html
-
- Goblin
- Posts: 211
- Joined: Sat Jan 23, 2016 11:26 am
- x 17
Re: No VertexElement for semantic NORMAL0 in shader
thanks you both
-
- Gnoblar
- Posts: 19
- Joined: Wed Mar 31, 2021 8:36 am
- x 1
Re: No VertexElement for semantic NORMAL0 in shader
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?
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?