Horde3D
http://horde3d.org/forums/

point light node scaling does not work properly
http://horde3d.org/forums/viewtopic.php?f=3&t=1888
Page 1 of 1

Author:  swx [ 08.06.2013, 18:59 ]
Post subject:  point light node scaling does not work properly

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 );   
}

Author:  swx [ 20.06.2013, 13:07 ]
Post subject:  Re: point light node scaling does not work properly

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.

Author:  attila [ 24.06.2013, 06:18 ]
Post subject:  Re: point light node scaling does not work properly

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?).

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/