Horde3D

Next-Generation Graphics Engine
It is currently 22.11.2024, 01:13

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 08.06.2013, 18:59 
Offline

Joined: 09.06.2012, 14:21
Posts: 12
The lights are culled using a scaled bounding box, but the geometry is rendered using the fixed light radius.
I modified Renderer::drawSphere to use the transform matrix of the light node.

Code:
void Renderer::drawSphere( const Vec3f &pos, float radius, const Matrix4f &transMat)
{
   ASSERT( _curShader != 0x0 );

   const Vec3f scale = transMat.getScale();
   Matrix4f mat = Matrix4f::TransMat( pos.x, pos.y, pos.z ) *
               Matrix4f::ScaleMat(scale.x * radius, scale.y * radius, scale.z * radius);
   gRDI->setShaderConst( _curShader->uni_worldMat, CONST_FLOAT44, &mat.x[0] );
   
   gRDI->setVertexBuffer( 0, _vbSphere, 0, 12 );
   gRDI->setIndexBuffer( _ibSphere, IDXFMT_16 );
   gRDI->setVertexLayout( _vlPosOnly );

   gRDI->drawIndexed( PRIM_TRILIST, 0, 128 * 3, 0, 126 );   
}


Top
 Profile  
Reply with quote  
PostPosted: 20.06.2013, 13:07 
Offline

Joined: 09.06.2012, 14:21
Posts: 12
This ended up just solving one of many issues. Many things use a single radius value (like creating projection matrix for shadowing, light attenuation etc).
Now I manually adjust the light radius (I assume the scaling is uniform) and make sure the node transform I supply to Horde3D does not contain any scaling.


Top
 Profile  
Reply with quote  
PostPosted: 24.06.2013, 06:18 
Offline

Joined: 26.08.2008, 18:48
Posts: 120
swx wrote:
This ended up just solving one of many issues. Many things use a single radius value (like creating projection matrix for shadowing, light attenuation etc).
Now I manually adjust the light radius (I assume the scaling is uniform) and make sure the node transform I supply to Horde3D does not contain any scaling.


If it is not worth the effort to support non-uniformly scaled matrix for lights, this should be documented somewhere (Known limitations section?).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group