Out of curiosity, I've tried the decals branch. It's really nice overall, but I found two bugs:
1. If I only use emissive decals, not diffuse/normal decals, I would get the following shader compilation error:
...\HlmsDebug\537035522PixelShader_ps.hlsl(800,42-70): error X4000: variable 'decalMask' used without having been completely initialized
It looks trivial to fix, though.
In Forward3D_pieces_ps.any, after this:
Code: Select all
@property( hlms_decals_diffuse )
...
@end
Code: Select all
@property( !hlms_decals_diffuse )
decalMask = isOutsideDecal ? 0.0f : 1.0f;
@end
Then it works most of the time. However, sometimes part of the decals just "disappear". Looks like a bug in Forward Cluster intersection code? Anyway, I've simplified my use-case and modified the sample. When you hit F4, some parts of the spheres are not covered by the decal. Here is the diff:
Code: Select all
Samples/2.0/ApiUsage/Decals/DecalsGameState.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/Samples/2.0/ApiUsage/Decals/DecalsGameState.cpp b/Samples/2.0/ApiUsage/Decals/DecalsGameState.cpp
index ff4e878..47ab591 100644
--- a/Samples/2.0/ApiUsage/Decals/DecalsGameState.cpp
+++ b/Samples/2.0/ApiUsage/Decals/DecalsGameState.cpp
@@ -64,7 +64,7 @@ namespace Demo
Ogre::SceneNode *sceneNode = sceneManager->createSceneNode();
sceneNode->attachObject( decal );
sceneNode->setPosition( Ogre::Vector3( 0, 0.4, 0 ) );
- sceneNode->setOrientation( Ogre::Quaternion( Ogre::Degree( 45.0f ), Ogre::Vector3::UNIT_Y ) );
+ sceneNode->setOrientation( Ogre::Quaternion( Ogre::Degree( 45.0f ), Ogre::Vector3::UNIT_X ) );
sceneNode->setScale( Ogre::Vector3( 10.0f ) );
wireAabb->track( decal );
@@ -102,8 +102,8 @@ namespace Demo
Ogre::v1::MeshPtr planeMeshV1 = Ogre::v1::MeshManager::getSingleton().createPlane( "Plane v1",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
- Ogre::Plane( Ogre::Vector3::UNIT_Y, 1.0f ), 50.0f, 50.0f,
- 1, 1, true, 1, 4.0f, 4.0f, Ogre::Vector3::UNIT_Z,
+ Ogre::Plane( Ogre::Vector3::UNIT_Z, 1.0f ), 50.0f, 50.0f,
+ 1, 1, true, 1, 4.0f, 4.0f, Ogre::Vector3::UNIT_X,
Ogre::v1::HardwareBuffer::HBU_STATIC,
Ogre::v1::HardwareBuffer::HBU_STATIC );
@@ -221,8 +221,8 @@ namespace Demo
Ogre::SceneNode *sceneNode = sceneManager->getRootSceneNode( Ogre::SCENE_DYNAMIC )->
createChildSceneNode( Ogre::SCENE_DYNAMIC );
sceneNode->setPosition( Ogre::Vector3( armsLength * x - startX,
- 1.0f,
- armsLength * z - startZ ) );
+ armsLength * z - startZ,
+ 4.0f));
sceneNode->attachObject( item );
}
}