From bc7876e980fb4093a1274e953e12981f6d66ace9 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 23 Jul 2012 13:04:48 +0200 Subject: [PATCH 1/4] use alpha map for moons --- files/materials/moon.shader | 9 ++++----- files/materials/sky.mat | 5 +++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/files/materials/moon.shader b/files/materials/moon.shader index 7640563cef..02f3d80012 100644 --- a/files/materials/moon.shader +++ b/files/materials/moon.shader @@ -20,6 +20,7 @@ SH_BEGIN_PROGRAM shSampler2D(diffuseMap) + shSampler2D(alphaMap) shInput(float2, UV) #if MRT shDeclareMrtOutput(1) @@ -36,17 +37,15 @@ shOutputColour(0) = float4(materialEmissive.xyz, 1) * tex; - // use a circle for the alpha (compute UV distance to center) - // looks a bit bad because it's not filtered on the edges, - // but cheaper than a seperate alpha texture. - float sqrUVdist = pow(UV.x-0.5,2) + pow(UV.y-0.5, 2); - shOutputColour(0).a = materialDiffuse.a * (sqrUVdist >= 0.24 ? 0 : 1); + shOutputColour(0).a = shSample(alphaMap, UV).a * materialDiffuse.a; + shOutputColour(0).rgb += (1-tex.a) * shOutputColour(0).a * atmosphereColour.rgb; //fill dark side of moon with atmosphereColour shOutputColour(0).rgb += (1-materialDiffuse.a) * atmosphereColour.rgb; //fade bump #if MRT shOutputColour(1) = float4(1,1,1,1); #endif + } #endif diff --git a/files/materials/sky.mat b/files/materials/sky.mat index 17da7fc130..4af90a170b 100644 --- a/files/materials/sky.mat +++ b/files/materials/sky.mat @@ -15,6 +15,11 @@ material openmw_moon { texture_alias $texture } + + texture_unit alphaMap + { + direct_texture textures\tx_secunda_full.dds + } } } From afe7c4172906c39e4f2e9ad9b48141da5ad026ce Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 23 Jul 2012 13:47:51 +0200 Subject: [PATCH 2/4] removed some unused code --- apps/openmw/mwrender/water.cpp | 4 ++++ apps/openmw/mwrender/water.hpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index 1c0afab67e..3aff334d15 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -71,6 +71,7 @@ Water::Water (Ogre::Camera *camera, RenderingManager* rend, const ESM::Cell* cel mWater->setMaterial(mMaterial); + /* Ogre::Entity* underwaterDome = mSceneManager->createEntity ("underwater_dome.mesh"); underwaterDome->setRenderQueueGroup (RQG_UnderWater); mUnderwaterDome = mSceneManager->getRootSceneNode ()->createChildSceneNode (); @@ -78,6 +79,7 @@ Water::Water (Ogre::Camera *camera, RenderingManager* rend, const ESM::Cell* cel mUnderwaterDome->setScale(10000,10000,10000); mUnderwaterDome->setVisible(false); underwaterDome->setMaterialName("Underwater_Dome"); + */ mSceneManager->addRenderQueueListener(this); @@ -309,9 +311,11 @@ void Water::renderQueueEnded (Ogre::uint8 queueGroupId, const Ogre::String &invo void Water::update(float dt) { + /* Ogre::Vector3 pos = mCamera->getDerivedPosition (); pos.y = -mWaterPlane.d; mUnderwaterDome->setPosition (pos); + */ mWaterTimer += dt / 30.0 * MWBase::Environment::get().getWorld()->getTimeScaleFactor(); sh::Factory::getInstance ().setSharedParameter ("waterTimer", sh::makeProperty(new sh::FloatValue(mWaterTimer))); diff --git a/apps/openmw/mwrender/water.hpp b/apps/openmw/mwrender/water.hpp index 60e39c4966..d0a5a43522 100644 --- a/apps/openmw/mwrender/water.hpp +++ b/apps/openmw/mwrender/water.hpp @@ -43,7 +43,7 @@ namespace MWRender { Ogre::SceneNode *mWaterNode; Ogre::Entity *mWater; - Ogre::SceneNode* mUnderwaterDome; + //Ogre::SceneNode* mUnderwaterDome; bool mIsUnderwater; bool mActive; From 2eca27bba9b7649f939acaf66bbcd0755bea81e6 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 23 Jul 2012 14:21:40 +0200 Subject: [PATCH 3/4] fix horizon color of the sky reflection --- apps/openmw/mwrender/renderingmanager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 852288d146..b535cb6aee 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -368,6 +368,9 @@ void RenderingManager::configureFog(MWWorld::Ptr::CellStore &mCell) color.setAsABGR (mCell.cell->ambi.fog); configureFog(mCell.cell->ambi.fogDensity, color); + + if (mWater) + mWater->setViewportBackground (Ogre::ColourValue(0.8f, 0.9f, 1.0f)); } void RenderingManager::configureFog(const float density, const Ogre::ColourValue& colour) @@ -382,6 +385,9 @@ void RenderingManager::configureFog(const float density, const Ogre::ColourValue mRendering.getCamera()->setFarClipDistance ( max / density ); mRendering.getViewport()->setBackgroundColour (colour); + if (mWater) + mWater->setViewportBackground (colour); + sh::Factory::getInstance ().setSharedParameter ("viewportBackground", sh::makeProperty (new sh::Vector3(colour.r, colour.g, colour.b))); From ac5bd38df9522da88932725e62d9859720f8fc75 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 23 Jul 2012 14:59:57 +0200 Subject: [PATCH 4/4] some cmake fixes --- CMakeLists.txt | 6 +----- extern/shiny | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c0b5bf4511..f124f1383e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -189,14 +189,10 @@ endif() set(BOOST_COMPONENTS system filesystem program_options thread) if (Boost_VERSION LESS 104900) - set(SHINY_USE_WAVE_SYSTEM_INSTALL TRUE) + set(SHINY_USE_WAVE_SYSTEM_INSTALL "TRUE") set(BOOST_COMPONENTS ${BOOST_COMPONENTS} wave) -else() - set(SHINY_USE_WAVE_SYSTEM_INSTALL FALSE) endif() -MESSAGE(STATUS ${BOOST_COMPONENTS}) - find_package(OGRE REQUIRED) find_package(MyGUI REQUIRED) find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS}) diff --git a/extern/shiny b/extern/shiny index 41245d1361..73ddc737ce 160000 --- a/extern/shiny +++ b/extern/shiny @@ -1 +1 @@ -Subproject commit 41245d1361bc0242e5d2c2313caffb711207e5fc +Subproject commit 73ddc737ce6334b264649fd4b0a16109fd8b8a99