Page 30 of 56

Posted: Mon Nov 30, 2009 11:44 pm
by oldskoolPunk
This is exciting news Blindside ! I cant wait to see it.

Posted: Tue Dec 01, 2009 2:52 am
by gingerheadman
I'm Having problems with running the XEffects examples. Every time I try to start one of them it will start loading and then crash.

Here's the output from when I try to run Example 1 (although not the full output which is over 620 lines ling):

Code: Select all

rory@macrohard:~/Programming/XEffects/Bin$ ./Example1
Welcome to the X-Platform Effect Wrapper Demo
Please select the driver type:
1 - OpenGL
2 - Direct3D9
1
Please select the ShadowMap resolution:
1 - 512x512
2 - 1024x1024
3 - 2048x2048
4 - 4096x4096
1
Please select the ShadowMap filtering:
1 - none
2 - 4 PCF
3 - 8 PCF
4 - 12 PCF
5 - 16 PCF
1
Irrlicht Engine version 1.6
Linux 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:05:01 UTC 2009 x86_64
Creating X window...
Visual chosen: : 39
Using renderer: OpenGL 2.1.2
GeForce 7050 PV / nForce 630a/PCI/SSE2: NVIDIA Corporation
OpenGL driver version is 1.2 or better.
GLSL version: 1.2

<580 lines of various loading messages>

Could not open file of texture: XEFFECTS_SM_512
XEffects: Please ignore previous warning, it is harmless.
FBO has one or several incomplete image attachments
FBO error
FBO incomplete
Could not open file of texture: XEFFECTS_SM_512
XEffects: Please ignore previous warning, it is harmless.
Segmentation fault
rory@macrohard:~/Programming/XEffects/Bin$ 

Posted: Tue Dec 01, 2009 5:10 am
by BlindSide
It has trouble creating the render target. Try setting screenRTT to 512x512.

Posted: Tue Dec 01, 2009 10:28 am
by 3D Ace
Just a quick question. Can XEffects render shadows from, say a quad with alpha channel(Transparent) and only cast shadows from the rgb channels? For example a grass texture on a quad,with transparency.

Posted: Tue Dec 01, 2009 10:35 am
by BlindSide
Yes but you must use EMT_TRANSPARENT_ALPHA_CHANNEL_REF. This basically means that it will be an on/off style transparency. If you use filtering it will still look nice and soft though. This is perfectly suited for leaves and grass strands.

This is shown in the first example with the floating XEffects logo cube.

Cheers

Posted: Tue Dec 01, 2009 10:48 am
by 3D Ace
Ok thanks. The FPS will propably be horrible though, since im rendering a huge scene with thousands of grass quads.

Posted: Tue Dec 01, 2009 10:50 am
by BlindSide
I doubt it will be that bad since shadow maps aren't as badly affected by the scene node count as stencil shadows are. Most likely you will notice about half or a third the fps with it enabled, no matter how many grass quads there are.

Make sure to batch the grass quads since it's bad for performance in general to have many draw calls, this would make the shadows render faster too.

Posted: Sun Dec 06, 2009 9:58 am
by ent1ty
How about that 360 degree light? When I set the FOV above 90 degrees it gets screwed up(the shadows don't display).

Posted: Sun Dec 06, 2009 3:27 pm
by porcus
Afaik you have to combine multiple lights to get a light with an angle >90°.
(Like in the point light example)

Posted: Tue Dec 08, 2009 3:48 pm
by ent1ty
Interesting. I always thought that making a spot light is harder than the point one.
Anyways, this is not very good idea. From 70 fps I used to have, now i have only 30.
I guess I'll have to do without point lights.

Posted: Tue Dec 08, 2009 3:57 pm
by BlindSide
Yes there are better ways to do this but they are not implemented currently. It would have been way easier if Irrlicht already supported CubeMaps but what can you do.

Posted: Sat Dec 12, 2009 8:02 am
by Insomniacp
I set the far value for a point light to a large number so it would act more like a sun but it then does not work well on shadows close by for some reason. Is there a way to change this so it works well in both instances, far away and near by with a large far value? A work around I was thinking of doing was making a point light near by the character to make the close by shadows look like they should then just have a spot light at 180 degrees up high to light up the rest of the map and give some shadows to it. Though I prefer having as few lights as possible since they do make an impact on the fps. Let me know if I am doing anything wrong, I copied most code from the point light example. Just changed the far value and made the light stationary for now.

EDIT:
Another thing I was wondering was why it increased my primitive count by 400,000. That may be normal I am just not quite sure why that happens. Without xeffects it is at 40,000 normally.

Posted: Sat Dec 12, 2009 11:28 am
by Viz_Fuerte
Hey BlindSide :D

I just finished a shadow system (like yours), using another system.
Instead of calculating all in render targets, calculating only the shadow and I make one pass, so you can use any material, whether sphere mapping, normal mapping or whatever.

This will increase performance and manages to cut the code.

Example
Your code for Depth pass:

Code: Select all

			for(u32 i = 0;i < ShadowNodeArraySize;++i)
			{
				if(ShadowNodeArray[i].shadowMode == ESM_RECEIVE || ShadowNodeArray[i].shadowMode == ESM_EXCLUDE)
					continue;

				const u32 CurrentMaterialCount = ShadowNodeArray[i].node->getMaterialCount();
				core::array<irr::s32> BufferMaterialList(CurrentMaterialCount);
				BufferMaterialList.set_used(0);

				for(u32 m = 0;m < CurrentMaterialCount;++m)
				{
					BufferMaterialList.push_back(ShadowNodeArray[i].node->getMaterial(m).MaterialType);
					ShadowNodeArray[i].node->getMaterial(m).MaterialType = (E_MATERIAL_TYPE)
						(BufferMaterialList[m] == video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF ? DepthT : Depth);
				}

				ShadowNodeArray[i].node->OnAnimate(device->getTimer()->getTime());
				ShadowNodeArray[i].node->render();

				const u32 BufferMaterialListSize = BufferMaterialList.size();
				for(u32 m = 0;m < BufferMaterialListSize;++m)
					ShadowNodeArray[i].node->getMaterial(m).MaterialType = (E_MATERIAL_TYPE)BufferMaterialList[m];
			}
Possible code for depth pass:

Code: Select all

	for(u32 i=0; i<meshArray.size(); ++i)
	{
		pVideo->setTransform(ETS_WORLD,meshArray[i]->getAbsoluteTransformation());
		pVideo->setMaterial(depthMat);

		for(u32 j=0; j<meshArray[i]->getMaterialCount(); ++j)
			pVideo->drawMeshBuffer(meshArray[i]->getMesh()->getMeshBuffer(j));
	}
This is just to give you an idea.
Download my code and take a look if you want:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=36308

Posted: Sat Dec 12, 2009 10:26 pm
by BlindSide
Insomniacp wrote:I set the far value for a point light to a large number so it would act more like a sun but it then does not work well on shadows close by for some reason. Is there a way to change this so it works well in both instances, far away and near by with a large far value? A work around I was thinking of doing was making a point light near by the character to make the close by shadows look like they should then just have a spot light at 180 degrees up high to light up the rest of the map and give some shadows to it. Though I prefer having as few lights as possible since they do make an impact on the fps. Let me know if I am doing anything wrong, I copied most code from the point light example. Just changed the far value and made the light stationary for now.

EDIT:
Another thing I was wondering was why it increased my primitive count by 400,000. That may be normal I am just not quite sure why that happens. Without xeffects it is at 40,000 normally.
XEffects doesn't support point lights, Example 2 is just showing it can be done to an extent, but I don't recommend actually doing it that way. I'm guessing this is some sort of space game if you can get that close to the sun, otherwise if it is terrain-based you should definitely use a directional light for your shadows. Sun != point, Sun == directional because of it's enormous size in comparison to the earth.

If you really need a point light it will eventually be supported in the Irrlicht shadow system.
Possible code for depth pass:
Ah but that will only work for Mesh/AnimatedMesh scene nodes.
Instead of calculating all in render targets, calculating only the shadow and I make one pass, so you can use any material, whether sphere mapping, normal mapping or whatever.
I'm not sure what you mean by this, when I have time I will look at your code to see the difference.

One reason to calculate all using render targets is to get an additive lighting effect where the shadows are colored by the other lights that are not in shadow.

Cheers

Posted: Sat Dec 12, 2009 11:20 pm
by Viz_Fuerte
Ah but that will only work for Mesh/AnimatedMesh scene nodes.
Is true :oops:
...an additive lighting effect...
Just as this is achieved more quality. To my way get all the shadows are the same color, can be a problem if you want to get realistic shadows. It would be an alternative.
XEffects doesn't support point lights...
I was watching a tutorial as creating points light with shadow maps.
Do not use a cube map or anything like that (there are many render targets), with dual Paraboloid maps, so it should only be used 2 render targets instead of 6 (as in the case of the cube map).

It seems easy to do.

Bye :wink: