Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


M_Johnson

Member Since 05 Nov 2007
Offline Last Active Mar 18 2013 11:25 AM

Topics I've Started

Optimal Navigation of a Navmesh

12 March 2013 - 04:05 PM

So an agent needs to navigate a navigation mesh, he wants to get from Source to Dest

 

Attached File  Navmesh1.jpg   36.58KB   28 downloads

 

A pathfinding algorithm is run which finds a list of navigation polygons the agent must visit

 

Attached File  Navmesh2.jpg   41.18KB   35 downloads

 

In this case A, B, C, D, G, and then finally H. In the above example the agent naively navigates to the center of the "entry" edge of each polygon, i.e. when the agent wants to navigate from A to B the entrance edge would the two vertices the polygons share summed and then divided by two to give the entry point A->B which the agent will seek to. What I want to do is smooth it so it looks like this:

 

Attached File  Navmesh3.jpg   40.27KB   33 downloads

 

So that it picks the best point at which to seek each entry point on the path. Now I know that probably isn't the best example because the mesh could be simplified, but it illustrates the point; I need a better way to choose how to navigate between polygon nodes. The "picking the middle" option also wouldn't work very well if two polygons share a large edge. I was wondering what elegant ways there were to achieve this?

 

Any help would be appreciated.

 

Cheers.


"XNA Framework HiDef profile requires TextureFilter to be Point when using texture...

07 June 2011 - 01:45 PM

I'm having issues with this message in XNA 4. If I set the TextureFilter to point it fixes it for a few calls to the same object (I'm doing multi-pass lighting), but the EffectPass::Apply() function seems eventually to modify the sampler states so that sampler state 0 becomes null. I can get around that by setting the sampler state after the call to EffectPass:.Apply() however I then receieve the error on ModelMesh::Draw() (a different object that's represented by a loaded model instead of drawing the mesh manually) since the same thing seems to be happening but obviously hidden in the Draw call.

    	public void DrawGeometry(Effect effectToUse)
    	{
        	GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
        	GraphicsDevice.BlendState = BlendState.Opaque;
        	GraphicsDevice.DepthStencilState = DepthStencilState.Default;
        	GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;

        	GraphicsDevice.SetVertexBuffer(vertexBuffer);
        	GraphicsDevice.Indices = indexBuffer;
   		
        	foreach (EffectPass pass in effectToUse.CurrentTechnique.Passes)
        	{
            	pass.Apply();
	
            	GraphicsDevice.DrawIndexedPrimitives(Microsoft.Xna.Framework.Graphics.PrimitiveType.TriangleList, 
                	0,
                	0,
                	numVertices, 0, (numVerticesWidth - 1) * (numVerticesHigh - 1) * 2);
        	}
    	}

So in one frame I call this function multiple times, once for each light in my scene, like I say, the first few calls work ok but eventually after pass.Apply() and before GraphicsDevice.DrawIndexedPrimitives the sampler states all get messed up. I thought it would be something in my shader but the fact that the first few calls work makes me doubt that's the cause. Is this a bug in XNA 4 or am I missing something?

Inverse Kinematics Solver

07 April 2011 - 07:37 AM

For what I'm doing it's going to be necessary to control one/both arms of a rigged model (within limits to prevent them bending through the characters head or something) does anyone have any information about how an Inverse Kinematic Solver can be implemented for a game? Basically I'm looking for something similar to what's used in Unreal Engine, so I'm looking for performance over quality, as long as what it comes up with doesn't look ultra-weird.

Multiple Shadow Casters

22 March 2011 - 10:48 AM

Hi.

I have an issue, in something I'm making I have multiple point lights, each one casting shadows on some boxes/the floor, the problem is that it looks very strange and weird when they're close to each other in the scene (see attached image).

Attached File  ShadowsProblem.jpg   92.56KB   51 downloads

I know what the issue is, it's that the pixels that are in the shadow of one of the lights (each light is located above each character in the scene) aren't receiving as much light as those in visible by both lights so appear much darker in comparison. I'm just wondering if anyone knows of a good way of handling this?

Multiple Shaders

10 March 2011 - 05:01 AM

Hello

So I have 3 shaders in seperate files:

Shader 1: Responsible for skinning, transforms vertices based current bone transforms.
Shader 2: Performs normal mapping based on a single light source
Shader 3: Handles shadows that are being cast on the character.

What would be the best way of combining these 3 shaders so I can have a skinned model with normal mapping and able to interact with shadows? One option I thought of was to make it so the shaders contained nothing but the actual functions themselves (removal of global variables) then create an uber technique which #includes the vertex/pixel shaders from these 3 files and implements each one as a pass, then stick all the required globals in the uber technique and blend between the outputs to the render target, I'm not even sure that this would produce the desired results though or if I'd get lots of weird lighting/shadowing artifacts due to the skinning stage.

I'm trying to avoid implementing the whole lot in one vertex/pixel shader. Any help would be appreciated.

PARTNERS