Page 1 of 2

[2.2] Where are the TextureTypes?

Posted: Sat May 25, 2019 2:55 pm
by Lax
Hello,

I tried to port my NOWA-Engine to Ogre 2.2 and I;m stuck, because the HlmsTextureManager should be no more used, but it had those texture types:

enum TextureMapType
{
TEXTURE_TYPE_DIFFUSE,
TEXTURE_TYPE_MONOCHROME,
TEXTURE_TYPE_NORMALS,
TEXTURE_TYPE_ENV_MAP,
TEXTURE_TYPE_DETAIL,
TEXTURE_TYPE_DETAIL_NORMAL_MAP,
TEXTURE_TYPE_NON_COLOR_DATA,
NUM_TEXTURE_TYPES
};

I have a component, in which the user can configure HlmsPbsDatablock manually and setting textures for specifig texture types. So is this no more possible?

Are there somewhere examples, how to use PBS in Ogre 2.2. What I also miss are examples how to use AreaLight, Decals etc. in 2.2.

Best Regards
Lax

Re: [2.2] Where are the TextureTypes?

Posted: Sat May 25, 2019 4:33 pm
by rujialiu
Lax wrote: Sat May 25, 2019 2:55 pm So is this no more possible?
We had a wrapper of basic texture functionalities to make our code compilable with Ogre 2.1 and Ogre 2.2 (though the Ogre 2.1 build is deprecated now), including the one you mentioned. I don't have access to my codes now, but I can remember it's actually SIMPLER to do in 2.2
Lax wrote: Sat May 25, 2019 2:55 pmAre there somewhere examples, how to use PBS in Ogre 2.2. What I also miss are examples how to use AreaLight, Decals etc. in 2.2.
Huh? Ogre 2.2 DO have samples covering decals and area lights (both kinds), and even BAKING area lights and dynamically changing approx. area light and decals' textures. It looks like for some reason the samples didn't show up in your CMake-generated solution?

Re: [2.2] Where are the TextureTypes?

Posted: Sun May 26, 2019 9:56 am
by Lax
Hi rujialiu,

you are right, the samples2 have not been installed, physically the sources are existing, but cmake did not create projects :(

Do you have example usage code for how to set PBS texture types?

Best Regards
Lax

Re: [2.2] Where are the TextureTypes?

Posted: Sun May 26, 2019 11:27 am
by al2950
I suggest looking at the function HlmsJsonPbs::loadTexture. I think it has everything you need, specifically:

Code: Select all

            uint32 textureFlags = TextureFlags::AutomaticBatching;

            if( datablock->suggestUsingSRGB( textureType ) )
                textureFlags |= TextureFlags::PrefersLoadingFromFileAsSRGB;

            TextureTypes::TextureTypes internalTextureType = TextureTypes::Type2D;
            if( textureType == PBSM_REFLECTION )
            {
                internalTextureType = TextureTypes::TypeCube;
                textureFlags &= ~TextureFlags::AutomaticBatching;
            }

            uint32 filters = TextureFilter::TypeGenerateDefaultMipmaps;
            filters |= datablock->suggestFiltersForType( textureType );

Re: [2.2] Where are the TextureTypes?

Posted: Sun May 26, 2019 11:39 am
by Lax
ok thanks for the information.

Re: [2.2] Where are the TextureTypes?

Posted: Sun May 26, 2019 3:57 pm
by dark_sylinc
Hi!

These flags have been reintroduced, see the enum CommonTextureTypes::CommonTextureTypes in OgreTextureGpuManager.h
Note that they're only for convenience and clarity.
If you see the implementation in TextureGpuManager::createOrRetrieveTexture overload, we just translate CommonTextureTypes type into the appropriate flag combinations.

Cheers
Matias

Re: [2.2] Where are the TextureTypes?

Posted: Sun May 26, 2019 3:58 pm
by rujialiu
Lax wrote: Sun May 26, 2019 9:56 am you are right, the samples2 have not been installed, physically the sources are existing, but cmake did not create projects :(

Do you have example usage code for how to set PBS texture types?
For me, the most common reason for "sample projects not created by CMake" is bad SDL setup. Please check your Ogre dependencies directory and SDL related settings...

For setting PBS texture type, al2950's suggestion is perfect; I just want to emphasize that PrefersLoadingFromFileAsSRGB is very important. Don't miss it if you want to write your own code. Also, please look into suggestFiltersForType() implementation. During our early stages of porting to Ogre 2.2, I forgot to setup a filter "load as normalmap" (cannot remmeber the exact name, sorry) for our normalmaps, resulting weird lighting.

Re: [2.2] Where are the TextureTypes?

Posted: Mon May 27, 2019 10:39 am
by Lax
Ok, i will try that out.

So I have now everything compiled and ported. When I start my NOWA-Design editor, I create the workspace from "PbsMaterials.compositor". At first everything works fine. I also see the MyGui widgets.
But then things will become crazy. When I create a new project in NOWA-Design. I first destroy the workspace and whole scene content (also the current camera).

Code: Select all

this->compositorManager->removeWorkspace(this->workspace);
this->workspace = nullptr;
...
After that, I create a new camera and create a new "PbsMaterials.compositor" workspace again.

Then in renderOneFrame later, I get a crash in "OgreHlmsPbs.cpp" line 1689:

Code: Select all

if( mIrradianceVolume )
{
      const Vector3 irradianceCellSize = mIrradianceVolume->getIrradianceCellSize();
      const Vector3 irradianceVolumeOrigin = mIrradianceVolume->getIrradianceOrigin() /
      ...
Because mIrradianceVolume is not null, but its internal data is corrupt. So is mIrradianceVolume accidentely used? Or became OgreHlmsPbs corrupt and so its internal pointers?

I hope somebody can help with this issue.
Is it maybe, because I recreate the workspace? Is there need to call a specific function, before a workspace can be recreated?

I also see nothing suspicious in the log.

It seems to happen asynchroniously randomly. It got corrupt 20 times after another and the 21 time, it worked. Is it a timing issue?

Best Regards
Lax

Re: [2.2] Where are the TextureTypes?

Posted: Mon May 27, 2019 4:18 pm
by rujialiu
Lax wrote: Mon May 27, 2019 10:39 am I first destroy the workspace and whole scene content (also the current camera).
My experience: there WERE quite a few camera-related bugs in Ogre's commit history 8-)
So you can first try to RE-USE the camera instead of destroy and re-create it, just to see whether your issue goes away.

destroy/recreateing workspaces should be ok. I've done a lot without any problem.
Is it maybe, because I recreate the workspace? Is there need to call a specific function, before a workspace can be recreated?
I think no? But not very sure. You can also try use a random name each time you recreate a workspace.
It seems to happen asynchroniously randomly. It got corrupt 20 times after another and the 21 time, it worked. Is it a timing issue?
asynchroniously??? I don't think a lot of things in Ogre are thread-safe...

Re: [2.2] Where are the TextureTypes?

Posted: Tue May 28, 2019 11:05 am
by al2950
So unless you explicitly set the irradiance Volume or perhaps use the OgreSceneFormatImporter then mIrradianceVolume should be null. If its not then it looks like the HlmsPbs instance is being corrupted, which is more painful! I do not believe Ogre does anything with any HLMS instances when create and deleting workspaces. Its most likely that some other code is corrupting the HLMS pbs instance, it could be Ogre, but I have not seen this problem :?

Re: [2.2] Where are the TextureTypes?

Posted: Tue May 28, 2019 3:57 pm
by Lax
So you can first try to RE-USE the camera instead of destroy and re-create it, just to see whether your issue goes away.
I tried, but the effect is the same.

I also just used the simple Ogre-Samples compositor "PbsMaterials.compositor", but that did also not help.

I also defined using one thread for texture streaming:

Code: Select all

#define OGRE_FORCE_TEXTURE_STREAMING_ON_MAIN_THREAD 1
#define OGRE_DEBUG_MEMORY_CONSUMPTION 1
But that did no help. Its really strange, as HlmsPbs will be suddenly corrupted. See memory snapshot:

Code: Select all

-		this	0x08106190 {mPreparedPass={shadowMaps={mData=0x18347460 {0x181eeb28 {mWidth=3722304989 mHeight=3722304989 ...}} ...} ...} ...}	Ogre::HlmsPbs * {NOWA_Engine_d.dll!Ogre::HlmsPbs}
-		[Ogre::HlmsPbs]	{mPreparedPass={shadowMaps={mData=0x18347460 {0x181eeb28 {mWidth=3722304989 mHeight=3722304989 mDepthOrSlices=...}} ...} ...} ...}	NOWA_Engine_d.dll!Ogre::HlmsPbs
+		Ogre::HlmsBufferManager	{mVaoManager=0x080c9900 {mVbos=0x080c9aa4 {0x080c9aa4 {{ size=2 }, { size=0 }, { size=0 }}, 0x080c9ad4 {...}, ...} ...} ...}	NOWA_Engine_d.dll!Ogre::HlmsBufferManager
+		Ogre::ConstBufferPool	{mPools={...} mBytesPerSlot=256 mSlotsPerPool=256 ...}	NOWA_Engine_d.dll!Ogre::ConstBufferPool
+		mPreparedPass	{shadowMaps={mData=0x18347460 {0x181eeb28 {mWidth=3722304989 mHeight=3722304989 mDepthOrSlices=3722304989 ...}} ...} ...}	NOWA_Engine_d.dll!Ogre::HlmsPbs::PassData
+		mPassBuffers	{ size=4 }	NOWA_Engine_d.dll!std::vector<Ogre::ConstBufferPacked *,Ogre::STLAllocator<Ogre::ConstBufferPacked *,Ogre::CategorisedAllocPolicy<0> > >
+		mShadowmapSamplerblock	0x00000000 <NULL>	const NOWA_Engine_d.dll!Ogre::HlmsSamplerblock *
+		mShadowmapCmpSamplerblock	0x0683e2f8 {mMinFilter=FO_LINEAR (2) mMagFilter=FO_LINEAR (2) mMipFilter=FO_NONE (0) ...}	const NOWA_Engine_d.dll!Ogre::HlmsSamplerblock *
+		mShadowmapEsmSamplerblock	0x0683e2b0 {mMinFilter=FO_LINEAR (2) mMagFilter=FO_LINEAR (2) mMipFilter=FO_NONE (0) ...}	const NOWA_Engine_d.dll!Ogre::HlmsSamplerblock *
+		mCurrentShadowmapSamplerblock	0x0683e2f8 {mMinFilter=FO_LINEAR (2) mMagFilter=FO_LINEAR (2) mMipFilter=FO_NONE (0) ...}	const NOWA_Engine_d.dll!Ogre::HlmsSamplerblock *
+		mParallaxCorrectedCubemap	0x00000000 <NULL>	NOWA_Engine_d.dll!Ogre::ParallaxCorrectedCubemapBase *
		mCurrentPassBuffer	4	unsigned int
		mGridBuffer	0x18c50850 {...}	NOWA_Engine_d.dll!Ogre::TexBufferPacked *
		mGlobalLightListBuffer	0x18c504a8 {...}	NOWA_Engine_d.dll!Ogre::TexBufferPacked *
		mTexUnitSlotStart	1	unsigned int
+		mPrePassTextures	0x189cb744 { size=0 }	const NOWA_Engine_d.dll!std::vector<Ogre::TextureGpu *,Ogre::STLAllocator<Ogre::TextureGpu *,Ogre::CategorisedAllocPolicy<0> > > *
+		mPrePassMsaaDepthTexture	0x00000000 <NULL>	NOWA_Engine_d.dll!Ogre::TextureGpu *
+		mSsrTexture	0x00000000 <NULL>	NOWA_Engine_d.dll!Ogre::TextureGpu *
+		mIrradianceVolume	0x02580000 {NOWA_Engine_d.dll!luabind::detail::pointer_holder<NOWA::CameraBehaviorBaseComponent *,void const >::release(void), Linie 111} {...}	NOWA_Engine_d.dll!Ogre::IrradianceVolume *
		mVctLighting	0x00000000 <NULL>	NOWA_Engine_d.dll!Ogre::VctLighting *
+		mPlanarReflections	0x00000000 <NULL>	NOWA_Engine_d.dll!Ogre::PlanarReflections *
+		mPlanarReflectionsSamplerblock	0x0683e340 {mMinFilter=FO_LINEAR (2) mMagFilter=FO_LINEAR (2) mMipFilter=FO_LINEAR (2) ...}	const NOWA_Engine_d.dll!Ogre::HlmsSamplerblock *
		mHasPlanarReflections	false	bool
		mLastBoundPlanarReflection	0 '\0'	unsigned char
+		mAreaLightMasks	0x00000000 <NULL>	NOWA_Engine_d.dll!Ogre::TextureGpu *
+		mAreaLightMasksSamplerblock	0x0683e340 {mMinFilter=FO_LINEAR (2) mMagFilter=FO_LINEAR (2) mMipFilter=FO_LINEAR (2) ...}	const NOWA_Engine_d.dll!Ogre::HlmsSamplerblock *
+		mAreaLights	{mData=0x00000000 {???} mSize=0 mCapacity=0 }	NOWA_Engine_d.dll!Ogre::FastArray<Ogre::Light *>
		mUsingAreaLightMasks	false	bool
		mSkipRequestSlotInChangeRS	false	bool
		mUsingLtcMatrix	false	bool
+		mLtcMatrixTexture	0x00000000 <NULL>	NOWA_Engine_d.dll!Ogre::TextureGpu *
		mDecalsDiffuseMergedEmissive	false	bool
+		mDecalsTextures	0x08106560 {0x00000000 <NULL>, 0x00000000 <NULL>, 0x00000000 <NULL>}	NOWA_Engine_d.dll!Ogre::TextureGpu *[3]
+		mDecalsSamplerblock	0x0683e340 {mMinFilter=FO_LINEAR (2) mMagFilter=FO_LINEAR (2) mMipFilter=FO_LINEAR (2) ...}	const NOWA_Engine_d.dll!Ogre::HlmsSamplerblock *
+		mLastBoundPool	0x00000000 <NULL>	const NOWA_Engine_d.dll!Ogre::ConstBufferPool::BufferPool *
		mHasSeparateSamplers	true	bool
+		mLastDescTexture	0x00000000 <NULL>	const NOWA_Engine_d.dll!Ogre::DescriptorSetTexture *
+		mLastDescSampler	0x00000000 <NULL>	const NOWA_Engine_d.dll!Ogre::DescriptorSetSampler *
		mReservedTexSlots	1 '\x1'	unsigned char
		mSetupWorldMatBuf	true	bool
		mDebugPssmSplits	false	bool
		mVctFullConeCount	false	bool
		mShadowFilter	PCF_2x2 (0)	NOWA_Engine_d.dll!Ogre::HlmsPbs::ShadowFilter
		mEsmK	600	unsigned short
		mAmbientLightMode	AmbientAuto (0)	NOWA_Engine_d.dll!Ogre::HlmsPbs::AmbientLightMode
+		Ogre::HlmsBufferManager	{mVaoManager=0x080c9900 {mVbos=0x080c9aa4 {0x080c9aa4 {{ size=2 }, { size=0 }, { size=0 }}, 0x080c9ad4 {...}, ...} ...} ...}	Ogre::HlmsBufferManager
+		Ogre::ConstBufferPool	{mPools={ size=1 } mBytesPerSlot=256 mSlotsPerPool=256 ...}	Ogre::ConstBufferPool
+		mPreparedPass	{shadowMaps={mData=0x18347460 {0x181eeb28 {mWidth=3722304989 mHeight=3722304989 mDepthOrSlices=3722304989 ...}} ...} ...}	Ogre::HlmsPbs::PassData
+		mPassBuffers	{ size=4 }	std::vector<Ogre::ConstBufferPacked *,Ogre::STLAllocator<Ogre::ConstBufferPacked *,Ogre::CategorisedAllocPolicy<0> > >
+		mShadowmapSamplerblock	0x00000000 <NULL>	const Ogre::HlmsSamplerblock *
+		mShadowmapCmpSamplerblock	0x0683e2f8 {mMinFilter=FO_LINEAR (2) mMagFilter=FO_LINEAR (2) mMipFilter=FO_NONE (0) ...}	const Ogre::HlmsSamplerblock *
+		mShadowmapEsmSamplerblock	0x0683e2b0 {mMinFilter=FO_LINEAR (2) mMagFilter=FO_LINEAR (2) mMipFilter=FO_NONE (0) ...}	const Ogre::HlmsSamplerblock *
+		mCurrentShadowmapSamplerblock	0x0683e2f8 {mMinFilter=FO_LINEAR (2) mMagFilter=FO_LINEAR (2) mMipFilter=FO_NONE (0) ...}	const Ogre::HlmsSamplerblock *
+		mParallaxCorrectedCubemap	0x00000000 <NULL>	Ogre::ParallaxCorrectedCubemapBase *
		mCurrentPassBuffer	4	unsigned int
+		mGridBuffer	0x18c50850 {mInternalFormat=DXGI_FORMAT_R16_UINT (57) mDevice={mD3D11Device=0x07d13de4 <Keine Informationen verfügbar. Für d3d11.dll wurden keine Symbole geladen.> ...} ...}	Ogre::TexBufferPacked * {RenderSystem_Direct3D11_d.dll!Ogre::D3D11TexBufferPacked}
+		mGlobalLightListBuffer	0x18c504a8 {mInternalFormat=DXGI_FORMAT_R32G32B32A32_FLOAT (2) mDevice={mD3D11Device=0x07d13de4 <Keine Informationen verfügbar. Für d3d11.dll wurden keine Symbole geladen.> ...} ...}	Ogre::TexBufferPacked * {RenderSystem_Direct3D11_d.dll!Ogre::D3D11TexBufferPacked}
		mTexUnitSlotStart	1	unsigned int
+		mPrePassTextures	0x189cb744 { size=0 }	const std::vector<Ogre::TextureGpu *,Ogre::STLAllocator<Ogre::TextureGpu *,Ogre::CategorisedAllocPolicy<0> > > *
+		mPrePassMsaaDepthTexture	0x00000000 <NULL>	Ogre::TextureGpu *
+		mSsrTexture	0x00000000 <NULL>	Ogre::TextureGpu *
+		mIrradianceVolume	0x02580000 {NOWA_Engine_d.dll!luabind::detail::pointer_holder<NOWA::CameraBehaviorBaseComponent *,void const >::release(void), Linie 111} {...}	Ogre::IrradianceVolume *
+		mVctLighting	0x00000000 <NULL>	Ogre::VctLighting *
+		mPlanarReflections	0x00000000 <NULL>	Ogre::PlanarReflections *
+		mPlanarReflectionsSamplerblock	0x0683e340 {mMinFilter=FO_LINEAR (2) mMagFilter=FO_LINEAR (2) mMipFilter=FO_LINEAR (2) ...}	const Ogre::HlmsSamplerblock *
		mHasPlanarReflections	false	bool
		mLastBoundPlanarReflection	0 '\0'	unsigned char
+		mAreaLightMasks	0x00000000 <NULL>	Ogre::TextureGpu *
+		mAreaLightMasksSamplerblock	0x0683e340 {mMinFilter=FO_LINEAR (2) mMagFilter=FO_LINEAR (2) mMipFilter=FO_LINEAR (2) ...}	const Ogre::HlmsSamplerblock *
+		mAreaLights	{mData=0x00000000 {???} mSize=0 mCapacity=0 }	Ogre::FastArray<Ogre::Light *>
		mUsingAreaLightMasks	false	bool
		mSkipRequestSlotInChangeRS	false	bool
		mUsingLtcMatrix	false	bool
+		mLtcMatrixTexture	0x00000000 <NULL>	Ogre::TextureGpu *
		mDecalsDiffuseMergedEmissive	false	bool
+		mDecalsTextures	0x08106560 {0x00000000 <NULL>, 0x00000000 <NULL>, 0x00000000 <NULL>}	Ogre::TextureGpu *[3]
+		mDecalsSamplerblock	0x0683e340 {mMinFilter=FO_LINEAR (2) mMagFilter=FO_LINEAR (2) mMipFilter=FO_LINEAR (2) ...}	const Ogre::HlmsSamplerblock *
+		mLastBoundPool	0x00000000 <NULL>	const Ogre::ConstBufferPool::BufferPool *
		mHasSeparateSamplers	true	bool
+		mLastDescTexture	0x00000000 <NULL>	const Ogre::DescriptorSetTexture *
+		mLastDescSampler	0x00000000 <NULL>	const Ogre::DescriptorSetSampler *
		mReservedTexSlots	1 '\x1'	unsigned char
		mSetupWorldMatBuf	true	bool
		mDebugPssmSplits	false	bool
		mVctFullConeCount	false	bool
		mShadowFilter	PCF_2x2 (0)	Ogre::HlmsPbs::ShadowFilter
		mEsmK	600	unsigned short
		mAmbientLightMode	AmbientAuto (0)	Ogre::HlmsPbs::AmbientLightMode
		ambientMode	AmbientHemisphere (2)	Ogre::HlmsPbs::AmbientLightMode
		areaLightNumber	3435973836	unsigned int
		areaLightNumMipmaps	-107374176.	float
		areaLightNumMipmapsSpecFactor	-107374176.	float
+		cameras	{renderingCamera=0x080a8600 {mSceneMgr=0x189cb400 {...} mOrientation={w=1.00000000 x=0.000000000 y=0.000000000 ...} ...} ...}	Ogre::CamerasInProgress
+		capabilities	0x068d9210 {mDriverVersion={major=25 minor=21 release=14 ...} mVendor=GPU_NVIDIA (1) mNumWorldMatrices=...}	const Ogre::RenderSystemCapabilities * {RenderSystem_Direct3D11_d.dll!Ogre::RenderSystemCapabilities}
		casterPass	false	bool
+		contiguousShadowMapTex	{ size=1 }	const std::vector<Ogre::TextureGpu *,Ogre::STLAllocator<Ogre::TextureGpu *,Ogre::CategorisedAllocPolicy<0> > > &
		dualParaboloid	false	bool
		envMapScale	1.00000000	const float
+		forwardPlus	0xcccccccc {mCachedGrid={ size=??? } mCurrentLightList={mData=??? mSize=??? mCapacity=??? } mLightCountInCell=...}	Ogre::ForwardPlusBase *
		fTexDepth	-107374176.	const float
		fTexHeight	-107374176.	const float
		fTexWidth	-107374176.	const float
+		globalLightList	{lights={mData=??? mSize=??? mCapacity=??? } visibilityMask=??? boundingSphere=??? }	const Ogre::LightListInfo &
+		invViewMatrix	{m=0x00f3e820 {0x00f3e820 {-107374176., -107374176., -107374176., -107374176.}, 0x00f3e830 {-107374176., ...}, ...} ...}	Ogre::Matrix4
+		invViewMatrixCubemap	{m=0x00f3e8dc {0x00f3e8dc {1.00000000, -0.000000000, -0.000000000}, 0x00f3e8e8 {-0.000000000, 1.00000000, ...}, ...} }	Ogre::Matrix3
+		irradianceCellSize	{x=-107374176. y=-107374176. z=-1.39028224e-36 }	Ogre::Vector3
+		irradianceVolumeOrigin	{x=1.00000000 y=1.00000000 z=inf }	Ogre::Vector3
		isCameraReflected	false	const bool
		isPssmBlend	true	bool
		isPssmFade	true	bool
		isShadowCastingPointLight	false	bool
+		lowerHemisphere	{r=0.600000024 g=0.449999988 b=0.300000012 ...}	Ogre::ColourValue
		mapSize	768	unsigned int
		maxBufferSize	16384	const unsigned int
		numAreaApproxFloat4Vars	7	const unsigned int
		numAreaApproxLights	0	int
		numAreaLtcFloat4Vars	7	const unsigned int
		numAreaLtcLights	0	int
		numDirectionalLights	1	int
		numLights	1	int
		numPssmBlendsAndFade	-858993460	int
		numPssmSplits	3	int
		numShadowMapLights	3	int
+		pass	0x18e05798 {mDefinition=0x182f4f50 {mVisibilityMask=1073741823 mLightVisibilityMask=1073741823 mShadowNode=...} ...}	const Ogre::CompositorPass * {OgreMain_d.dll!Ogre::CompositorPassScene}
+		passBuffer	0x26886e60 {mDevice={mD3D11Device=0x07d13de4 <Keine Informationen verfügbar. Für d3d11.dll wurden keine Symbole geladen.> ...} }	Ogre::ConstBufferPacked * {RenderSystem_Direct3D11_d.dll!Ogre::D3D11ConstBufferPacked}
+		passBufferPtr	0x11260200 {0.000000000}	float *
+		passSceneDef	0x182f4f50 {mVisibilityMask=1073741823 mLightVisibilityMask=1073741823 mShadowNode={mHash=3000289363 ...} ...}	const Ogre::CompositorPassSceneDef * {OgreMain_d.dll!Ogre::CompositorPassSceneDef}
+		projectionMatrix	{m=0x00f3ea78 {0x00f3ea78 {0.749999940, 0.000000000, 0.000000000, 0.000000000}, 0x00f3ea88 {0.000000000, ...}, ...} ...}	Ogre::Matrix4
		realNumAreaApproxLights	0	const unsigned int
		realNumAreaApproxLightsWithMask	0	const unsigned int
		realNumAreaLtcLights	0	const unsigned int
		realNumDirectionalLights	1	const unsigned int
+		renderPassDesc	0x187da808 {mColourRtv=0x187da9b4 {0x25db8580 {...}, 0x00000000 <NULL>, 0x00000000 <NULL>, 0x00000000 <NULL>, ...} ...}	Ogre::RenderPassDescriptor * {RenderSystem_Direct3D11_d.dll!Ogre::D3D11RenderPassDescriptor}
+		renderTarget	0x18e08b90 {mDepthBufferPoolId=1 mPreferDepthTexture=false mDesiredDepthBufferFormat=PFG_UNKNOWN (0) }	Ogre::TextureGpu * {RenderSystem_Direct3D11_d.dll!Ogre::D3D11TextureGpuRenderTarget}
+		retVal	{hash=3 type=HLMS_PBS (1) setProperties={ size=69 } ...}	Ogre::HlmsCache
+		sceneManager	0x189cb400 {...}	Ogre::SceneManager * {OgreMain_d.dll!Ogre::DefaultSceneManager}
		shadowMapTexIdx	3	unsigned int
+		shadowNode	0x18a582b0 {mDefinition=0x068f9e78 {mShadowMapTexDefinitions={ size=5 } mLightTypesMask={ size=3 } mDefaultTechnique=...} ...}	const Ogre::CompositorShadowNode * {OgreMain_d.dll!Ogre::CompositorShadowNode}
+		startupPtr	0x11260000 {0.749999940}	const float *
+		upperHemisphere	{r=0.300000012 g=0.500000000 b=0.699999988 ...}	Ogre::ColourValue
+		viewMatrix	{m=0x00f3eac0 {0x00f3eac0 {1.00000000, 0.000000000, 0.000000000, 0.000000000}, 0x00f3ead0 {0.000000000, ...}, ...} ...}	Ogre::Matrix4
+		viewMatrix3	{m=0x00f3e908 {0x00f3e908 {1.00000000, 0.000000000, 0.000000000}, 0x00f3e914 {0.000000000, 1.00000000, ...}, ...} }	Ogre::Matrix3
+		viewProjMatrix	{m=0x00f3e9d0 {0x00f3e9d0 {0.749999940, 0.000000000, 0.000000000, 0.000000000}, 0x00f3e9e0 {0.000000000, ...}, ...} ...}	Ogre::Matrix4
Stacktrace:

Code: Select all

 	OgreMain_d.dll!Ogre::TextureGpu::getWidth() Zeile 185	C++
>	OgreHlmsPbs_d.dll!Ogre::HlmsPbs::preparePassHash(const Ogre::CompositorShadowNode * shadowNode, bool casterPass, bool dualParaboloid, Ogre::SceneManager * sceneManager) Zeile 1695	C++
 	OgreMain_d.dll!Ogre::RenderQueue::renderPassPrepare(bool casterPass, bool dualParaboloid) Zeile 305	C++
 	OgreMain_d.dll!Ogre::SceneManager::_cullPhase01(Ogre::Camera * cullCamera, Ogre::Camera * renderCamera, const Ogre::Camera * lodCamera, Ogre::Viewport * vp, unsigned char firstRq, unsigned char lastRq, bool reuseCullData) Zeile 1216	C++
 	OgreMain_d.dll!Ogre::Camera::_cullScenePhase01(Ogre::Camera * renderCamera, const Ogre::Camera * lodCamera, Ogre::Viewport * vp, unsigned char firstRq, unsigned char lastRq, bool reuseCullData) Zeile 398	C++
 	OgreMain_d.dll!Ogre::Viewport::_updateCullPhase01(Ogre::Camera * renderCamera, Ogre::Camera * cullCamera, const Ogre::Camera * lodCamera, unsigned char firstRq, unsigned char lastRq, bool reuseCullData) Zeile 238	C++
 	OgreMain_d.dll!Ogre::CompositorPassScene::execute(const Ogre::Camera * lodCamera) Zeile 215	C++
 	OgreMain_d.dll!Ogre::CompositorNode::_update(const Ogre::Camera * lodCamera, Ogre::SceneManager * sceneManager) Zeile 892	C++
 	OgreMain_d.dll!Ogre::CompositorWorkspace::_update() Zeile 796	C++
 	OgreMain_d.dll!Ogre::CompositorManager2::_updateImplementation(Ogre::SceneManagerEnumerator & sceneManagers, Ogre::HlmsManager * hlmsManager) Zeile 727	C++
 	OgreMain_d.dll!Ogre::RenderSystem::updateCompositorManager(Ogre::CompositorManager2 * compositorManager, Ogre::SceneManagerEnumerator & sceneManagers, Ogre::HlmsManager * hlmsManager) Zeile 1357	C++
 	OgreMain_d.dll!Ogre::CompositorManager2::_update(Ogre::SceneManagerEnumerator & sceneManagers, Ogre::HlmsManager * hlmsManager) Zeile 654	C++
 	OgreMain_d.dll!Ogre::Root::_updateAllRenderTargets() Zeile 1578	C++
 	OgreMain_d.dll!Ogre::Root::renderOneFrame() Zeile 1100	C++
 	NOWA_Engine_d.dll!NOWA::AppStateManager::restrictedFPSRendering() Zeile 228	C++
 	NOWA_Engine_d.dll!NOWA::AppStateManager::start(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & applicationStateName, bool renderWhenInactive, bool restrictFps) Zeile 96	C++
 	NOWA_Design_d.exe!MainApplication::startSimulation(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & configName) Zeile 74	C++
 	NOWA_Design_d.exe!WinMain(HINSTANCE__ * hInst, HINSTANCE__ * __formal, char * strCmdLine, int __formal) Zeile 20	C++
 	[Externer Code]	
 	[Die unten aufgeführten Frames sind möglicherweise nicht korrekt und/oder fehlen, für "kernel32.dll" wurden keine Symbole geladen.]	Unbekannt

Re: [2.2] Where are the TextureTypes?

Posted: Tue May 28, 2019 4:23 pm
by al2950
This just reminded me of a memory problem I had, and it was to do with creating an object with 'new' and deleting with 'OGRE_DELETE' or vice versa. Specifically it was to do with creating a custom pass which i did with 'new CustomPass', but Ogre would delete it so it would use OGRE_DELETE. I think Ogre's default allocators have changed now and are more sensible so it might not be a problem but might be work checking out.

Failing that run your engine in debug, it might be painfully slow but I am sure something will pop out, if not an obvious error, at least an indication.

Re: [2.2] Where are the TextureTypes?

Posted: Tue May 28, 2019 4:35 pm
by dark_sylinc
If you have a linux build, run valgrind.

If you dont't, try rebuilding Ogre with OGRE_CONFIG_ALLOCATOR set to 5.
It will eventually run out of memory (it's by design) but it may help you catch corruption errors before that happens (else try modifying OGRE_TRACK_POOL_SIZE and rebuild) by setting malloc guards.

Re: [2.2] Where are the TextureTypes?

Posted: Tue May 28, 2019 4:39 pm
by rujialiu
Lax wrote: Tue May 28, 2019 3:57 pm But that did no help. Its really strange, as HlmsPbs will be suddenly corrupted. See memory snapshot:
I seem VctLighting so you're using vct branch? Anyway, if you don't use VCT, that branch is also stable enough.

So it looks like mIrradianceVolume is always non-null when corrupted? So you can first check that it's indeed zero AT STARTUP, and then place a data-breakpoint in Visual Studio so that when it changes, the breakpoint is hit

BTW: mIrradianceVolume says it's a "luabind::detail::pointer_holder<NOWA::CameraBehaviorBaseComponent *" blah blah... ??? Maybe you can check whether pbs is corrupted (just check mIrradianceVolume) just BEFORE and just AFTER initialize your lua system.

Re: [2.2] Where are the TextureTypes?

Posted: Tue May 28, 2019 8:25 pm
by al2950
rujialiu wrote: Tue May 28, 2019 4:39 pm I seem VctLighting so you're using vct branch? Anyway, if you don't use VCT, that branch is also stable enough.
Huh, well its stable ish, but when porting I would definitely start with the stable v2-2-WIP. Also all the samples are commented out in CMake for the VCT branch which is why you could not find any samples :lol:

Mind you I am not sure why they are commented out... dark_sylinc :?:

Re: [2.2] Where are the TextureTypes?

Posted: Tue May 28, 2019 9:02 pm
by dark_sylinc
al2950 wrote: Tue May 28, 2019 8:25 pm Mind you I am not sure why they are commented out... dark_sylinc :?:
It's just so that the samples I am interested in build faster (make a change in core -> all samples get relinked at least). That "comment out" snipped wasn't supposed to be commited and pushed, but got into the repo by accident.
Reverting it would only pollute the logs and I am sure it would happen by accident again, so I just left it until I am done and merge the two branches into one.

Re: [2.2] Where are the TextureTypes?

Posted: Wed May 29, 2019 10:04 am
by Lax
Also all the samples are commented out in CMake for the VCT branch which is why you could not find any samples :lol:
Yeah, i figured that out.
but when porting I would definitely start with the stable v2-2-WIP
I updated to v2-2-WIP branch.

Code: Select all

So it looks like mIrradianceVolume is always non-null when corrupted? So you can first check that it's indeed zero AT STARTUP, and then place a data-breakpoint in Visual Studio so that when it changes, the breakpoint is hit
Thanks for the tip. I seldom used data break points and forgot how to use it properly in visual studio. But it worked!
I found the place.
In the function, in which I set shadow quality, I also set some special pbs, unlit settings:

Code: Select all

this->pbs->setEsmK(600);
this->unlit->setEsmK(600);
this->unlit->setShadowSettings(false);
This settings seem to corrupt HlmsPbs, as the data break point became active. When I comment out those function. It does work now :D
Thanks you!


Now I encounter the next issue:
When I create a Ogre::v1::Entity in my editor to place a mesh into the scene. I get an error within "renderOneFrame" in function:

Code: Select all

ID3D11PixelShader* D3D11HLSLProgram::getPixelShader(void) const 
    { 
        assert(mType == GPT_FRAGMENT_PROGRAM);
        assert(mPixelShader);
        return mPixelShader; 
    }
Because the mPixelShader is nullptr. It does not matter, which Entity mesh I use.

Log:

Code: Select all

11:36:20: OGRE EXCEPTION(-2147467259:RenderingAPIException): Cannot compile D3D11 high-level shader 100000001PixelShader_ps Errors:
(661,23): error X3004: undeclared identifier 'samplerState4'
 in D3D11HLSLProgram::compileMicrocode at h:\gameenginedevelopment2_2\external\ogre2.2sdk\rendersystems\direct3d11\src\ogred3d11hlslprogram.cpp (line 558)
11:36:20: High-level program 100000001PixelShader_ps encountered an error during loading and is thus not supported.
OGRE EXCEPTION(-2147467259:RenderingAPIException): Cannot compile D3D11 high-level shader 100000001PixelShader_ps Errors:
(661,23): error X3004: undeclared identifier 'samplerState4'
 in D3D11HLSLProgram::compileMicrocode at h:\gameenginedevelopment2_2\external\ogre2.2sdk\rendersystems\direct3d11\src\ogred3d11hlslprogram.cpp (line 558)
I investigated the pixelshader debug code.

Code: Select all

SamplerState samplerState2 : register(s2);
Is registered, but later:

Code: Select all

/// DIFFUSE MAP
	
		pixelData.diffuse = SampleDiffuse( textureMaps0,
										   samplerState4,
										   UV_DIFFUSE( inPs.uv0.xy ),
										   texIndex_diffuseIdx );
samplerState4 is used.

I definitely using the newst Hlms resources.

What could that be?

Best Regards
Lax

Re: [2.2] Where are the TextureTypes?

Posted: Wed May 29, 2019 3:51 pm
by rujialiu
Lax wrote: Wed May 29, 2019 10:04 am This settings seem to corrupt HlmsPbs, as the data break point became active. When I comment out those function. It does work now :D
Thanks you!
Strange... but I didn't set these things in Unlit so it could be indeed broken 8-)
Lax wrote: Wed May 29, 2019 10:04 am samplerState4 is used.
Unfortunately I'm not using v1::Entity at all, so I'm not sure if the legacy material's shader is broken (most probably due to the shader refactor introduced in Ogre 2.2. But I REALLY liked the refactor, because it makes shader codes so much easier to understand and manage)

but even it is broken, it should be easy to fix. You can enable HlmsDebug to add a bunch of debug information (definitions and pieces) before the generated hlsl code then with some analysis you can know whether it's due to bug in hlms template, OR the C++ code sets some properties incorrectly.

Also, you can try to make a simple repro based on one of the samples, then whoever had some time can investigate this easily.

Re: [2.2] Where are the TextureTypes?

Posted: Wed May 29, 2019 3:52 pm
by dark_sylinc
Lax wrote: Wed May 29, 2019 10:04 am

Code: Select all

this->pbs->setEsmK(600);
this->unlit->setEsmK(600);
this->unlit->setShadowSettings(false);
This settings seem to corrupt HlmsPbs, as the data break point became active. When I comment out those function. It does work now :D
Thanks you!
There's 2 possibilities on why that would fail:
  1. Unlit or Pbs are incorrectly casted (e.g. your unlit variable is HlmsPbs* instead of HlmsUnlit*)
  2. Your DLLs, libs or headers are out of sync. The version of Ogre in your headers does not correspond with the version of Ogre LIB (Visual Studio *.lib files) or DLL your app is loading

Re: [2.2] Where are the TextureTypes?

Posted: Sat Jun 01, 2019 12:11 pm
by Lax
Got it working :D
There was something wrong within hlms register function in my code. I registered by accident the same pbs folder path twice.

Thank you all very much, for helping me out!

Ogre2.2 is fantastic! No matter how many resources are now loaded (on my GameEngine there are approx. 1000), the loading time is really fast!

Best Regards
Lax

Re: [2.2] Where are the TextureTypes?

Posted: Sat Jun 01, 2019 12:27 pm
by Lax
Found another issue.
When I clone a datablock:

Code: Select all

this->datablock = dynamic_cast<Ogre::HlmsPbsDatablock*>(this->originalDatablock->clone(this->originalDataBlockName
				+ Ogre::StringConverter::toString(this->gameObjectPtr->getId())));
entity->getSubEntity(this->subEntityIndex->getUInt())->setDatablock(this->datablock);
to work with that one for an entity. I get another PixelShader error:

Code: Select all

13:23:32: [DatablockPbsComponent] Init datablock pbs component for game object: box2Up_0
13:23:40: OGRE EXCEPTION(-2147467259:RenderingAPIException): Cannot compile D3D11 high-level shader 100000005PixelShader_ps Errors:
H:\GameEngineDevelopment2_2\bin\Debug\100000005PixelShader_ps.hlsl(725,35-62): error X4000: variable 'pixelData' used without having been completely initialized
 in D3D11HLSLProgram::compileMicrocode at h:\gameenginedevelopment2_2\external\ogre2.2sdk\rendersystems\direct3d11\src\ogred3d11hlslprogram.cpp (line 558)
13:23:40: High-level program 100000005PixelShader_ps encountered an error during loading and is thus not supported.
OGRE EXCEPTION(-2147467259:RenderingAPIException): Cannot compile D3D11 high-level shader 100000005PixelShader_ps Errors:
H:\GameEngineDevelopment2_2\bin\Debug\100000005PixelShader_ps.hlsl(725,35-62): error X4000: variable 'pixelData' used without having been completely initialized
 in D3D11HLSLProgram::compileMicrocode at h:\gameenginedevelopment2_2\external\ogre2.2sdk\rendersystems\direct3d11\src\ogred3d11hlslprogram.cpp (line 558)
When I do not clone the datablock, but set data for the original one. Everything works fine. So it has something todo with the clone function.

Best Regards
Lax

Re: [2.2] Where are the TextureTypes?

Posted: Mon Jun 03, 2019 9:03 pm
by Lax
Hi all,

I have another issue besides the cloning.
When I load a dot scene. The second mesh that is loaded, always produces an exception:

Code: Select all

21:56:21: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource _rt. in resource group Autodetect or any other group. in ResourceGroupManager::_getArchiveToResource at h:\gameenginedevelopment2_2\external\ogre2.2sdk\ogremain\src\ogreresourcegroupmanager.cpp (line 874)
21:56:24: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource _rt. in resource group Autodetect or any other group. in ResourceGroupManager::_getArchiveToResource at h:\gameenginedevelopment2_2\external\ogre2.2sdk\ogremain\src\ogreresourcegroupmanager.cpp (line 874)
21:56:24: Couldn't apply datablock 'WhiteLine' to this renderable. Using default one. Check previous log messages to see if there's more information.
The funny thing is, that the first mesh, has also the datablock "WhiteLine", which is a simple data block. I also tried with other meshes and other datablocks, but it does not matter. Somehow in the class "OgreHlmsTextureBaseClass.inl":

Code: Select all

for( int i=0; i<OGRE_HLMS_TEXTURE_BASE_MAX_TEX; ++i )
        {
            if( mTextures[i] )
                mTextures[i]->scheduleTransitionTo( GpuResidency::Resident );
        }
The last index of the array has a texture, which is of unknown type. I have no idea where that comes from. And what is the resource "_rt"? I do not have such an resource.

When I create a new project in my application and place the meshes, everything works fine.
I nearly excluded everything and I'm desperate, because I have no idea where that comes from. The ugly thing is, that my application cannot be exited, because it will hang when:

Code: Select all

21:56:52: Uninstalling plugin: D3D11 RenderSystem
is called.

I hope someone has an idea.

Best Regards
Lax

Re: [2.2] Where are the TextureTypes?

Posted: Tue Jun 04, 2019 1:43 pm
by rujialiu
Lax wrote: Sat Jun 01, 2019 12:27 pm

Code: Select all

13:23:32: [DatablockPbsComponent] Init datablock pbs component for game object: box2Up_0
13:23:40: OGRE EXCEPTION(-2147467259:RenderingAPIException): Cannot compile D3D11 high-level shader 100000005PixelShader_ps Errors:
H:\GameEngineDevelopment2_2\bin\Debug\100000005PixelShader_ps.hlsl(725,35-62): error X4000: variable 'pixelData' used without having been completely initialized
 in D3D11HLSLProgram::compileMicrocode at h:\gameenginedevelopment2_2\external\ogre2.2sdk\rendersystems\direct3d11\src\ogred3d11hlslprogram.cpp (line 558)
13:23:40: High-level program 100000005PixelShader_ps encountered an error during loading and is thus not supported.
OGRE EXCEPTION(-2147467259:RenderingAPIException): Cannot compile D3D11 high-level shader 100000005PixelShader_ps Errors:
H:\GameEngineDevelopment2_2\bin\Debug\100000005PixelShader_ps.hlsl(725,35-62): error X4000: variable 'pixelData' used without having been completely initialized
 in D3D11HLSLProgram::compileMicrocode at h:\gameenginedevelopment2_2\external\ogre2.2sdk\rendersystems\direct3d11\src\ogred3d11hlslprogram.cpp (line 558)
Can you enable HlmsDebug and post the parameters/pieces BEFORE the real generated hlsl shader code? I haven't cloned any datablock but this kind of shader compilation error should be solvable by looking at HlmsDebug info.

Re: [2.2] Where are the TextureTypes?

Posted: Tue Jun 04, 2019 1:49 pm
by rujialiu
Lax wrote: Mon Jun 03, 2019 9:03 pm The last index of the array has a texture, which is of unknown type. I have no idea where that comes from. And what is the resource "_rt"? I do not have such an resource.
It looks like some kind of rendertarget... Are you using your won workspace, render to some texture and use it in a datablock?

Anyway, you can implement a resource listener (we're using it for custom resource loading, like loading meshes from database) and write some codes like "if(name == "_rt") { ..." then add a breakpoint inside. Then, by looking at the stacktrace you'll know where did the "_rt" thing come from.

Re: [2.2] Where are the TextureTypes?

Posted: Tue Jun 04, 2019 8:24 pm
by Lax
Hi rujialiu,

Thanks for your answer.

How can I enable HlmsDebug?
or do you mean:
hlmsPbs->setDebugOutputPath(true, true);
hlmsUnlit->setDebugOutputPath(true, true);
hlmsTerra->setDebugOutputPath(true, true);
I also changed the workspace to the simplest possible (pbsMaterial.compositor), but that did not help.
Anyway, you can implement a resource listener
Do you have an example how to use one?

Best Regards
Lax