[SOLVED] Only SHADOWTYPE_STENCIL_ADDITIVE works ?

Get answers to all your basic programming questions. No Ogre questions, please!
Post Reply
Ogra
Goblin
Posts: 268
Joined: Mon Feb 04, 2013 1:34 pm

[SOLVED] Only SHADOWTYPE_STENCIL_ADDITIVE works ?

Post by Ogra »

Hello,

I had try the TutorialBasic2 (http://www.ogre3d.org/tikiwiki/tiki-ind ... =Tutorials) but I see only shadows when I set :

Code: Select all

mSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);


All the other shadowtypes don´t work or what happened?
Last edited by Ogra on Tue Mar 19, 2013 7:51 am, edited 1 time in total.
Ogra
Goblin
Posts: 268
Joined: Mon Feb 04, 2013 1:34 pm

Re: Only SHADOWTYPE_STENCIL_ADDITIVE works ?

Post by Ogra »

This is my Code:

Code: Select all

void BasicTutorial2::createCamera(void)
{
    // create the camera
    mCamera = mSceneMgr->createCamera("PlayerCam");
    // set its position, direction  
    mCamera->setPosition(Ogre::Vector3(0,100,500));
    mCamera->lookAt(Ogre::Vector3(0,0,0));
    // set the near clip distance
    mCamera->setNearClipDistance(5);
 
    mCameraMan = new OgreBites::SdkCameraMan(mCamera);   // create a default camera controller
}
//-------------------------------------------------------------------------------------
void BasicTutorial2::createViewports(void)
{
    // Create one viewport, entire window
    Ogre::Viewport* vp = mWindow->addViewport(mCamera);
    vp->setBackgroundColour(Ogre::ColourValue(0,0,0));
    // Alter the camera aspect ratio to match the viewport
    mCamera->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));    
}
//-------------------------------------------------------------------------------------
void BasicTutorial2::createScene(void)
{
    mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5));
	mSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_ADDITIVE);
	//mSceneMgr->setShowDebugShadows(true);
 
    Ogre::Entity* entNinja = mSceneMgr->createEntity("Ninja", "ninja.mesh");
	Ogre::SceneNode* ninjaNode= mSceneMgr->getRootSceneNode()->createChildSceneNode("NinjaNode");
    entNinja->setCastShadows(true);
	
	ninjaNode->attachObject(entNinja);
	ninjaNode->yaw(Ogre::Degree(-90));
 
    Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0);
 
    Ogre::MeshManager::getSingleton().createPlane("ground", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
        plane, 1500, 1500, 20, 20, true, 1, 5, 5, Ogre::Vector3::UNIT_Z);
 
    Ogre::Entity* entGround = mSceneMgr->createEntity("GroundEntity", "ground");
    mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(entGround);
    entGround->setCastShadows(false);

    Ogre::Light* pointLight = mSceneMgr->createLight("pointLight"); //vorderer Schatten
    pointLight->setType(Ogre::Light::LT_POINT);
    pointLight->setPosition(Ogre::Vector3(0, 150, 250));
 
    pointLight->setDiffuseColour(1.0, 0.0, 0.0);
    pointLight->setSpecularColour(1.0, 0.0, 0.0);
	pointLight->setCastShadows(true);
 
    Ogre::Light* directionalLight = mSceneMgr->createLight("directionalLight");  //hinterer Schatten
    directionalLight->setType(Ogre::Light::LT_DIRECTIONAL);
    directionalLight->setDiffuseColour(Ogre::ColourValue(.25, .25, 0));
    directionalLight->setSpecularColour(Ogre::ColourValue(.25, .25, 0));
 
    directionalLight->setDirection(Ogre::Vector3( 0, -1, 1 )); 

	directionalLight->setCastShadows(true);
 
    Ogre::Light* spotLight = mSceneMgr->createLight("spotLight"); //seitlicher Schatten
    spotLight->setType(Ogre::Light::LT_SPOTLIGHT);
    spotLight->setDiffuseColour(0, 0, 1.0);
    spotLight->setSpecularColour(0, 0, 1.0);
 
    spotLight->setDirection(-1, -1, 0);
    spotLight->setPosition(Ogre::Vector3(300, 300, 0));
 
    spotLight->setSpotlightRange(Ogre::Degree(35), Ogre::Degree(50));
	spotLight->setCastShadows(true);
}
Here are pics for the shadowtypes with my results.
Attachments
Texture_additive
Texture_additive
Texture_additivePNG.PNG (51.18 KiB) Viewed 2529 times
Stencik_modulative
Stencik_modulative
Stencil_modulative.PNG (44.44 KiB) Viewed 2529 times
Stencil_additive
Stencil_additive
Stencil_additive.PNG (36.36 KiB) Viewed 2529 times
drwbns
Orc Shaman
Posts: 788
Joined: Mon Jan 18, 2010 6:06 pm
Location: Costa Mesa, California
x 24

Re: Only SHADOWTYPE_STENCIL_ADDITIVE works ?

Post by drwbns »

What hardware are you running with?
Ogra
Goblin
Posts: 268
Joined: Mon Feb 04, 2013 1:34 pm

Re: Only SHADOWTYPE_STENCIL_ADDITIVE works ?

Post by Ogra »

Device Name: Intel(R) G41 Express Chipset

That is in my Ogre Log :
CPU Identifier & Features
07:34:47: -------------------------
07:34:47: * CPU ID: GenuineIntel: Pentium(R) Dual-Core CPU E5700 @ 3.00GHz
07:34:47: * SSE: yes
07:34:47: * SSE2: yes
07:34:47: * SSE3: yes
07:34:47: * MMX: yes
07:34:47: * MMXEXT: yes
07:34:47: * 3DNOW: no
07:34:47: * 3DNOWEXT: no
07:34:47: * CMOV: yes
07:34:47: * TSC: yes
07:34:47: * FPU: yes
07:34:47: * PRO: yes
07:34:47: * HT: no

07:34:47: GL_VERSION = 2.1.0 - Build 8.15.10.2302
07:34:47: GL_VENDOR = Intel
07:34:47: GL_RENDERER = Intel(R) G41 Express Chipset

RenderSystem Name: OpenGL Rendering Subsystem
07:34:47: GPU Vendor: intel
07:34:47: Device Name: Intel(R) G41 Express Chipset
07:34:47: Driver Version: 2.1.0.0
07:34:47: * Fixed function pipeline: yes
07:34:47: * Hardware generation of mipmaps: no
07:34:47: * Texture blending: yes
07:34:47: * Anisotropic texture filtering: yes
07:34:47: * Dot product texture operation: yes
07:34:47: * Cube mapping: yes
07:34:47: * Hardware stencil buffer: yes
07:34:47: - Stencil depth: 8
07:34:47: - Two sided stencil support: yes
07:34:47: - Wrap stencil values: yes
07:34:47: * Hardware vertex / index buffers: yes
07:34:47: * Vertex programs: yes
07:34:47: * Number of floating-point constants for vertex programs: 256
07:34:47: * Number of integer constants for vertex programs: 0
07:34:47: * Number of boolean constants for vertex programs: 0
07:34:47: * Fragment programs: yes
07:34:47: * Number of floating-point constants for fragment programs: 256
07:34:47: * Number of integer constants for fragment programs: 0
07:34:47: * Number of boolean constants for fragment programs: 0
07:34:47: * Geometry programs: no
07:34:47: * Number of floating-point constants for geometry programs: 0
07:34:47: * Number of integer constants for geometry programs: 0
07:34:47: * Number of boolean constants for geometry programs: 0
07:34:47: * Supported Shader Profiles: arbfp1 arbvp1 glsl
07:34:47: * Texture Compression: yes
07:34:47: - DXT: yes
07:34:47: - VTC: no
07:34:47: - PVRTC: no
07:34:47: * Scissor Rectangle: yes
07:34:47: * Hardware Occlusion Query: yes
07:34:47: * User clip planes: yes
07:34:47: * VET_UBYTE4 vertex element type: yes
07:34:47: * Infinite far plane projection: yes
07:34:47: * Hardware render-to-texture: yes
07:34:47: * Floating point textures: yes
07:34:47: * Non-power-of-two textures: yes
07:34:47: * Volume textures: yes
07:34:47: * Multiple Render Targets: 8
07:34:47: - With different bit depths: yes
07:34:47: * Point Sprites: yes
07:34:47: * Extended point parameters: yes
07:34:47: * Max Point Size: 255
07:34:47: * Vertex texture fetch: yes
07:34:47: * Number of world matrices: 0
07:34:47: * Number of texture units: 16
07:34:47: * Stencil buffer depth: 8
07:34:47: * Number of vertex blend matrices: 0
07:34:47: - Max vertex textures: 16
07:34:47: - Vertex textures shared: yes
07:34:47: * Render to Vertex Buffer : no
07:34:47: * GL 1.5 without VBO workaround: no
07:34:47: * Frame Buffer objects: yes
07:34:47: * Frame Buffer objects (ARB extension): no
07:34:47: * Frame Buffer objects (ATI extension): no
07:34:47: * PBuffer support: yes
07:34:47: * GL 1.5 without HW-occlusion workaround: no
07:34:47: * Separate shader objects: no
You need mpore Informations?
Ogra
Goblin
Posts: 268
Joined: Mon Feb 04, 2013 1:34 pm

Re: Only SHADOWTYPE_STENCIL_ADDITIVE works ?

Post by Ogra »

I don´t know why asking for my hardware and then not ansewar. But now I have got an nvida card and all shadows work fine.
Post Reply