Hey,I'm having some issues with custom geometry. It casts shadows to world around, but it itself is completely invisisble.We create a mesh in code, using a vertex buffer, index buffer and vertex positionnormaltexture for our vertex type. CustomMesh FinalBall = new CustomMesh(VertexBuffer, IndexBuffer, VerticesCount, IndiceCount / 3, new VertexDeclaration(g_Camera3D.GET.Graphics.GraphicsDevice, VertexPositionNormalTexture.VertexElements) , VertexPositionNormalTexture.SizeInBytes, renderEffect);This renders fine without sunburn.http://i.imgur.com/mozgJ.jpgThen we attempt to buid a SceneObject from the data we generate.BasicEffect TempEffect = new BasicEffect(g_Camera3D.GET.Graphics.GraphicsDevice, null); SceneObject Temp = new SceneObject("TestingName", TempEffect , Bounding, this.world, this.IndiciesBuffer, VerticesBuffer, this.dec, 0, PrimitiveType.TriangleList, FaceCount, 0, VertCount, 0, this.strideSize);This gets us this:http://i.imgur.com/kW6GI.jpgIs there anything we are missing or doing wrong, that would cause custom geometry to turn invisible?Thankyou for your help. (We are using 1.3.1 and deferred lighting)-- Daniel & Jarryd
Hi 2.0,
Are you setting the Visibility property after creating the SceneObject (make sure it's set to both render and cast shadows)?
Also make sure the bounding sphere passed into SceneObject is in object-space.
Follow me on Twitter – development and personal tweetsAwesome XNA Videos – Lighting, Rendering, and game videos
Yep the Visibility property is set to cast shadows and render.The bounding sphere was created with a Center or Vector3.Zero (This should make it always placed in the objects center?) and we tried sizes of 30 (our models size) , 3, 300, 1000, 10000 all which did not work...
The object is at the worlds 0,0,0 too so we figured it could be the bounding sphere out of place.Any other ideas?
Thanks heaps for your helpDaniel
if you have set the alpha to <=0.15 the object will not appear at all. !!! values of 0.16 or greater will fix this.
Sorry I didn't catch this sooner:
2.0 Studios:BasicEffect TempEffect = new BasicEffect(g_Camera3D.GET.Graphics.GraphicsDevice, null);
2.0 Studios:(We are using 1.3.1 and deferred lighting)
BasicEffect is a type of forward rendered effect and cannot be rendered with the deferred render manager (though you can render outside of the render manager using forward effects - SunBurn supports mixing rendering modes).
Try using SunBurn's built-in DeferredObjectEffect instead - it provides all the features available in the SunBurn material system and is a deferred effect for use with the deferred render manager. I believe this requires tangent-space information, but SunBurn's VertexPositionNormalTextureBump class has static methods that automatically generate this for you using the VertexPositionNormalTexture information you've already provided.
Let me know if this helps!
Yer the alpha we are using is 1.0f so i don't think that is the problem
Thanks for the help John i will try this tomorrow and see if i can get it to work that way.Thanks again.
Hey,It is almost working!http://i.imgur.com/CtaCP.pngBut the object is inside out. Outside of XNA I would simply drop this in:
g_Camera3D.GET.Graphics.GraphicsDevice.RenderState.CullMode = CullMode.CullClockwiseFace;And that would fix it. But I don't think I can do that inside sunburn.So I found this:BallSceneObjectTest.RenderableMeshes[0].CullMode = CullMode.CullCounterClockwiseFace;But that is read only, so I cannot chage it.So I tried to make it double sided. DeferredObjectEffect temp = (DeferredObjectEffect)SceneTest.RenderableMeshes[0].Effect; temp.DoubleSided = true;That kinda works. The object I don't think is inside out anymore.http://i.imgur.com/ktAH6.pngBut the lighting is backwards and the shadows are funny looking.I am fairly certain that it is the winding order, but I am unsure of how to get at it.--Jarryd
Reverse the winding order in the content pipeline settings.
Dave: Reverse the winding order in the content pipeline settings.
The object windings are determined in your code that generates the index buffer data, you'll need to swap the index order of two of the verts for each triangle (assuming a triangle list).
As an example, if your code looks something like this:
indices[i++] = verta_index;indices[i++] = vertb_index;indices[i++] = vertc_index;
You should swap it to:
indices[i++] = verta_index; indices[i++] = vertc_index; indices[i++] = vertb_index;
SunBurn follows the default counter-clockwise winding order set by XNA / DirectX.
Thankyou BobTheBuilder. That was exactly what I needed to do. Now I can move onto making these funny shaped objects part of the gameplay!Your are quite tenacious in helping people solve their problems, and it is much appreciated. It is one of the main reasons sunburn is great.-- Jarryd