oFusion and Omni (Shadows problem)

javierpc

30-03-2008 23:13:03

Hi all

I'm getting an error (Failed to DrawPrimitive) when I try to load a scene with a omni light. Don know why, I have already exported omnis and I was able to run the app.

I'm using the scene loader in my own project, loading a single Box with a bumpmapping material from the Wiki tutorial. So I need a light to see the bump mapping, but when i put a omni light everything crash :S

Please help.

*****************************
00:06:04: ** oSceneLoader: Scene loaded **
00:06:04: ********************************
00:06:05: Creating viewport on target 'OGRE Render Window', rendering from camera 'PlayerCam', relative dimensions L: 0.00 T: 0.00 W: 1.00 H: 1.00 ZOrder: 0
00:06:05: *** Initializing OIS ***
00:06:05: OGRE EXCEPTION(3:RenderingAPIException): Failed to DrawPrimitive : Invalid call in D3D9RenderSystem::_render at ..\src\OgreD3D9RenderSystem.cpp (line 2730)
00:06:13: Unregistering ResourceManager for type BspLevel
00:06:13: *-*-* OGRE Shutdown

Evak

31-03-2008 03:50:18

We get a similar error with our compatibility demo on some hardware.

10:21:57: OGRE EXCEPTION(3:RenderingAPIException): Failed to DrawPrimitive : Invalid call in D3D9RenderSystem::_render at ..\src\OgreD3D9RenderSystem.cpp (line 2720)

I think its the video card failing to create a D3D window. For us it only happens with certain intel graphics hardware.

Pentium-M ULV 1.5Ghz, 1GB RAM, Intel GMA900 64mb shared (PS 2.0, no hardware vertex processing).

Strangely the original demo that used old dagon models ran fine, but the newly exporter mesh set up for shaders didn't. I'm not sure this is an Ofusion problem or an Ogre one, but if anyone knows what it is and if there's a solution would be cool to hear it.

What kind of video card do you have Javier?

You can try my compatibility test if you like, see if it works on your computer. Have you tried GL? GL seems to work perfectly where D3D doesn't work at all when we have the error. It is something to do with the groundplane.

Here's the compatibility demo if you want to try it. Only had the problem on two machines with the exact same intel graphics chipset.



http://www.flow3d.org/walkiestest.zip



.

javierpc

31-03-2008 12:28:00

Thanks once more Evak, I'll have to pay you hehe

Im on a macbook, and this error only appears with certain scenes, they can be simple or complex, it depends, anyway I have discovered that sometimes it works :O

Another question to not open another thread...

Im trying to render shadows on my app, but they are not shown. I have exported the edge list, I set shadows on on the light, I have added "receive_shadows on" to the material, set the shadow type on ogre, etc... I get no error, and I get no shadow.

Thanks in advance (once more)

PS: I'll try the demo later, I can't try it now.

Evak

31-03-2008 17:47:54

I just looked up the macbook specs. It has an integrated intel chipset that shares system memory instead of having its own video ram. Just like the computers I'm having problems with.

there are two versions.

2006
Intel GMA 950 graphics processor using 64 MB of DDR2 SDRAM shared by main memory



2007 - 2008
Intel GMA X3100 graphics processor using 144MB of DDR2 SDRAM shared by main memory
(up to 358MB in Windows through Boot Camp)


The 2006 macbook is almost identical to the two systems I've had problems with.

Here's the results we have had with intel so far:

Intel GMA X3100.... graphics DX good GL full screen shadow
Intel GMA900... 64mb shared GL good inc shaders No D3D render window
Intel '915GM/GMS,910GML' (tablet PC GL Good no D3D render window)


I actualy posted about this on the main ogre forums almost a month ago but didn't get any responses. If you can tell me which macbook chipset you have, I can add it to the thread.

http://www.ogre3d.org/phpBB2/viewtopic. ... 6f4e2718c6

Intel have a huge chunk of the graphics hardware about 50% beating Nvidia and ATI, so it's a shame that people seem to be ignoring compatibility.

javierpc

01-04-2008 00:02:37

Intel GMA 950:

Modelo de chipset: GMA 950
Tipo: Pantalla
Bus: Integrado
VRAM (total): 64 MB de memoria de sistema compartida
Fabricante: Intel (0x8086)
ID del dispositivo: 0x27a2
ID de la revisión: 0x0003
Pantallas:
LCD color:
Tipo de pantalla: LCD
Resolución: 1280 x 800
Profundidad: Color de 32 bits
Integrado: Sí
Core Image: Acelerado por hardware
Pantalla principal: Sí
Duplicado: Desactivado
En línea: Sí
Quartz Extreme: Compatible
Conector de pantalla:
Estado: No hay ninguna pantalla conectada



There u have, it's in spanish but I think u'll understand the data that u are looking for hehe.

Any idea about the shadow problem?

About the macbook, I also a have a PC with a Nvidia. I wanted to develop my project in the macbook because the graphics specs are lower than the PC and I think it's better to develop using decent graphic specs and not high ones. Anyway keep on working on that, tell me if u want me to do any test!

Evak

01-04-2008 01:04:30

heh, yeah its that Intel GMA900 GMA 950 that were having problems with too. Hope we can find a solution for the problem since its a very common chipset.

Lioric

01-04-2008 02:28:53

The issue with IntelGMA hardware, is that it is not a pure hardware device, and its target is very different than AMD and NVidia

For working with this device, you probably will need to modify the Ogre engine and add support for software vertex buffers, and bear in mind that the shader model needed might not be completely supported

Force the use of shader model 1.x where possible on materials (create material lods and use them when running on this hardware), and if possible use OpenGL as it is probably more supported (create your shaders as CG shaders to support both render systems)

javierpc

01-04-2008 03:57:15

The demo works in OpenGL, but it throws a Runtime error in D3D.

Then... should i always work in opengl?, I Think I'll finally have to work on the PC, the problem is that is not a laptop :(
(I've installed win in the macbook anyway to work with ogre)

And other thing, I think u haven't read my other question about the shadows issue. Could u tell me something more to check? I have checked everything a lot of times.

Another question to not open another thread...

Im trying to render shadows on my app, but they are not shown. I have exported the edge list, I set shadows on on the light, I have added "receive_shadows on" to the material, set the shadow type on ogre, etc... I get no error, and I get no shadow.

Thanks in advance (once more)



I'll give you some more information.

My only material script:



Thanks!
material pruebaoMaterial
{
receive_shadows on
technique
{
pass
{
ambient 0 0.0588235 0.847059 1
diffuse 0.145098 0 0.87451 1
specular 0.9 0.9 0.9 1 20
}

}

}



My osm file (the important things)
<oe_scene>
<sceneManager type="0" />
<bkgcolor r="0" g="0" b="0" />
<lightColor r="0.5" g="0.5" b="0.5" />
<shadowTechnique type="0" tex_size="512" tex_count="1">
<color r="0" g="0" b="0" />
</shadowTechnique>
<entities>
<entity name="NOMCALLE01" hidden="false" filename="NOMCALLE01.mesh" CastShadows="yes" ReceiveShadows="yes">
<position x="-1711.3602" y="223.47081" z="-363.16638" />
<rotation x="1.8641047e-010" y="-0.066578619" z="2.7936418e-009" w="-0.99778122" />
<scale x="1" y="1" z="1" />
</entity>
<entity name="NOMCALLE02" hidden="false" filename="NOMCALLE02.mesh" CastShadows="yes" ReceiveShadows="yes">
</entities>


MORE ENTITIES

<lights>
<light name="Omni01" type="omni" on="true" CastShadows="yes" intensity="0.6">
<position x="-3501.5244" y="952.28345" z="-896.14514" />
<rotation x="0" y="0" z="-0" w="-1" />
<scale x="1" y="1" z="1" />
<color r="0.6" g="0.6" b="0.6" />
<specular r="0.6" g="0.6" b="0.6" />
</light>
</lights>
</oe_scene>



My source code. It's a simple app to try to see a shadow in my scene. Maybe the line order is changed, I've tried to change the order of all statements.






void createScene(void)
{


OSMScene oScene;
oSceneCallback oe_Callback;
oScene.initialise("psol.osm", &oe_Callback);
oScene.createScene();
mSceneMgr = oScene.getSceneManager();

mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5,0.5,0.5));

// I have tried with other techniques
mSceneMgr->setShadowTechnique(Ogre::ShadowTechnique::SHADOWTYPE_TEXTURE_ADDITIVE);
mSceneMgr->setSkyBox(true, "cielo",1000);


mCamera = mSceneMgr->createCamera("PlayerCam");
mCamera->setPosition(Vector3(0,200,500));
mCamera->lookAt(Vector3(0,0,-300));
mCamera->setNearClipDistance(5);

Light *light = mSceneMgr->createLight("Light1");
light->setType(Light::LT_POINT);
light->setPosition(Vector3(-600, 600,600 ));
light->setDiffuseColour(1.0, 1.0, 1.0);
light->setSpecularColour(1.0, 1.0, 1.0);


Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(ColourValue(0,0,0));


mCamera->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight()));


}



If I create a plane and place a Ninja.mesh I can see shadows, the problem is when i export a scene.

NOTE: The light is placed in a location where it should create shadows.


THANKS!

PS: Sorry for asking so manyquestions, but believe me, when i post a Thread asking for help is when I have spent hours and hours looking for the solution.

Lioric

01-04-2008 16:02:01

You need to either export your meshes with edge list built (in "Object" panel) or use your scene manager, set shadows settings enabled and pass it to the scene loader, before loading the scene

Why dont you export the scene with shadows enabled? (that will automatically generate and setup what is needed for the shadows)

javierpc

02-04-2008 02:20:47

I got it =)

I forgot The Scene Window settings ( from oFusion).

Anyway my FPS have dramatically go down from 80 to 6 hehe

I suppose I can select everything to draw shadows, but the "object setting windows" give me an error about lv.gridlines = true, or something like that and i can't open it.

I'll try reinstalling.

Thanks lioric.

Lioric

02-04-2008 02:28:28

Are the shadows displayed in the preview viewport when they are enabled?

Do a test exporting your scene with shadows enabled (in "Scene" panel), and load this scene in your application (dont manually set the shadows in your application)

javierpc

02-04-2008 02:37:28

Thanks for answering so fast ;)

oops lioric, I have edited the previous post, I'm sorry hehe.

Well the problem was that I was trying with Texture Additive and Modulative 10 minutes ago, and it seems it doenst work for me, If I use the stencil ones it works.

[added]

In the preview viewport i can't see the shadows when they are Texture, when it's setted to Stencil I can see them in the vp.

Another question I hope the last one in some time and I think u too. hehe
I've looked for the answer in the forum but i didnt find it. I have a scene with vray materials, can oFusion export this materials?, I don't think so. I have found a VrayMTlConverter and in the preview I see the materials ok, but not into ogre, some textures are correct, but others not.

Lioric

02-04-2008 16:38:00

We are here to help you to improve your workflow and productivity, do the number of questions you need

You can upgrade your materials to oFusion Materials automatically, see this tutorial for detiled information on this process (the tutorial scene is using VRay materials):

http://www.ofusiontechnologies.com/support/1299/support_1299_00.html

javierpc

04-04-2008 05:18:38

Lioric thanks once more,

I dindt know about that option, anyway it doesn't update the materials correctly, it doesnt use the Bitmaps submaps, only the diffuse colors.

I think i'll have to edit all of them manually. Anyway, thanks for the tip :P