-
Notifications
You must be signed in to change notification settings - Fork 69
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
Metal-roughness maps not exported #138
Comments
Hello @paroj, I'm struggling to make RTSS work in order to test this (OGRE 13.6.2, Rendersystem: RenderSystem_GL3Plus). I'm just testing Normal Maps for now.
Resulting Vertex Shader: #version 460
//-----------------------------------------------------------------------------
// PROGRAM DEPENDENCIES
//-----------------------------------------------------------------------------
#define USE_OGRE_FROM_FUTURE
#include <OgreUnifiedShader.h>
#include "FFPLib_Transform.glsl"
#include "SGXLib_PerPixelLighting.glsl"
#include "FFPLib_Texturing.glsl"
//-----------------------------------------------------------------------------
// GLOBAL PARAMETERS
//-----------------------------------------------------------------------------
layout(location = 0) uniform mat4 worldviewproj_matrix;
layout(location = 4) uniform mat3 normal_matrix;
layout(location = 7) uniform mat4 worldview_matrix;
//-----------------------------------------------------------------------------
// MAIN
//-----------------------------------------------------------------------------
IN(vec4 vertex, POSITION)
IN(vec3 normal, NORMAL)
IN(vec4 uv0, TEXCOORD0)
OUT(vec3 iTexcoord_0, 0)
OUT(vec3 iTexcoord_1, 1)
OUT(vec2 iTexcoord_2, 2)
out gl_PerVertex
{
vec4 gl_Position;
float gl_PointSize;
float gl_ClipDistance[];
};
void main(void) {
vec4 lColor_0;
vec4 lColor_1;
FFP_Transform(worldviewproj_matrix, vertex, gl_Position);
lColor_0 = vec4(1.00000,1.00000,1.00000,1.00000);
lColor_1 = vec4(0.00000,0.00000,0.00000,0.00000);
FFP_Transform(normal_matrix, normal, iTexcoord_0);
FFP_Transform(worldview_matrix, vertex, iTexcoord_1);
iTexcoord_2 = uv0.xy;
} Resulting Fragment Shader: #version 460
//-----------------------------------------------------------------------------
// PROGRAM DEPENDENCIES
//-----------------------------------------------------------------------------
#define USE_OGRE_FROM_FUTURE
#include <OgreUnifiedShader.h>
#include "SGXLib_PerPixelLighting.glsl"
#include "FFPLib_Texturing.glsl"
//-----------------------------------------------------------------------------
// GLOBAL PARAMETERS
//-----------------------------------------------------------------------------
SAMPLER2D(gTextureSampler0, 0);
layout(location = 0) uniform vec4 derived_ambient_light_colour;
layout(location = 1) uniform vec4 surface_emissive_colour;
layout(location = 2) uniform vec4 derived_scene_colour;
layout(location = 3) uniform float surface_shininess;
layout(location = 4) uniform vec4 light_position_view_space;
layout(location = 5) uniform vec4 light_attenuation;
layout(location = 6) uniform vec4 derived_light_diffuse_colour;
layout(location = 7) uniform vec4 derived_light_specular_colour;
//-----------------------------------------------------------------------------
// MAIN
//-----------------------------------------------------------------------------
IN(vec3 iTexcoord_0, 0)
IN(vec3 iTexcoord_1, 1)
IN(vec2 iTexcoord_2, 2)
void main(void) {
vec4 lColor_0;
vec4 lColor_1;
vec4 texel_0;
lColor_0 = vec4(1.00000,1.00000,1.00000,1.00000);
lColor_1 = vec4(0.00000,0.00000,0.00000,0.00000);
gl_FragColor = lColor_0;
gl_FragColor = derived_scene_colour;
SGX_Light_Point_DiffuseSpecular(iTexcoord_0, iTexcoord_1, light_position_view_space.xyz, light_attenuation, derived_light_diffuse_colour.xyz, derived_light_specular_colour.xyz, surface_shininess, gl_FragColor.xyz, lColor_1.xyz);
lColor_0 = gl_FragColor;
texel_0 = texture2D(gTextureSampler0, iTexcoord_2);
gl_FragColor = texel_0*gl_FragColor;
gl_FragColor.xyz = gl_FragColor.xyz+lColor_1.xyz;
} |
Wow, my mistake was that stupid? 🙄 Thanks, now it works. I'm trying to understand a bit about RTSS, because I wonder if the way things are currently being exported is the proper way. Can I ask more questions here or do you prefer the forums? |
feel free to ask here |
@paroj I'm trying to use the "DamagedHelmet" model from the PBR sample to check the output. I see that the PBR example works with RTSS and looks quite nice. But this is the result in my program: Here is the material I'm using:
And the OGRE logs:
|
are you using mesh and material from the samples, just in your code or are you exporting the mesh with blender2ogre again? |
I think that I'm using everything from the samples, there is a "DamagedHelmet" asset which contains the .mesh and image maps. What's even worse is that somehow trying to enable IBL from my code now the helmet looks completely white, even putting everything as it was... I'm very confused. So I'll leave the RTSS for now and try to implement this using the DamagedHelmet_RTSS material as a template and then worry about my code not working properly with RTSS. I wanted to take a deeper look at RTSS, but not for now... Thanks! |
did you maybe forget to update the Ogre shaders when updating to 13.6? Also the sample only uses one directional light. You should also start with that to ensure you dont run into any bugs that might be there with other light types. |
Ouch, I was using a point light.
No, the shaders are directly from the built OGRE 13.6.2 directory. What really suprised me is that it suddenly broke (now the helmet looks all white). But now I'm focusing on understanding Thanks. |
@paroj thanks to your guidance I was able to get the RTSS working. Also the changes to One thing that I find disturbing is that the lighting calculations seem to be wrong. In this image the shading makes it look like the light is on the other side: In this image the same thing but you can see it in the highlights: The light is directional, I should use an arrow to represent it but it is pointing towards the helmet. Unfortunately the official MeshViewer has no material support it seems and the Example Browser does not show the lights positions in the Damaged Helmet example. |
you can easily visualise the light position with: auto bbs = mSceneMgr->createBillboardSet();
bbs->setDefaultDimensions(1, 1);
bbs->setMaterialName("Examples/Flare");
mSceneMgr->getRootSceneNode()->attachObject(bbs);
bbs->createBillboard(light->getParentSceneNode()->getPosition()); I quickly did this for the sample and the test that come with ogre: which seems about right. I mean it can still be bugged, but it is not as easy as a sign error..
it does, but it only looks for resources in the .mesh directory by default. Alternatively, you can give it a resources.cfg via CLI. |
@paroj what do you think about creating a new release? |
@sercero I drafted a release for master. You should be able to just publish it. |
we should follow glTF and handle this case:
as we support this in Ogre:
https://ogrecave.github.io/ogre/api/latest/rtss.html#autotoc_md248
The text was updated successfully, but these errors were encountered: