Normal Mapping Problem in RTSS

Problems building or running the engine, queries about how to use features etc.
Post Reply
Whisperd130
Halfling
Posts: 77
Joined: Wed Feb 01, 2017 4:02 pm
x 1

Normal Mapping Problem in RTSS

Post by Whisperd130 »

The program is running with RTSS, but I can't see the normal mapping, and the entity shows black.

Here is RT Shader initialization:

Code: Select all

initialiseRTShaderSystem()
	if (Ogre::RTShader::ShaderGenerator::initialize())
	{
		mShaderGenerator = Ogre::RTShader::ShaderGenerator::getSingletonPtr();		
		mShaderGenerator->addSceneManager(mSceneMgr);

		// Core shader libs not found -> shader generating will fail.
		if (mRTShaderLibPath.empty())
			return false;

		// Create and register the material manager listener if it doesn't exist yet.
		if (!mMaterialMgrListener) {
			mMaterialMgrListener = new OgreBites::SGTechniqueResolverListener(mShaderGenerator);
			Ogre::MaterialManager::getSingleton().addListener(mMaterialMgrListener);
		}
	}

	return true;
#else
	return false;
The mesh I use is ShaderSystem.mesh, which just in the Sample_ShaderSystem.
Here I create entity

Code: Select all

			// load each mesh with non-default hardware buffer usage options
			Ogre::MeshPtr mesh = Ogre::MeshManager::getSingleton().load(MAIN_ENTITY_MESH,
				Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
				Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY,
				Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY,
				true, true);
			// build tangent vectors for our mesh
			unsigned short src, dest;
			if (!mesh->suggestTangentVectorBuildParams(Ogre::VES_TANGENT, src, dest))
			{
				mesh->buildTangentVectors(Ogre::VES_TANGENT, src, dest);
				// this version cleans mirrored and rotated UVs but requires quality models
				//mesh->buildTangentVectors(Ogre::VES_TANGENT, src, dest, true, true);
			}
			// create entity
			entity = mSceneMgr->createEntity("PerPixelEntity", MAIN_ENTITY_MESH);
			entity->setMaterialName(MAIN_MATERIAL_NAME_TEST);
			childNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
			childNode->setPosition(0.0, 0.0, 0.0);
			childNode->attachObject(entity);
			// Grab the render state of the material.
			Ogre::RTShader::RenderState* renderState = mShaderGenerator->getRenderState(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME, "RTSS/LayeredBlending", 0);

			if (renderState != NULL)
			{
				const Ogre::RTShader::SubRenderStateList& subRenderStateList = renderState->getTemplateSubRenderStateList();
				Ogre::RTShader::SubRenderStateListConstIterator it = subRenderStateList.begin();
				Ogre::RTShader::SubRenderStateListConstIterator itEnd = subRenderStateList.end();

				// Search for the texture layer blend sub state.
				for (; it != itEnd; ++it)
				{
					Ogre::RTShader::SubRenderState* curSubRenderState = *it;

					if (curSubRenderState->getType() == Ogre::RTShader::LayeredBlending::Type)
					{
						mLayerBlendSubRS = static_cast<Ogre::RTShader::LayeredBlending*>(curSubRenderState);
						break;
					}
				}
			}

			vp->setMaterialScheme(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
This is what I see now.
Image

And this is what I want to be
Image
Is there anything else I need to do after these steps?
Whisperd130
Halfling
Posts: 77
Joined: Wed Feb 01, 2017 4:02 pm
x 1

Re: Normal Mapping Problem in RTSS

Post by Whisperd130 »

Well when I check the log of Ogre, it has several errors.

Code: Select all

Ogre: High-level program 'Ogre/RTShader/shadow_caster_skinning_4weight_vs' is not supported: Unable to compile Cg program Ogre/RTShader/shadow_caster_skinning_4weight_vs: The compile returned an error.
<invalid atom 65535>(88) : warning C7019: "blendWgt" is too large for semantic "BLENDWEIGHT", which is size 1
<invalid atom 65535>(91) : error C5041: cannot locate suitable resource to bind parameter "<null atom>"
<invalid atom 65535>(91) : error C5041: cannot locate suitable resource to bind parameter "<null atom>"
Ogre: Compiler error: invalid parameters in HardwareSkinningShadow.material(73): setting of constant failed
Ogre: Parsing script RTShaderSystem.material
Ogre: Compiler error: unknown error in RTShaderSystem.material(23): token "rtshader_system" is not recognized
Ogre: Compiler error: unknown error in RTShaderSystem.material(52): token "rtshader_system" is not recognized
What happens here~?
Post Reply