Jump to content

  • Log In with Google      Sign In   
  • Create Account


Alundra

Member Since 19 Jul 2011
Offline Last Active Today, 07:36 AM
-----

Topics I've Started

State Machine

07 July 2014 - 04:13 PM

Hi all,

I'm new in AI, it's a whole subject, not easy, all must be done in a good way and need to be efficient.

I saw some books and a lot speak about state machine and some speak about hierarchical state machine.

State machine is a must-have to have a good AI system (action,state,condition,state-machine) ?

Is it good to have a generic state machine ?

Thanks for the help.


Frustum sphere

04 July 2014 - 08:27 AM

Hi all,

Here my code to compute a bounding sphere from camera + near + far :

void ExtractFrustumSphere( CCameraActor* Camera, const float Near, const float Far, CVector3* Center, float* Radius )
{
  // Get the camera component.
  CCameraComponent* CameraComponent = static_cast< CCameraComponent* >( Camera->GetComponent( 0 ) );
 
  // Camera params.
  const CVector3 CameraPos = Camera->GetWorldTranslationVector();
  const CVector3 CameraRight = Camera->GetRightVector();
  const CVector3 CameraForward = Camera->GetForwardVector();
  const CVector3 CameraUp = Camera->GetUpVector();
 
  // Tangent values.
  const float TanFOVX = CMath::Tan( CameraComponent->GetAspectRatio() * CameraComponent->GetFieldOfView() * 0.5f );
  const float TanFOVY = CMath::Tan( CameraComponent->GetAspectRatio() );
  
  // Compute the half distance.
  const float HalfDistance = 0.5f * ( Far - Near );
  
  // Compute the center.
  *Center = CameraPos + CameraForward * ( Near + HalfDistance );
  
  // Compute the radius.
  *Radius = ( ( CameraRight * TanFOVX + CameraUp * TanFOVY + CameraForward ) * HalfDistance ).Length();
}

I'm not sure if I use the correct way to compute the radius.

I think this is wrong because for a near of 0.1f and a far of 100.0f with a FOV of QUATER_PI, I have 246 of radius.

What is wrong in the calcule of the radius ?

Thanks for the help.

 

EDIT :

I saw I used a bad value for TanFOVY, I have changed to use :

const float TanFOVX = CMath::Tan( CameraComponent->GetAspectRatio() * CameraComponent->GetFieldOfView() * 0.5f );
const float TanFOVY = CMath::Tan( CameraComponent->GetFieldOfView() * 0.5f );

I Have a radius of 68 for the same values I said before, Is it the correct answer ?


Cascaded Shadow Map Geometry Shader Frustum Culling

03 July 2014 - 06:46 AM

Hi all,

Using a geometry shader you can render using one draw call all partitions but you send triangle 4 times if you have 4 partitions.

Is it ok to stay with that or a frustum culling is needed to set the good index ?

What is the more efficient way ?

Thanks for the help


Asset file format

29 June 2014 - 05:38 PM

Hi all,

I have differents file format : mesh, texture, animation, and surely soon material.

Actually I have differents extension but I would have only one file format ".asset".

My idea is to have a class Asset who has load/save and memory file data.

At the end the asset is just two uint32 who is the type of the asset and the file data size then the file data.

Each class (mesh, texture, animation, material) has function to write to memory and read from memory.

Is it a bad way to handle that and should be done in another way ?

Thanks for the help


Drag and drop in scene editor

25 June 2014 - 08:45 PM

Hi all,

What is the best behavior in a game editor when the user drag and drop from content browser ?

Two choices possible : Raycast using the physic engine or Raycast using ray-triangle algo.

Thanks


PARTNERS