Any way to get Multiple lights affecting Terrain? [SOLVED]
-
- Greenskin
- Posts: 115
- Joined: Thu Jun 09, 2011 5:41 am
- Location: Melbourne, Australia
- x 5
Any way to get Multiple lights affecting Terrain? [SOLVED]
Hi,
I've been using Ogre's terrain quite happily with one directional light which generates shadows exactly like in Tutorial 3.
But I'm having problems when I add a point light which follows my player around. I don't need this light to cast shadows so this should be simple.
I just want the ground below the player to be lit.
Right now, the light affect other models on the terrain but not the terrain it self.
After reading this : http://www.ogre3d.org/forums/viewtopic.php?f=5&t=65798 it is clear that Ogre's terrain only handle one directional light.
It there any way to get a non-shadow casting light that affects both the terrain and other models in the game world?
I've been using Ogre's terrain quite happily with one directional light which generates shadows exactly like in Tutorial 3.
But I'm having problems when I add a point light which follows my player around. I don't need this light to cast shadows so this should be simple.
I just want the ground below the player to be lit.
Right now, the light affect other models on the terrain but not the terrain it self.
After reading this : http://www.ogre3d.org/forums/viewtopic.php?f=5&t=65798 it is clear that Ogre's terrain only handle one directional light.
It there any way to get a non-shadow casting light that affects both the terrain and other models in the game world?
Last edited by Yati on Mon Apr 30, 2012 2:28 am, edited 1 time in total.
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: Any way to get Multiple lights affecting Terrain?
Yes, it's possible. You have to write your own terrain material generator (Luckily you can just copy 95% of it from the default material generator, TerrainMaterialGeneratorA.cpp/.h from the ogre sources)
You can see an example how this was done for the OpenMW project here: https://github.com/zinnschlag/openmw/bl ... terial.cpp and https://github.com/zinnschlag/openmw/bl ... terial.hpp. In this case the shader handles one directional light and up to 8 pointlights (but no normal/parallax mapping).
Once you have your own terrain material generator, tell ogre to use it like so:
You can see an example how this was done for the OpenMW project here: https://github.com/zinnschlag/openmw/bl ... terial.cpp and https://github.com/zinnschlag/openmw/bl ... terial.hpp. In this case the shader handles one directional light and up to 8 pointlights (but no normal/parallax mapping).
Once you have your own terrain material generator, tell ogre to use it like so:
Code: Select all
TerrainMaterialGeneratorPtr matGen;
TerrainMaterialGeneratorB* matGenP = new TerrainMaterialGeneratorB();
matGen.bind(matGenP);
mTerrainGlobals.setDefaultMaterialGenerator(matGen);
-
- Greenskin
- Posts: 115
- Joined: Thu Jun 09, 2011 5:41 am
- Location: Melbourne, Australia
- x 5
-
- Halfling
- Posts: 91
- Joined: Fri Oct 22, 2010 10:46 pm
- x 8
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
Hi,
i read the TerrainMaterialGeneratorB-Code (new position: https://github.com/zinnschlag/openmw/bl ... terial.cpp, https://github.com/zinnschlag/openmw/bl ... terial.hpp). Now it seems that unlimited lightsources, texture-passes and normal-mapping is supported (i am right?). i m new to shader and i tried the last few hours to get into that bunch of code without too much luck.
is it possible to write my own vertex and fragment shader (not in code generation like openmw does) which supports a limited number of lightsources and textures (e.g. 8 ) by parsing the right parameters to the shader program? so this way it would much less code and a good example for getting into custom material generation.
has anyone done something like that and can share the code?
i read the TerrainMaterialGeneratorB-Code (new position: https://github.com/zinnschlag/openmw/bl ... terial.cpp, https://github.com/zinnschlag/openmw/bl ... terial.hpp). Now it seems that unlimited lightsources, texture-passes and normal-mapping is supported (i am right?). i m new to shader and i tried the last few hours to get into that bunch of code without too much luck.
is it possible to write my own vertex and fragment shader (not in code generation like openmw does) which supports a limited number of lightsources and textures (e.g. 8 ) by parsing the right parameters to the shader program? so this way it would much less code and a good example for getting into custom material generation.
has anyone done something like that and can share the code?

Kingdoms Defender offers Tower Defense action with breathtaking 3-D graphics for your mobile Android device.
Give it a try:
Free-Version:
http://play.google.com/store/apps/detai ... ender_free
Full-Version:
http://play.google.com/store/apps/detai ... msdefender
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
No. in a shader you can never have unlimited lightsources (unless you do multi-pass lighting which creates a new rendering pass for every light). Since this is a single-pass material, maximum number of lights (there is a #define in the code for that) depends on the number of shader instructions the GPU supports. but I wouldn't put it higher than 8 anyway for performance reasons.technique wrote: Now it seems that unlimited lightsources, texture-passes and normal-mapping is supported (i am right?
If you really need a lot of lights, you should go for deferred shading.
Unlimited texture-passes: again, this is the same thing. For each pass there is a limit of 16 textures. So with normal-mapping textures and blend textures the effective limit for number of layers will be around 5, without normal mapping around 10. In this version, there is no normal mapping.
the problem is that the terrain can have a varying number of layers. if you had always the same number of layers, you could do that.is it possible to write my own vertex and fragment shader (not in code generation like openmw does)
Edit: Read your post again and figured that you want a fixed number of 8 layers. So the answer is yes. (However, as pointed out above, if you want 8 layers, you can't have normal mapping)
-
- Halfling
- Posts: 91
- Joined: Fri Oct 22, 2010 10:46 pm
- x 8
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
ah thanks for the very fast reply! greate! 
i think 5 textures are still enough to create good looking terrains for smaller worlds. for the shadercode - isnt it possible to transmit the actual number of textures used by the terrain so the shader simply sumup its calculation like for(i=0; i < texcount; i++) ? thats the way i learned how to write a pixel shader for varying - indeed limited - lightsources
ah i found the lines:
no normal mapping - you are right!
but shadowing is computed in a way (not in the line above but i read somewhere else) - so is it only self shadowing or dynamic shadowing? its easier to understand whats written down when i know whats the goal was
!

i think 5 textures are still enough to create good looking terrains for smaller worlds. for the shadercode - isnt it possible to transmit the actual number of textures used by the terrain so the shader simply sumup its calculation like for(i=0; i < texcount; i++) ? thats the way i learned how to write a pixel shader for varying - indeed limited - lightsources
ah i found the lines:
Code: Select all
// simple per-pixel lighting with no normal mapping
for (int i=0; i<prof->getNumberOfLightsSupported(); ++i)
{
outStream <<
" float4 litRes"<<i<<" = lit(dot(normalize(lightDir"<<i<<"), normalize(normal)), 0, scaleBiasSpecular.z);\n";
but shadowing is computed in a way (not in the line above but i read somewhere else) - so is it only self shadowing or dynamic shadowing? its easier to understand whats written down when i know whats the goal was


Kingdoms Defender offers Tower Defense action with breathtaking 3-D graphics for your mobile Android device.
Give it a try:
Free-Version:
http://play.google.com/store/apps/detai ... ender_free
Full-Version:
http://play.google.com/store/apps/detai ... msdefender
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
no, because you have to access different texture units (among others) depending on which iteration you are currently in. you could do something like "if (i == 0) sampler = layer0" and so on, but using if statements for such purposes in a shader is horribly inefficient.isnt it possible to transmit the actual number of textures used by the terrain so the shader simply sumup its calculation like for(i=0; i < texcount; i++)
dynamic shadowing (entities can cast shadows on terrain). although there is no self-shadowing of the terrain.so is it only self shadowing or dynamic shadowing?
-
- Halfling
- Posts: 91
- Joined: Fri Oct 22, 2010 10:46 pm
- x 8
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
okay im new to shader programing. i thought its up to me how to parse texture units - so an array of a fixed size could do that ( assuming the array is filled from 0 to usedTextureCount). that leads me to another question:scrawl wrote: no, because you have to access different texture units (among others) depending on which iteration you are currently in. you could do something like "if (i == 0) sampler = layer0" and so on, but using if statements for such purposes in a shader is horribly inefficient.
i actually know how to parse parameter to a glsl shader (in opengl). But where did you load values in parameters for example in the fpheader:
Code: Select all
for (uint i = 0; i < numUVSets; ++i)
{
outStream <<
"float4 layerUV" << i << " : TEXCOORD" << texCoordSet++ << ", \n";
}


Kingdoms Defender offers Tower Defense action with breathtaking 3-D graphics for your mobile Android device.
Give it a try:
Free-Version:
http://play.google.com/store/apps/detai ... ender_free
Full-Version:
http://play.google.com/store/apps/detai ... msdefender
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
i only know CG. the purpose of TEXCOORD there is to pass a value from vertex shader to fragment shader.
in the vertex shader you can do this:
then you can receive it in the pixel shader like this:
in the vertex shader you can do this:
Code: Select all
...
out float4 foo : TEXCOORD0
...
// assign it
foo = ...
Code: Select all
...
in float4 foo : TEXCOORD0
...
// do something with foo
-
- Halfling
- Posts: 91
- Joined: Fri Oct 22, 2010 10:46 pm
- x 8
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
Okay that values are passed from vertex to fragment shader.
The two functions defaultVpParams() and defaultFpParams() are used to define the values represented by variables?
e.g.
The variable "viewProjMatrix" in shader code will be filled with the value of the ACT_VIEWPROJ_MATRIX which seems to be the Model View Projection Matrix. So its up the name to exactly fit one of the defines here.
Further in the generateVpHeader() function:
The uniform float4x4 viewProjMatrix is filled with the ModelViewMatrix. I assume for the fragmenshader its working the same way.
So the assignment which is done in GpuProgramParametersSharedPtr params; are valid for both vertex and fragment shader?
I have another important question too - whats the task for the CompositionMap and whats happening with the Material returned by the generateForCompositeMap()?
The two functions defaultVpParams() and defaultFpParams() are used to define the values represented by variables?
e.g.
Code: Select all
GpuProgramParametersSharedPtr params = prog->getDefaultParameters();
params->setIgnoreMissingParams(true);
params->setNamedAutoConstant("worldMatrix", GpuProgramParameters::ACT_WORLD_MATRIX);
params->setNamedAutoConstant("viewProjMatrix", GpuProgramParameters::ACT_VIEWPROJ_MATRIX);
params->setNamedAutoConstant("lodMorph", GpuProgramParameters::ACT_CUSTOM, Terrain::LOD_MORPH_CUSTOM_PARAM);
Further in the generateVpHeader() function:
Code: Select all
outStream <<
"uniform float4x4 worldMatrix,\n"
"uniform float4x4 viewProjMatrix,\n"
"uniform float2 lodMorph,\n"; // morph amount, morph LOD target
So the assignment which is done in GpuProgramParametersSharedPtr params; are valid for both vertex and fragment shader?
I have another important question too - whats the task for the CompositionMap and whats happening with the Material returned by the generateForCompositeMap()?

Kingdoms Defender offers Tower Defense action with breathtaking 3-D graphics for your mobile Android device.
Give it a try:
Free-Version:
http://play.google.com/store/apps/detai ... ender_free
Full-Version:
http://play.google.com/store/apps/detai ... msdefender
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
yes.So the assignment which is done in GpuProgramParametersSharedPtr params; are valid for both vertex and fragment shader?
the composite map is a generated texture that contains all texture layers (with blend factors) combined. since it will have a lower resolution, it is only used for distant terrain.whats the task for the CompositionMap
It is used to render the composite map. It is generated by rendering the terrain from above, with the composite map material.whats happening with the Material returned by the generateForCompositeMap()
-
- Halfling
- Posts: 91
- Joined: Fri Oct 22, 2010 10:46 pm
- x 8
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
did you use all lightsources for the compositemap generation?
For the limited lightsources: it is possible to parse every frame only the nearest lightpoints ( e.g. nearest to the camera or character) to the shader? A game with a camera perspective like Torchlight where the camera faces most of the time the character - there will be probably never more than 7 lightsource (one for the directional light) in the camera view.
should something like that work?
Another question: what about morphing? What is lodMorhping which is done in the shader?
For the limited lightsources: it is possible to parse every frame only the nearest lightpoints ( e.g. nearest to the camera or character) to the shader? A game with a camera perspective like Torchlight where the camera faces most of the time the character - there will be probably never more than 7 lightsource (one for the directional light) in the camera view.
should something like that work?
Another question: what about morphing? What is lodMorhping which is done in the shader?

Kingdoms Defender offers Tower Defense action with breathtaking 3-D graphics for your mobile Android device.
Give it a try:
Free-Version:
http://play.google.com/store/apps/detai ... ender_free
Full-Version:
http://play.google.com/store/apps/detai ... msdefender
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
the composite map itself doesn't have lighting. the terrain that displays using the composite map uses its own lighting on top of the composite map.did you use all lightsources for the compositemap generation?
Ogre does that automaticallyFor the limited lightsources: it is possible to parse every frame only the nearest lightpoints ( e.g. nearest to the camera or character) to the shader?

sorry, no idea.Another question: what about morphing? What is lodMorhping which is done in the shader?
-
- Halfling
- Posts: 91
- Joined: Fri Oct 22, 2010 10:46 pm
- x 8
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
Oh wait ... wow okay that was a big step for mescrawl wrote: Ogre does that automaticallynote that it is done per batch (i.e. per terrain page)

So i have "unlimited lightsource" affecting the terrain overall but one terrain batch (per terrain material - cause its singlepass) have e.g. max 8 lightsources? If i make the terrain size small enough there will be only a light limitation for the Level-Designer (max 8 lightpoints on a terrain batch).
What happens if more than the light-limit-size lightsources are created? How does Ogre select the lightsources which affecting the terrain. Beside the worst cast - how did Ogre select the lightsources at all?
(i learned so much during the day - special thanks to you for that!)

Kingdoms Defender offers Tower Defense action with breathtaking 3-D graphics for your mobile Android device.
Give it a try:
Free-Version:
http://play.google.com/store/apps/detai ... ender_free
Full-Version:
http://play.google.com/store/apps/detai ... msdefender
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
If there are more light sources than the material's passes support, ogre chooses the lights that are closest to the camera. I think most of this should be in the manual.
-
- Halfling
- Posts: 91
- Joined: Fri Oct 22, 2010 10:46 pm
- x 8
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
shame on mescrawl wrote:I think most of this should be in the manual.


For the first step i think i'll try to write a Vertex- and FragmentShader shading ONE Texture and Lightsource and further modify it to supporting more than that (may in the dynamic code generation way).
Thank you! Next time i'll hopefully come up with more advanced questions concerning shading! if i have the time i will write a tutorial from step 0 to a working TerrainMaterialGenerator if iam done!

Kingdoms Defender offers Tower Defense action with breathtaking 3-D graphics for your mobile Android device.
Give it a try:
Free-Version:
http://play.google.com/store/apps/detai ... ender_free
Full-Version:
http://play.google.com/store/apps/detai ... msdefender
-
- Greenskin
- Posts: 115
- Joined: Thu Jun 09, 2011 5:41 am
- Location: Melbourne, Australia
- x 5
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
I used scrawl's code to add multiple light to my terrain but I kept the parallax mapping that was there from Ogre's original material generator.
This is my cpp file.
This is my header file.
There aren't any references to my application's code here so added it to other project should be a simple copy paste.
I don't think its perfect since I'm pretty new to this shader business so if there's improvement please share.
This is my cpp file.
This is my header file.
There aren't any references to my application's code here so added it to other project should be a simple copy paste.

I don't think its perfect since I'm pretty new to this shader business so if there's improvement please share.
- duststorm
- Minaton
- Posts: 921
- Joined: Sat Jul 31, 2010 6:29 pm
- Location: Belgium
- x 80
- Contact:
Re: Any way to get Multiple lights affecting Terrain?
Great example you posted. I just wanted to point out that the links have changed. The files can now be found at:scrawl wrote:Yes, it's possible. You have to write your own terrain material generator.
You can see an example how this was done for the OpenMW project here:
In this case the shader handles one directional light and up to 8 pointlights (but no normal/parallax mapping).
https://github.com/zinnschlag/openmw/bl ... terial.cpp
and
https://github.com/zinnschlag/openmw/bl ... terial.hpp
It's a pity that github doesn't have permalinks

I'm also at a point where I'm figuring out what to do. I'm using Terrain with Caelum. Caelum creates two directional lights, one for the sun and one for the moon. Since Ogre figures out automatically which lights it selects sometimes my terrain gets lit by the wrong light (the moon) during the day. (probably because the light for the moon happens to be a little closer to the ground than the sun)
Selecting the proper light is not only important for terrain lighting, but also for entitiy lighting and things like shadow casters (unless they support multiple (eg. 3) directional lights).
I have a few options:
- Make a terrain material generator that constructs shaders that take more than one light (2 would suffice)
- Create a custom light selection listener and select the sun or moon myself, based on Caelum time of day, light positions or some other metric (I already did a similar thing in the past)
- Add a frame listener to the scene that disables sun or moon lights depending on some time/position metric. This is the simplest solution, but has the disadvantage that you can only have sun or moonlight at one time. In some situations you have both.
Last edited by duststorm on Tue Jul 17, 2012 2:55 pm, edited 3 times in total.
Developer @ MakeHuman.org
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
Links are not working, I get:Yati wrote:I used scrawl's code to add multiple light to my terrain but I kept the parallax mapping that was there from Ogre's original material generator.
This is my cpp file.
This is my header file.
Code: Select all
Unexpected Error
An error has just occured. It has been logged and will be dealt with shortly.
If it is urgent, please contact our administrators.
- duststorm
- Minaton
- Posts: 921
- Joined: Sat Jul 31, 2010 6:29 pm
- Location: Belgium
- x 80
- Contact:
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
Haha, what a coincidence. We were both replying to the same old thread at the same timescrawl wrote:Links are not working

Just see my post right above.
EDIT: whoops, indeed. I was a little too fast

Last edited by duststorm on Tue Jul 17, 2012 3:04 pm, edited 1 time in total.
Developer @ MakeHuman.org
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
I was referring to Yati's links and not mine
Anyway, I've moved my own files to a (more permanent) location:
http://scrawl.bplaced.net/perm/terrainmaterial.cpp
http://scrawl.bplaced.net/perm/terrainmaterial.hpp
Please PM me if they happen to be down.

Anyway, I've moved my own files to a (more permanent) location:
http://scrawl.bplaced.net/perm/terrainmaterial.cpp
http://scrawl.bplaced.net/perm/terrainmaterial.hpp
Please PM me if they happen to be down.
-
- Platinum Sponsor
- Posts: 290
- Joined: Tue Jan 17, 2012 5:18 am
- x 67
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
this will be useful to tons of people.
these changes should be reviewed/merged by the ogre team if they're not already.
how do we request that this happen?
these changes should be reviewed/merged by the ogre team if they're not already.
how do we request that this happen?
-
- Greenskin
- Posts: 115
- Joined: Thu Jun 09, 2011 5:41 am
- Location: Melbourne, Australia
- x 5
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
Hi,
Sorry for uber late reply, I saw the post but was moving house at the time.
I put it up on the wiki
I couldn't figure out how to make it show up on the Snippets section tho >_<.
Sorry for uber late reply, I saw the post but was moving house at the time.
I put it up on the wiki
I couldn't figure out how to make it show up on the Snippets section tho >_<.
-
- Kobold
- Posts: 27
- Joined: Sat Apr 30, 2011 5:31 pm
- Contact:
Re: Any way to get Multiple lights affecting Terrain? [SOLVE
I know this is an older post, but I have a problem with scrawl´s version.
With the default generator it works fine.
The cg compiler gives me multiple errors.
Some informations:
I´m using Ogre v. 1.8.1 with Mingw
My graka: GT540M
I want to add, that I had the same problem with the TerrainMaterialGeneratorC (from an other forum thread).
I commented some OpenMW specific lines out, but I don´t think that is the problem.
eg:
and maybe useful, but here I also don´t think it is a problem:
(I set the number of max lights to 1 only for testing, if I use the commented code it doesn´t change anything)
With the default generator it works fine.
The cg compiler gives me multiple errors.
Some informations:
I´m using Ogre v. 1.8.1 with Mingw
My graka: GT540M
Code: Select all
19:39:51: Creating resource group General
19:39:51: Creating resource group Internal
19:39:51: Creating resource group Autodetect
19:39:51: SceneManagerFactory for type 'DefaultSceneManager' registered.
19:39:51: Registering ResourceManager for type Material
19:39:51: Registering ResourceManager for type Mesh
19:39:51: Registering ResourceManager for type Skeleton
19:39:51: MovableObjectFactory for type 'ParticleSystem' registered.
19:39:51: OverlayElementFactory for type Panel registered.
19:39:51: OverlayElementFactory for type BorderPanel registered.
19:39:51: OverlayElementFactory for type TextArea registered.
19:39:51: Registering ResourceManager for type Font
19:39:51: ArchiveFactory for archive type FileSystem registered.
19:39:51: ArchiveFactory for archive type Zip registered.
19:39:51: ArchiveFactory for archive type EmbeddedZip registered.
19:39:51: DDS codec registering
19:39:51: FreeImage version: 3.15.3
19:39:51: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
19:39:51: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2,pfm,pct,pict,pic,3fr,arw,bay,bmq,cap,cine,cr2,crw,cs1,dc2,dcr,drf,dsc,dng,erf,fff,ia,iiq,k25,kc2,kdc,mdc,mef,mos,mrw,nef,nrw,orf,pef,ptx,pxn,qtk,raf,raw,rdc,rw2,rwl,rwz,sr2,srf,srw,sti
19:39:51: Registering ResourceManager for type HighLevelGpuProgram
19:39:51: Registering ResourceManager for type Compositor
19:39:51: MovableObjectFactory for type 'Entity' registered.
19:39:51: MovableObjectFactory for type 'Light' registered.
19:39:51: MovableObjectFactory for type 'BillboardSet' registered.
19:39:51: MovableObjectFactory for type 'ManualObject' registered.
19:39:51: MovableObjectFactory for type 'BillboardChain' registered.
19:39:51: MovableObjectFactory for type 'RibbonTrail' registered.
19:39:51: Loading library ./plugins\RenderSystem_Direct3D9_d
19:39:51: Installing plugin: D3D9 RenderSystem
19:39:51: D3D9 : Direct3D9 Rendering Subsystem created.
19:39:51: D3D9: Driver Detection Starts
19:39:51: D3D9: Driver Detection Ends
19:39:51: Plugin successfully installed
19:39:51: Loading library ./plugins\RenderSystem_GL_d
19:39:51: Installing plugin: GL RenderSystem
19:39:51: OpenGL Rendering Subsystem created.
19:39:51: Plugin successfully installed
19:39:51: Loading library ./plugins\Plugin_CgProgramManager_d
19:39:51: Installing plugin: Cg Program Manager
19:39:51: Plugin successfully installed
19:39:51: *-*-* OGRE Initialising
19:39:51: *-*-* Version 1.8.1 (Byatis)
19:39:51: Creating resource group Fonts
19:39:51: Added resource location './media/gui/fonts' of type 'FileSystem' to resource group 'Fonts'
19:39:51: Added resource location './media' of type 'FileSystem' to resource group 'General'
19:39:51: Added resource location './media/examples' of type 'FileSystem' to resource group 'General'
19:39:51: Added resource location './media/sinbad' of type 'FileSystem' to resource group 'General'
19:39:51: Added resource location './media/PagedGeometry/trees' of type 'FileSystem' to resource group 'General'
19:39:51: Added resource location './media/PagedGeometry/trees2' of type 'FileSystem' to resource group 'General'
19:39:51: Added resource location './media/PagedGeometry/grass' of type 'FileSystem' to resource group 'General'
19:39:51: Creating resource group Imagesets
19:39:51: Added resource location './media/gui/imagesets' of type 'FileSystem' to resource group 'Imagesets'
19:39:51: Creating resource group Layouts
19:39:51: Added resource location './media/gui/layouts' of type 'FileSystem' to resource group 'Layouts'
19:39:51: Creating resource group LookNFeel
19:39:51: Added resource location './media/gui/looknfeel' of type 'FileSystem' to resource group 'LookNFeel'
19:39:51: Creating resource group Schemes
19:39:51: Added resource location './media/gui/schemes' of type 'FileSystem' to resource group 'Schemes'
19:39:51: Creating resource group Terrain
19:39:51: Added resource location './media/terrain' of type 'FileSystem' to resource group 'Terrain'
19:39:51: Added resource location './media/examples' of type 'FileSystem' to resource group 'Terrain'
19:39:51: D3D9 : RenderSystem Option: Full Screen = No
19:39:51: D3D9 : RenderSystem Option: Video Mode = 800 x 600 @ 32-bit colour
19:39:51: D3D9 : RenderSystem Option: FSAA = 8
19:39:51: D3D9 : RenderSystem Option: VSync = Yes
19:39:51: CPU Identifier & Features
19:39:51: -------------------------
19:39:51: * CPU ID: GenuineIntel: Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz
19:39:51: * SSE: yes
19:39:51: * SSE2: yes
19:39:51: * SSE3: yes
19:39:51: * MMX: yes
19:39:51: * MMXEXT: yes
19:39:51: * 3DNOW: no
19:39:51: * 3DNOWEXT: no
19:39:51: * CMOV: yes
19:39:51: * TSC: yes
19:39:51: * FPU: yes
19:39:51: * PRO: yes
19:39:51: * HT: no
19:39:51: -------------------------
19:39:51: D3D9 : Subsystem Initialising
19:39:51: Registering ResourceManager for type Texture
19:39:51: Registering ResourceManager for type GpuProgram
19:39:51: D3D9RenderSystem::_createRenderWindow "Test", 800x600 windowed miscParams: FSAA=8 FSAAHint= colourDepth=32 gamma=false monitorIndex=0 useNVPerfHUD=false vsync=true vsyncInterval=1
19:39:51: D3D9 : Created D3D9 Rendering Window 'Test' : 800x600, 32bpp
19:39:52: D3D9: Vertex texture format supported - PF_A8R8G8B8
19:39:52: D3D9: Vertex texture format supported - PF_B8G8R8A8
19:39:52: D3D9: Vertex texture format supported - PF_FLOAT16_RGB
19:39:52: D3D9: Vertex texture format supported - PF_FLOAT16_RGBA
19:39:52: D3D9: Vertex texture format supported - PF_FLOAT32_RGB
19:39:52: D3D9: Vertex texture format supported - PF_FLOAT32_RGBA
19:39:52: D3D9: Vertex texture format supported - PF_R8G8B8A8
19:39:52: D3D9: Vertex texture format supported - PF_DEPTH
19:39:52: D3D9: Vertex texture format supported - PF_FLOAT16_R
19:39:52: D3D9: Vertex texture format supported - PF_FLOAT32_R
19:39:52: D3D9: Vertex texture format supported - PF_FLOAT16_GR
19:39:52: D3D9: Vertex texture format supported - PF_FLOAT32_GR
19:39:52: D3D9: Vertex texture format supported - PF_PVRTC_RGB2
19:39:52: D3D9: Vertex texture format supported - PF_PVRTC_RGBA2
19:39:52: D3D9: Vertex texture format supported - PF_PVRTC_RGB4
19:39:52: D3D9: Vertex texture format supported - PF_PVRTC_RGBA4
19:39:52: D3D9: Vertex texture format supported - PF_R8
19:39:52: D3D9: Vertex texture format supported - PF_RG8
19:39:52: RenderSystem capabilities
19:39:52: -------------------------
19:39:52: RenderSystem Name: Direct3D9 Rendering Subsystem
19:39:52: GPU Vendor: intel
19:39:52: Device Name: Monitor-1-Intel(R) HD Graphics Family
19:39:52: Driver Version: 9.18.13.1070
19:39:52: * Fixed function pipeline: yes
19:39:52: * Hardware generation of mipmaps: yes
19:39:52: * Texture blending: yes
19:39:52: * Anisotropic texture filtering: yes
19:39:52: * Dot product texture operation: yes
19:39:52: * Cube mapping: yes
19:39:52: * Hardware stencil buffer: yes
19:39:52: - Stencil depth: 8
19:39:52: - Two sided stencil support: yes
19:39:52: - Wrap stencil values: yes
19:39:52: * Hardware vertex / index buffers: yes
19:39:52: * Vertex programs: yes
19:39:52: * Number of floating-point constants for vertex programs: 256
19:39:52: * Number of integer constants for vertex programs: 16
19:39:52: * Number of boolean constants for vertex programs: 16
19:39:52: * Fragment programs: yes
19:39:52: * Number of floating-point constants for fragment programs: 224
19:39:52: * Number of integer constants for fragment programs: 16
19:39:52: * Number of boolean constants for fragment programs: 16
19:39:52: * Geometry programs: no
19:39:52: * Number of floating-point constants for geometry programs: 5801
19:39:52: * Number of integer constants for geometry programs: 13780
19:39:52: * Number of boolean constants for geometry programs: 5801
19:39:52: * Supported Shader Profiles: hlsl ps_1_1 ps_1_2 ps_1_3 ps_1_4 ps_2_0 ps_2_a ps_2_b ps_2_x ps_3_0 vs_1_1 vs_2_0 vs_2_a vs_2_x vs_3_0
19:39:52: * Texture Compression: yes
19:39:52: - DXT: yes
19:39:52: - VTC: no
19:39:52: - PVRTC: no
19:39:52: * Scissor Rectangle: yes
19:39:52: * Hardware Occlusion Query: yes
19:39:52: * User clip planes: yes
19:39:52: * VET_UBYTE4 vertex element type: yes
19:39:52: * Infinite far plane projection: yes
19:39:52: * Hardware render-to-texture: yes
19:39:52: * Floating point textures: yes
19:39:52: * Non-power-of-two textures: yes
19:39:52: * Volume textures: yes
19:39:52: * Multiple Render Targets: 4
19:39:52: - With different bit depths: yes
19:39:52: * Point Sprites: yes
19:39:52: * Extended point parameters: yes
19:39:52: * Max Point Size: 8192
19:39:52: * Vertex texture fetch: yes
19:39:52: * Number of world matrices: 0
19:39:52: * Number of texture units: 8
19:39:52: * Stencil buffer depth: 8
19:39:52: * Number of vertex blend matrices: 0
19:39:52: - Max vertex textures: 4
19:39:52: - Vertex textures shared: no
19:39:52: * Render to Vertex Buffer : no
19:39:52: * DirectX per stage constants: yes
19:39:52: ***************************************
19:39:52: *** D3D9 : Subsystem Initialised OK ***
19:39:52: ***************************************
19:39:52: DefaultWorkQueue('Root') initialising on thread 18e0.
19:39:52: Particle Renderer Type 'billboard' registered
19:39:52: DefaultWorkQueue('Root')::WorkerFunc - thread 16a4 starting.
19:39:52: DefaultWorkQueue('Root')::WorkerFunc - thread 1cf4 starting.
19:39:52: DefaultWorkQueue('Root')::WorkerFunc - thread 1dac starting.
19:39:52: DefaultWorkQueue('Root')::WorkerFunc - thread 1a48 starting.
19:39:52: Parsing scripts for resource group Autodetect
19:39:52: Finished parsing scripts for resource group Autodetect
19:39:52: Creating resources for group Autodetect
19:39:52: All done
19:39:52: Parsing scripts for resource group Fonts
19:39:52: Finished parsing scripts for resource group Fonts
19:39:52: Creating resources for group Fonts
19:39:52: All done
19:39:52: Parsing scripts for resource group General
19:39:52: Parsing script Sinbad.material
19:39:52: Parsing script tree.material
19:39:52: Parsing script 3d-diggers_fir.material
19:39:52: Parsing script farn1.mesh.material
19:39:52: Parsing script farn2.mesh.material
19:39:52: Parsing script plant1.mesh.material
19:39:52: Parsing script plant2.mesh.material
19:39:52: Parsing script shrooms.material
19:39:52: Parsing script skybox.material
19:39:52: Parsing script grass.material
19:39:52: Parsing script BlueHighway.fontdef
19:39:52: Finished parsing scripts for resource group General
19:39:52: Creating resources for group General
19:39:52: All done
19:39:52: Parsing scripts for resource group Imagesets
19:39:52: Finished parsing scripts for resource group Imagesets
19:39:52: Creating resources for group Imagesets
19:39:52: All done
19:39:52: Parsing scripts for resource group Internal
19:39:52: Finished parsing scripts for resource group Internal
19:39:52: Creating resources for group Internal
19:39:52: All done
19:39:52: Parsing scripts for resource group Layouts
19:39:52: Finished parsing scripts for resource group Layouts
19:39:52: Creating resources for group Layouts
19:39:52: All done
19:39:52: Parsing scripts for resource group LookNFeel
19:39:52: Finished parsing scripts for resource group LookNFeel
19:39:52: Creating resources for group LookNFeel
19:39:52: All done
19:39:52: Parsing scripts for resource group Schemes
19:39:52: Finished parsing scripts for resource group Schemes
19:39:52: Creating resources for group Schemes
19:39:52: All done
19:39:52: Parsing scripts for resource group Terrain
19:39:52: Parsing script BlueHighway.fontdef
19:39:52: Finished parsing scripts for resource group Terrain
19:39:52: Creating resources for group Terrain
19:39:52: All done
19:39:52: Mesh: Loading Sinbad.mesh.
19:39:52: Skeleton: Loading Sinbad.skeleton
19:39:52: WARNING: Sinbad.mesh is an older format ([MeshSerializer_v1.40]); you should upgrade it as soon as possible using the OgreMeshUpgrade tool.
19:39:52: Texture: sinbad_body.tga: Loading 1 faces(PF_R8G8B8,512x512x1) Internal format is PF_X8R8G8B8,512x512x1.
19:39:52: Texture: sinbad_clothes.tga: Loading 1 faces(PF_R8G8B8,512x512x1) Internal format is PF_X8R8G8B8,512x512x1.
19:39:52: Texture: sinbad_sword.tga: Loading 1 faces(PF_R8G8B8,256x256x1) Internal format is PF_X8R8G8B8,256x256x1.
19:39:52: WARNING: the mesh 'Sinbad.mesh' includes vertices with more than 4 bone assignments. The lowest weighted assignments beyond this limit have been removed, so your animation may look slightly different. To eliminate this, reduce the number of bone assignments per vertex on your mesh to 4.
19:39:52: Terrain created; size=513 minBatch=33 maxBatch=65 treeDepth=4 lodLevels=5 leafLods=2
19:39:52: Terrain created; size=513 minBatch=33 maxBatch=65 treeDepth=4 lodLevels=5 leafLods=2
19:39:52: OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program OgreTerrain/1571572372/sm2/fp/hlod: The compile returned an error.
<invalid atom 65535>(45) : error C1008: undefined variable "lightDir"
<invalid atom 65535>(75) : error C1008: undefined variable "litRes0"
in CgProgram::compileMicrocode at ..\..\..\..\..\..\PlugIns\CgProgramManager\src\OgreCgProgramManagerDll.cpp (line 67)
19:39:52: High-level program OgreTerrain/1571572372/sm2/fp/hlod encountered an error during loading and is thus not supported.
OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program OgreTerrain/1571572372/sm2/fp/hlod: The compile returned an error.
<invalid atom 65535>(45) : error C1008: undefined variable "lightDir"
<invalid atom 65535>(75) : error C1008: undefined variable "litRes0"
in CgProgram::compileMicrocode at ..\..\..\..\..\..\PlugIns\CgProgramManager\src\OgreCgProgramManagerDll.cpp (line 67)
19:39:52: OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program OgreTerrain/1571572372/sm2/fp/comp: The compile returned an error.
<invalid atom 65535>(45) : error C1008: undefined variable "lightDir"
<invalid atom 65535>(69) : error C1008: undefined variable "litRes0"
in CgProgram::compileMicrocode at ..\..\..\..\..\..\PlugIns\CgProgramManager\src\OgreCgProgramManagerDll.cpp (line 67)
19:39:52: High-level program OgreTerrain/1571572372/sm2/fp/comp encountered an error during loading and is thus not supported.
OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program OgreTerrain/1571572372/sm2/fp/comp: The compile returned an error.
<invalid atom 65535>(45) : error C1008: undefined variable "lightDir"
<invalid atom 65535>(69) : error C1008: undefined variable "litRes0"
in CgProgram::compileMicrocode at ..\..\..\..\..\..\PlugIns\CgProgramManager\src\OgreCgProgramManagerDll.cpp (line 67)
19:39:52: WARNING: material OgreTerrain/1571572372/comp has no supportable Techniques and will be blank. Explanation:
Pass 0: Fragment program OgreTerrain/1571572372/sm2/fp/comp cannot be used - compile error.
19:39:52: OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program OgreTerrain/3642232355/sm2/fp/hlod: The compile returned an error.
<invalid atom 65535>(45) : error C1008: undefined variable "lightDir"
<invalid atom 65535>(75) : error C1008: undefined variable "litRes0"
in CgProgram::compileMicrocode at ..\..\..\..\..\..\PlugIns\CgProgramManager\src\OgreCgProgramManagerDll.cpp (line 67)
19:39:52: High-level program OgreTerrain/3642232355/sm2/fp/hlod encountered an error during loading and is thus not supported.
OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program OgreTerrain/3642232355/sm2/fp/hlod: The compile returned an error.
<invalid atom 65535>(45) : error C1008: undefined variable "lightDir"
<invalid atom 65535>(75) : error C1008: undefined variable "litRes0"
in CgProgram::compileMicrocode at ..\..\..\..\..\..\PlugIns\CgProgramManager\src\OgreCgProgramManagerDll.cpp (line 67)
19:39:52: OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program OgreTerrain/3642232355/sm2/fp/comp: The compile returned an error.
<invalid atom 65535>(45) : error C1008: undefined variable "lightDir"
<invalid atom 65535>(69) : error C1008: undefined variable "litRes0"
in CgProgram::compileMicrocode at ..\..\..\..\..\..\PlugIns\CgProgramManager\src\OgreCgProgramManagerDll.cpp (line 67)
19:39:52: High-level program OgreTerrain/3642232355/sm2/fp/comp encountered an error during loading and is thus not supported.
OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program OgreTerrain/3642232355/sm2/fp/comp: The compile returned an error.
<invalid atom 65535>(45) : error C1008: undefined variable "lightDir"
<invalid atom 65535>(69) : error C1008: undefined variable "litRes0"
in CgProgram::compileMicrocode at ..\..\..\..\..\..\PlugIns\CgProgramManager\src\OgreCgProgramManagerDll.cpp (line 67)
19:39:52: WARNING: material OgreTerrain/3642232355/comp has no supportable Techniques and will be blank. Explanation:
Pass 0: Fragment program OgreTerrain/3642232355/sm2/fp/comp cannot be used - compile error.
19:39:55: DefaultWorkQueue('Root') shutting down on thread 18e0.
19:39:55: DefaultWorkQueue('Root')::WorkerFunc - thread 1dac stopped.
19:39:55: DefaultWorkQueue('Root')::WorkerFunc - thread 1a48 stopped.
19:39:55: DefaultWorkQueue('Root')::WorkerFunc - thread 1cf4 stopped.
19:39:55: DefaultWorkQueue('Root')::WorkerFunc - thread 16a4 stopped.
19:39:55: *-*-* OGRE Shutdown
19:39:55: Unregistering ResourceManager for type Compositor
19:39:55: Unregistering ResourceManager for type Font
19:39:55: Unregistering ResourceManager for type Skeleton
19:39:55: Unregistering ResourceManager for type Mesh
19:39:55: Unregistering ResourceManager for type HighLevelGpuProgram
19:39:55: Uninstalling plugin: Cg Program Manager
19:39:55: Plugin successfully uninstalled
19:39:55: Unloading library ./plugins\Plugin_CgProgramManager_d
19:39:55: Uninstalling plugin: GL RenderSystem
19:39:55: *** Stopping Win32GL Subsystem ***
19:39:55: Plugin successfully uninstalled
19:39:55: Unloading library ./plugins\RenderSystem_GL_d
19:39:55: Uninstalling plugin: D3D9 RenderSystem
19:39:55: D3D9 device: 0x[0x17c528c0] destroy. Releasing D3D9 texture: TerrBlend1
19:39:55: Released D3D9 texture: TerrBlend1
19:39:55: D3D9 device: 0x[0x17c528c0] destroy. Releasing D3D9 texture: OgreTerrain/1571572372/cm
19:39:55: Released D3D9 texture: OgreTerrain/1571572372/cm
19:39:55: D3D9 device: 0x[0x17c528c0] destroy. Releasing D3D9 texture: OgreTerrain/1571572372/nm
19:39:55: Released D3D9 texture: OgreTerrain/1571572372/nm
19:39:55: D3D9 device: 0x[0x17c528c0] destroy. Releasing D3D9 texture: TerrBlend2
19:39:55: Released D3D9 texture: TerrBlend2
19:39:55: D3D9 device: 0x[0x17c528c0] destroy. Releasing D3D9 texture: OgreTerrain/3642232355/nm
19:39:55: Released D3D9 texture: OgreTerrain/3642232355/nm
19:39:55: D3D9 device: 0x[0x17c528c0] destroy. Releasing D3D9 texture: OgreTerrain/3642232355/lm
19:39:55: Released D3D9 texture: OgreTerrain/3642232355/lm
19:39:55: D3D9 device: 0x[0x17c528c0] destroy. Releasing D3D9 texture: OgreTerrain/3642232355/comp
19:39:55: Released D3D9 texture: OgreTerrain/3642232355/comp
19:39:55: D3D9 device: 0x[0x17c528c0] destroy. Releasing D3D9 texture: OgreTerrain/1571572372/lm
19:39:55: Released D3D9 texture: OgreTerrain/1571572372/lm
19:39:55: D3D9 device: 0x[0x17c528c0] destroy. Releasing D3D9 texture: OgreTerrain/1571572372/comp
19:39:55: Released D3D9 texture: OgreTerrain/1571572372/comp
19:39:55: D3D9 : Shutting down cleanly.
19:39:55: Unregistering ResourceManager for type Texture
19:39:55: Unregistering ResourceManager for type GpuProgram
19:39:55: D3D9 : Direct3D9 Rendering Subsystem destroyed.
19:39:55: Plugin successfully uninstalled
19:39:55: Unloading library ./plugins\RenderSystem_Direct3D9_d
19:39:55: Unregistering ResourceManager for type Material
I commented some OpenMW specific lines out, but I don´t think that is the problem.
eg:
Code: Select all
if (MWRender::RenderingManager::useMRT())
params->setNamedAutoConstant("far", GpuProgramParameters::ACT_FAR_CLIP_DISTANCE);
Code: Select all
int TerrainMaterialGeneratorB::SM2Profile::getNumberOfLightsSupported() const
{
/* // number of supported lights depends on the number of available constant registers,
// which in turn depends on the shader profile used
if (GpuProgramManager::getSingleton().isSyntaxSupported("ps_3_0")
|| GpuProgramManager::getSingleton().isSyntaxSupported("ps_4_0")
|| GpuProgramManager::getSingleton().isSyntaxSupported("fp40")
)
return 32;
else
return 8;*/
return 1;
}