Page 44 of 56

Posted: Fri Jan 28, 2011 12:31 am
by 3DModelerMan
Will the raytracing work with meshes (not just spheres)? And also, does it do shadows?

I got a trouble.

Posted: Fri Jan 28, 2011 11:28 am
by bayofxyz
Is there anyone got trouble like me?
- all of texture that I draw as button are invert(they are "unknow" button).
- Text font changed(noticed at green), I can't read them :p
Image

Re: I got a trouble.

Posted: Sat Feb 12, 2011 2:31 pm
by tinhtoitrangtay
bayofxyz wrote:Is there anyone got trouble like me?
- all of texture that I draw as button are invert(they are "unknow" button).
- Text font changed(noticed at green), I can't read them :p
Image
Great! You can upload your source code? I and somebody need your source code fix bug. Thank you.

Posted: Sat Feb 12, 2011 8:16 pm
by ACE247
Can someone explain what this has to do with XEffects?

Posted: Sat Feb 12, 2011 8:51 pm
by Tihtinen
Actually that happens in XEffects in OpenGL. I had similar problems (though it has almost been a year since then and I don't know if it has been fixed). Read it and the solution here: http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=38356

Posted: Sat Feb 12, 2011 11:22 pm
by bayofxyz
Wow, Thank you for solution :D

Posted: Sat Feb 19, 2011 10:41 am
by tinhtoitrangtay
bayofxyz wrote:Wow, Thank you for solution :D
Hi bayofxyz! You can upload your project using Xeffects. Thank you.

Posted: Sat Feb 19, 2011 9:58 pm
by DarkMarkZX
I managed to get around the problem with no shadows being cast by nodes with EMT_TRANSPARENT_ALPHA_CHANNEL_REF material type in Direct3D9. To keep it short, i found the following piece of code in EffectHandler.cpp:

Code: Select all

		DepthT = gpu->addHighLevelShaderMaterial(
			sPP.ppShader(SHADOW_PASS_1V[shaderExt]).c_str(), "vertexMain", video::EVST_VS_2_0,
			sPP.ppShader(SHADOW_PASS_1PT[shaderExt]).c_str(), "pixelMain", video::EPST_PS_2_0,
			depthMC, video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
and changed it to this:

Code: Select all

		DepthT = gpu->addHighLevelShaderMaterial(
			sPP.ppShader(SHADOW_PASS_1V[shaderExt]).c_str(), "vertexMain", video::EVST_VS_2_0,
			sPP.ppShader(SHADOW_PASS_1P[shaderExt]).c_str(), "pixelMain", video::EPST_PS_2_0,
			depthMC, video::EMT_SOLID);
It's not perfect though, but satisfactory.

I still haven't found a solution for the other problem - does anyone know how to make anti-aliasing work in D3D9?

Posted: Sun Feb 20, 2011 3:50 am
by BlindSide
But DarkMarkZX, that won't support on/off transparency, it will just draw the whole scene node regardless of the alpha on the texture. I think you need to check your materialTypeParam (In the SMaterial struct) as it controls the threshold with which an object is drawn or not based on the alpha value, perhaps this value is too low/high and is causing issues with the current alpha values you are using?

Cheers

Posted: Sun Feb 20, 2011 2:20 pm
by DarkMarkZX
Thanks for the quick reply!
For testing purpose. I restored the original EffectHandler.cpp and created a simple box mesh with a partly transparent texture only to find out that the shadow it casts is completely wrong:
Image

Here's the code fragment:

Code: Select all

	node = smgr->addAnimatedMeshSceneNode(smgr->getMesh("Data/cube.X"));
	node->setMaterialTexture(0, driver->getTexture("Data/test.png"));
	node->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
	node->setScale(core::vector3df(0.5f, 0.5f, 0.5f));
	node->getMaterial(0).NormalizeNormals = true;
	node->setPosition(core::vector3df(50,50,100));
	effect->addShadowToNode(node, EFT_NONE, ESM_BOTH);
And here's the textured model:
http://www.sendspace.com/file/uwod17

I tried setting materialTypeParam to different values, but doesn't seem to change anything. What am I doing wrong?

Posted: Wed Mar 16, 2011 10:33 pm
by BlindSide
Hi DarkMark, you have to use TRANSPARENT_ALPHA_CHANNEL_REF, transparency is not supported with TRANSPARENT_ALPHA_CHANNEL.

Cheers

Shadow problem

Posted: Wed Mar 23, 2011 8:51 pm
by AW111
Does XEffects ever use per-triangle shadowing (rather than the more realistic pixel-esque patterns)? It didn't used to do that in my program and I didn't think it was ever supposed to, but for some reason my program now only has shadowing on a triangle-by-triangle basis. At first I thought I had mistakenly enabled the default Irrlicht shadowing, but explicitly disabling it didn't clear up the problem. I would add that it clearly seems to be XEffects doing it, since changing the shadow resolution for XEffects changes the way the shadows are drawn - but they are always drawn per-triangle regardless.

Posted: Wed Mar 23, 2011 8:56 pm
by stefbuet
Lighting is per vertex.
Shadowing is per pixel, it can't be per vertex with shadow maps, it's a post process effect! (not including depth buffer)

Posted: Wed Mar 23, 2011 10:36 pm
by AW111
I've found my problem, although I'm not sure how to solve it - I was using enormous distances for the "nearplane" and "farplane" values for the light representing the sun, since I'm using a large landscape rather than a small room (as in the XEffects demos). Reducing the scale greatly improves the shadowing, but the sun is far too close to the landscape now. Any suggestions? I suppose I'd need a variable-scale (LOD) shadowing system...

Posted: Wed Mar 23, 2011 10:43 pm
by stefbuet
There are multiple solutions for this problem, using for exemple more than 1 shadow map per light : Cascaded Shadow Mapping, Perspective Shadow Mapping... I have never implemented those thought, you can study all that mostly in GPU gems books. XEffect dosn't provide such solution for now.