I will try to be as clear as possible as its a tough one to describe
1) Point light casting a shadow: If you place a point light in the scene and use a tmpCubemap size of 512x512 and using a compositor workspace where the textures are generated and then copied onto the render window, it will show a strange overlay that is the same colour as the background(clear pass). I have managed to replicate it in the basic PbsMaterials sample through a simple few tweaks and test setups. Here's a picture of the problem for reference:
It only happens with point lights casting shadows, anyway to replicate the error, change the following:
In the "PbsMaterialsGameState.cpp" around where the lights are created, change it to this:
Code: Select all
Ogre::Light *light = sceneManager->createLight();
Ogre::SceneNode *lightNode = rootNode->createChildSceneNode();
lightNode->attachObject( light );
light->setPowerScale( 1.0f );
light->setType( Ogre::Light::LT_DIRECTIONAL );
light->setDirection( Ogre::Vector3( -1, -1, -1 ).normalisedCopy() );
light->setCastShadows(false);
mLightNodes[0] = lightNode;
sceneManager->setAmbientLight( Ogre::ColourValue( 0.3f, 0.5f, 0.7f ) * 0.1f * 0.75f,
Ogre::ColourValue( 0.6f, 0.45f, 0.3f ) * 0.065f * 0.75f,
-light->getDirection() + Ogre::Vector3::UNIT_Y * 0.2f );
light = sceneManager->createLight();
lightNode = rootNode->createChildSceneNode();
lightNode->attachObject( light );
light->setDiffuseColour( 0.8f, 0.4f, 0.2f ); //Warm
light->setSpecularColour( 0.8f, 0.4f, 0.2f );
light->setPowerScale( Ogre::Math::PI );
light->setType( Ogre::Light::LT_POINT );
light->setCastShadows(true);
lightNode->setPosition( -0, 0.3f, 0 );
// light->setDirection( Ogre::Vector3( 1, -1, -1 ).normalisedCopy() );
light->setAttenuationBasedOnRadius( 10.0f, 0.01f );
mLightNodes[1] = lightNode;
/*light = sceneManager->createLight();
lightNode = rootNode->createChildSceneNode();
lightNode->attachObject( light );
light->setDiffuseColour( 0.2f, 0.4f, 0.8f ); //Cold
light->setSpecularColour( 0.2f, 0.4f, 0.8f );
light->setPowerScale( Ogre::Math::PI );
light->setType( Ogre::Light::LT_SPOTLIGHT );
lightNode->setPosition( 10.0f, 10.0f, -10.0f );
light->setDirection( Ogre::Vector3( -1, -1, 1 ).normalisedCopy() );
light->setAttenuationBasedOnRadius( 10.0f, 0.01f );
mLightNodes[2] = lightNode;
*/
Code: Select all
// TEST 01 --- Render the scene and shadows directly inside the RenderWindow target.
compositor_node PbsMaterialsRenderingNode
{
in 0 rt_renderwindow
target rt_renderwindow
{
pass clear
{
colour_value 0.2 0.4 0.6 1
}
pass render_scene
{
overlays on
shadows PbsMaterialsShadowNode
}
}
}
// TEST 02 --- Render the scene into a generated render target and then copy the texture into the render window.
// Which uses a start & end compositing node.
compositor_node PbsMaterials_Gen_And_Window
{
in 0 rt_renderwindow
texture rt0 target_width target_height PF_FLOAT16_RGBA
// Render to the generated texture
target rt0
{
pass clear
{
colour_value 0.2 0.4 0.6 1
}
pass render_scene
{
shadows PbsMaterialsShadowNode
overlays off
}
}
// Now copy the texture contents into the render window target.
target rt_renderwindow
{
pass clear
{
colour_value 1 0 0 1
buffers colour
discard_only true
}
pass render_quad
{
material Ogre/Copy/4xFP32
input 0 rt0
}
pass render_scene
{
overlays on
rq_first 254
rq_last 255
}
}
}
// TEST 03 --- Render the scene into a generated render target and then copy the texture into the render window.
// Which uses a start & end compositing node.
compositor_node PbsMaterials_StartingNode
{
texture rt0 target_width target_height PF_FLOAT16_RGBA
target rt0
{
pass clear
{
colour_value 0.2 0.4 0.6 1
}
pass render_scene
{
shadows PbsMaterialsShadowNode
overlays off
}
}
out 0 rt0
}
compositor_node PbsMaterials_RenderFinal
{
in 0 rt_output
in 1 rt1
target rt_output
{
pass clear
{
colour_value 1 0 0 1
buffers colour
discard_only true
}
pass render_quad
{
material Ogre/Copy/4xFP32
input 0 rt1
}
pass render_scene
{
overlays on
rq_first 254
rq_last 255
}
}
}
abstract target cubemap_target_shadow
{
pass clear { colour_value 1 1 1 1 }
pass render_scene
{
camera_cubemap_reorient true
}
}
compositor_node_shadow PbsMaterialsShadowNode
{
technique pssm
texture atlas 2048 7168 PF_D32_FLOAT no_fsaa
texture tmpCubemap 512 512 PF_FLOAT32_R cubemap no_fsaa
num_splits 3
pssm_lambda 0.95
shadow_map 0 atlas uv 0.0 0.000000000000000 1.0 0.285714285714286 light 0 split 0
shadow_map 1 atlas uv 0.0 0.285714285714286 0.5 0.142857142857143 light 0 split 1
shadow_map 2 atlas uv 0.5 0.285714285714286 0.5 0.142857142857143 light 0 split 2
technique focused
shadow_map 3 atlas uv 0.0 0.428571428571429 1.0 0.285714285714286 light 1
shadow_map 4 atlas uv 0.0 0.714285714285714 1.0 0.285714285714286 light 2
target atlas
{
pass clear
{
colour_value 1 1 1 1
}
}
shadow_map_target_type directional
{
shadow_map 0 1 2
{
pass render_scene
{
}
}
}
shadow_map_target_type directional spot
{
shadow_map 3 4
{
pass render_scene
{
}
}
}
shadow_map_target_type point
{
shadow_map_repeat 3 4
{
target tmpCubemap +X : cubemap_target_shadow {}
target tmpCubemap -X : cubemap_target_shadow {}
target tmpCubemap +Y : cubemap_target_shadow {}
target tmpCubemap -Y : cubemap_target_shadow {}
target tmpCubemap +Z : cubemap_target_shadow {}
target tmpCubemap -Z : cubemap_target_shadow {}
shadow_map
{
pass render_quad
{
material Ogre/DPSM/CubeToDpsm
input 0 tmpCubemap
}
}
}
}
}
workspace PbsMaterialsWorkspace
{
// Test 01
//connect_output PbsMaterialsRenderingNode 0
// Test 02
connect_output PbsMaterials_Gen_And_Window 0
// Test 03
//connect PbsMaterials_StartingNode 0 PbsMaterials_RenderFinal 1
//connect_output PbsMaterials_RenderFinal 0
}
* The main change which i have found to cause this is changing the scale of the "tmpCubemap" texture from 1024x1024 to 512x512 and not rendering directly into the main renderwindow rendertarget.
* Also; In the workspace is 3 different tests, they all use the same shadow node with the same cubemap settings, however:
- Test 01: This works as expected but renders the scene directly into the main output target.
- Test 02: This shows the error of the render target from the point light, This is a single compositor node, but first the scene is rendered into a texture, then the texture is copied to the main render window.
- Test 03: This shows the error. This uses one compositor node to generate the texture followed by another to copy the texture to the main render window. This is a more real world case example as this is used for sending to other post FX nodes.
I believe it has something to do with the:
Code: Select all
pass render_quad
{
material Ogre/Copy/4xFP32
input 0 rt0
}
The other strange thing is that it only breaks at certain size resolutions, e.g. changing the window size can make this appear or disappear. I found it happened every time for me with this ogre.cfg:
Code: Select all
[OpenGL 3+ Rendering Subsystem]
Colour Depth=32
Display Frequency=N/A
FSAA=0
Full Screen=No
RTT Preferred Mode=FBO
VSync=No
VSync Interval=1
Video Mode=1366 x 768
sRGB Gamma Conversion=Yes
---------------------------------------------------------------------------------------------------------------------------------------------------------
2) Since the last merge of the commit: https://bitbucket.org/sinbad/ogre/commi ... d5?at=v2-1 using PSSM. When looking towards the directional light and looking up slightly, it was producing a black shadow at the bottom of the window. Increasing the settings from the commit to above 1.0 got rid of the artefact again.
There was another one, but i think these 2 are enough for now, but mainly the first bug as its giving me problems with different quality shadows in fullscreen mode for our end games and when not in fullscreen mode for the editor..
Thanks for your time and if you need any more information, then please ask and i shall provide. Hope this helps
p.s. you probably want my specs too:
CPU: Intel core i7 3770
GPU: Nvidia GTX 750ti
Ram: Corsair DDR3 16gb
Drivers are mostly up to date for all