Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 14 Mar 2008
Offline Last Active Today, 06:16 AM

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

#5056437 Translation within geometry shader

Posted by eppo on 24 April 2013 - 01:54 PM

Shadow volume are extruded in the direction of the light vector in world space. Since this happens in the geometry shader, you'll have to do the view/projection transformation afterwards in the GS as well. The extruded volumes are transformed the same way as any other object in the scene.


Note that clipping and depth division takes place after the GS stage. The w-component has no meaning when passing data from the VS to GS. SV_Position is a required output of the geometry shader, not the vertex shader (when a GS is active).

#5056341 Translation within geometry shader

Posted by eppo on 24 April 2013 - 06:45 AM

You have to offset back-facing faces before transforming them into view space, so you'll need to do the both the view and projection multiplications in the GS.


Make sure the vertex shader only transforms vertices into world space: out.pos = mul(in.pos, matrixW).xyz;


Your geometry shader will have to do something similar to: out.pos = mul(float4(in.pos.xyz + lightExtrudeVector,1.0), matrixVP);

#5056285 Marching Cubes + Cubes....

Posted by eppo on 24 April 2013 - 12:41 AM

There's a technique called 'Dual Contouring' that extends upon the Marching Cubes algorithm. Aside from weight data on grid corners it also takes tangent vectors on the grid field into account, to allow for better reconstruction of edges.


The Procedural World blog has a post that explains it well.

#5056126 Screen Capture with DXGI

Posted by eppo on 23 April 2013 - 12:21 PM

Are you trying to capture the entire desktop, or only a single desktop window?


GetDisplaySurfaceData() only works in full screen mode. In windowed mode DXGI can blit to a shared surface managed by the desktop windows manager, but has no access to the entire screen buffer. DXGI 1.2 under Windows 8 adds access to the desktop via a Duplication API.


To create a screen dump: Link

To read the contents of a DXGI surface into sys mem, CopyResource() the backbuffer to a surface created with CPU_READ access. Then Map() the surface to read back the texture data.

#5056117 Change clockwise of a trianglelist

Posted by eppo on 23 April 2013 - 11:22 AM

You flip the ordering of the indices in the list: (0, 1, 2) -> (2, 1, 0).