Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 14 Mar 2008
Offline Last Active Today, 08:36 AM

#5104758 How to create custom bitmap font?

Posted by eppo on 27 October 2013 - 07:32 AM

This one (http://www.nubik.com/SpriteFont/), which is oddly enough also named SpriteFont, has more features than BmFont.

#5102835 3ds max smoothing problem on the same polygons

Posted by eppo on 20 October 2013 - 07:23 AM

There should be a "normal angle" setting that lets you set the angle above which neighboring normals are unwelded.

Also make sure there are no invisible holes caused by duplicate vertices that share the same position, or degenerate faces on such vertices.

#5098993 extrusion and dir

Posted by eppo on 05 October 2013 - 12:28 PM

Yes, correct. If you want more control over the roll of the orientation you can pre-multiply it with a rotation around the z-axis.
If you were to do the same in a 3D modeling app, you would likely first extrude the shape and then orient it, though it's possible to first rotate the 2D shape and then extrude it along the matrix' z-vector component.

#5098937 extrusion and dir

Posted by eppo on 05 October 2013 - 08:03 AM

My understanding is that the z-axis transformed by the matrix becomes the extrusion vector.


If you want a matrix that is the result of a series of rotations around the z (roll), x (pitch) and y (yaw)-axes: http://www.flipcode.com/documents/matrfaq.html

This page also shows how to set up a matrix that rotates the extrusion from its original z-orientation towards a second vector on the plane formed by the two vectors.

#5098909 extrusion and dir

Posted by eppo on 05 October 2013 - 04:43 AM

Not sure what you are trying to accomplish, but it seems to me you are extruding a shape along the z-axis and want to then orient it in the direction of some secondary vector? Does the image show a top-down view of what you are trying to do? If you want to rotate around the Y-axis on the XZ-plane, you can use the following matrix (with v being the normalized "extrusion direction"):


[v.z, 0, -v.x]

[0, 1, 0]

[v.x, 0, v.z]

#5098904 Depth stencil state issue

Posted by eppo on 05 October 2013 - 04:14 AM

- dsDesc.DepthFunc needs to be D3D11_COMPARISON_LESS.

- make sure you have set the correct culling mode in the rasterizer state (seems alright).

- make sure you bind the depth-stencil surface with OMSetRenderTargets().

dsDesc.StencilEnable can be set to false, unless you have some reason to use stencil-ops.

- enable the debug-layer.

#5098700 How C# computes Recursion

Posted by eppo on 04 October 2013 - 02:41 AM

This is what your code does:



= 4 * Fac(3)

= 4 * (3 * Fac(2))

= 4 * (3 * (2 * Fac(1)))

= 4 * (3 * (2 * (1)))).


It helps if you look at it from the bottom up:

- the lowest argument for x is 1 which is simply returned as 1.

- the caller function (x = 2) takes that result, multiplies it with itself (2 * (1)) and returns it

- the caller of that function (x = 3) takes that result, multiplies it with itself (3 * (2)) and returns it

- the caller of that function (x = 4) takes that result, multiplies it with itself (4 * (6)) and returns it

#5096440 What program to use to add alpha

Posted by eppo on 24 September 2013 - 11:38 AM

Most Image editors let you interpret an image's alpha-channel as a (paintable) greyscale image. I know Gimp, Photoshop and Photo-Paint allow you to do this.


Another method is to create a separate greyscale image that serves as an alpha-channel. You can use the DirectX Texture Tool to load the image into the alpha-channel of an RGBA image to combine the two.

#5095950 php session manager help

Posted by eppo on 22 September 2013 - 09:30 AM

if (!session_id())

If you've implemented your own handler-interface (the Session class) you shouldn't call session_start() outside of it (as you do in process_login.php), because this would circumvent your database handler and use the default serializer instead. It also would populate session_id which would cause the "if (!session_id())"-test to fail.


Make sure this is done for every request (a session start also implies a session-restart):

$session = new session();
$session->start_session('_s', $_SERVER["HTTPS"] != "on");

#5095919 php session manager help

Posted by eppo on 22 September 2013 - 06:05 AM

I'm not sure session_regenerate_id() properly uses whatever you have registered with session_set_save_handler. You may have to manually update the database entries that refer to the old id (at the end of start_session()).


What happens if you remove the session_regenerate_id() line altogether?

#5093281 Instancing : Different textures for instances

Posted by eppo on 11 September 2013 - 08:54 AM

- Pass uv-offsets for different cubes as instance-data and add them to the base-uvs in the shader.

- If all cells in the texture are of equal size you can load them into a texture array and pass an array-index as instance data.


The second method has the advantage that all the cutting can be done either offline or during load time and it avoids filtering artifacts around cell borders.

#5075732 Moving head bone with mouse, need to create a view matrix

Posted by eppo on 06 July 2013 - 10:25 AM

You can use the inverse of the m_pHeadBone matrix as a view matrix. This matrix lets you transform a scene into the local space of the head(-camera), as you effectively always do when multiplying by a view matrix.

#5060240 Matrix palettes in vertex shader

Posted by eppo on 08 May 2013 - 03:22 AM

As far as I'm aware, on D3D9 hardware, vs_3_0 texture fetches are your only option.


3.0 vertex texture look-ups aren't the fastest, so you'll have to try and see if performance becomes an issue.



#5059681 laser/electric effect

Posted by eppo on 06 May 2013 - 03:11 AM

Also called 'cylindrical billboards'.


They work similar to standard billboards, in that you want one specific vector of the billboard's orientation (say its y-axis) to always point in the direction of the camera. The difference is you also want the laser to keep pointing in the direction of its tangent line (say the z-axis). Because of this you only have the freedom to reorient the billboard around its z-axis. So towards whatever direction you re-orient the y-axis, it needs the be orthogonal in respect to the z-axis. You can do this by orthonormalizing the camera-vertex vector in respect to the tangent vector.


So the three vectors that form a billboard matrix' orthogonal base are:


y: normalize(cameraVertex - tangent * dot(tangent, cameraVertex))

z: tangent
x: cross(y, z)

#5056580 InputLayouts

Posted by eppo on 25 April 2013 - 01:26 AM

I can't compile shaders online(because of hardware limitations), so i cannot generate dummy shader for each inputlayout... 


Most practical method is to validate the input layout against an actual shader that uses the input layout.


When binding an input layout together with a vertex shader, the layout needs to have (validated) element for all the VS' input elements (matching in position and order). It can have additional element used by other shaders, but it can never omit elements required by the shader.


For example, if you have an input layout that's validated against a shader that uses the input elements [POSITION, NORMAL, UV], the layout can be used to feed the following shader input structs: [POSITION, NORMAL, UV] [POSITION, NORMAL] [POSITION] [-]. (You'd validate such an input layout against the shader that has the largest span of input elements.)