Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


Yours3!f

Member Since 04 Feb 2011
Offline Last Active Today, 01:53 AM

Topics I've Started

DX11 changing window coordinate origin (upper-left -> lower-left)

23 August 2015 - 06:52 AM

hi there,

 

I want to change the window coordinate origin to use OpenGL conventions (ie. lower-left is (0,0)). 
In GLSL the default is lower-left, however you can change to upper-left using layout(origin_upper_left). Is there such a thing in HLSL that changes to lower-left?

 

best regards,

Yours3!f


DX11 fullscreen quad rendering not working

22 August 2015 - 09:09 AM

hi there,

 

I'm trying to render a fullscreen quad using dx11, however it doesn't show up.

I tried debugging w/ nsight, and it seems that the quad is in place, but for some reason it doesn't write to the back buffer...

Output: blue screen

Expected: white screen

 

here's the code:

http://pastebin.com/3MaLxTjW

 

Questions:

1) any idea what am I doing wrong?

2) in case I can already draw the quad, how do I disable depth writing? (in opengl I know it's glDepthMask w/ false)

 

best regards,

Yours3!f


Cascaded shadow mapping, shadow frustum generation

06 August 2015 - 11:54 AM

hi there,

 

my question is:

how do you generate the orthographic projection matrices for generating the cascaded shadow maps?

Right now what I tried to do, but it doesn't seem to fully work is the following:

1) Determine view space AABB of the scene, use the bounds for tight near/far planes

2) use logarithmic splitting scheme to create 4 intervals for 4 cascades

3) a) for each interval, create perspective sub-frustums using the same fov, aspect ratio as the main camera, but the interval           bounds for the near/far planes

    b) transform the world space sub-frustum corners to light camera space, and construct a light camera space AABB there. 

    c) use the bounds of the light camera space AABB to create the orthographic matrix of the cascade

 

See attached picture for how the cascades look for me right now. As you can see lots of the geometry is cut off, as if the orthographic frustum is not correct.

 

best regards,

Marton Tamas


want to create an fps

10 November 2014 - 01:07 PM

hi there,

 

I'd like to put together a simple FPS for experimentation. I've already created a renderer so I can load models with textures, animations. I already have a free-fly style camera. The important thing is that I want to do this without a game engine like Unity or UE4. I'd like to learn it inside out...

 

The features I'd like it to have are: 

1) enemies with animations

2) simple AI for enemies (basically find the player and cause damage)

3) some simple static single-floor level representation: the goal here is to make sure that the AI can react to obstacles and the player can't move around freely (think noclip disabled :) )
4) some simple weapon animation

5) ability to shoot the enemies who can die

6) get points for killing enemies, game is over when the player dies

7) simple high-score system so there's some 'goal'

 

I already have some ideas for these features.

1) I can already do skeletal animation, though I've yet to grab some assets (zombie or soldier would be great...) with animations

2) The enemies could move around using a simple A* algorithm (when they can see the player), else they wander around randomly...

3) I don't really know how to do the level representation. So the goal would be to be able to bump into things, so that requires a physics engine, or how is this usually done? 

4) again skeletal animation, reacting to the player's input

5) I think this would be some simple ray tracing (where a bullet would be a ray, the enemies would be represented by collision spheres, boxes etc.) I think I can already do this

6) 7) these are really simple imo, the GUI would be berkelium-based, so I think I can do that.

 

so I'm not really sure about 2, 3, any pointers on those? (or the rest if I'm wrong...)

 

best regards,

Yours3!f

 


ssao self-occlusion problems

01 November 2014 - 04:28 AM

hi there,

 

I'm trying to implement the "Alchemy" ssao technique from this PDF:
http://frederikaalund.com/wp-content/uploads/2013/05/A-Comparative-Study-of-Screen-Space-Ambient-Occlusion-Methods.pdf

I could implement it, but I'm facing severe self-occlusion issues when using per-pixel normals from the g-buffer (with normal maps).
There's no issue when I'm using the reconstructed normals from the depth buffer.

 

Sponza scene, wall viewed from side, per-pixel normals, self-occlusion problems:
http://minus.com/i/BVfKQov3ZxwA

 

per-face normals (reconstructed), no self-occlusion (but no per-pixel ssao either):

http://minus.com/i/b24QSlupk9JZz

 

same thing w/ per-pixel normals, viewed from front:
http://minus.com/i/3s0ctLXDXD56

 

here's the shader I'm using:

#version 430 core

layout(binding=0) uniform sampler2D depth_tex;
layout(binding=1) uniform sampler2D normal_tex;
layout(binding=2) uniform sampler2D random_tex;

uniform float near, far;
uniform mat4 inv_mv, inv_mvp;
uniform vec4 far_plane0;
uniform vec2 far_plane1;
uniform mat3 inv_view;

in vec2 texcoord;

out vec4 color;

#include "common.h"

//a is used to remedy self-occlusion
//b and c is used to control brightness and contrast
float tweak( float ao, float a, float b, float c )
{
  return pow( b * (ao + a), c );
}

void main()
{
  //reconstruct view space position
  vec2 pos_xy = mix( far_plane0.xy, vec2(far_plane0.w, far_plane1.x), texcoord );
  float depth = texture( depth_tex, texcoord ).x;
  float linear_depth = linearize_depth( depth, near, far );
  vec3 vs_pos = linear_depth_to_vs_pos( linear_depth, pos_xy, far );

  //reconstruct world space position
  vec4 ms_pos = inv_mv * vec4( vs_pos, 1 );

  //reconstructed per-face world space normals
  //vec3 ms_normal = -normalize(cross(dFdy(ms_pos.xyz), dFdx(ms_pos.xyz)));

  //per-pixel world space normals
  vec3 ms_normal = inv_view * ( texture( normal_tex, texcoord ).xyz * 2 - 1 );

  const int samples = 64;
  const float radius = 1; //10
  const float projection_factor = 0.75;
  const float bias = 1.0;
  const float sigma = 2.0;
  const float epsilon = 0.00001;
  const float a = 0.0;
  const float b = 1.0;
  const float c = 5.0;

  float projected_radius = radius * projection_factor / -vs_pos.z;

  vec2 inv_random_texsize = 1.0 / textureSize( random_tex, 0 ).xy;

  float ao = 0;

  for( int i = 0; i < samples; ++i )
  {
    vec2 random_dir = texture( random_tex, vec2( texcoord / inv_random_texsize * (i+1) ) ).xy * 2 - 1;

    vec3 asample;
    asample.xy = texcoord + random_dir * projected_radius;
    asample.z = texture( depth_tex, asample.xy ).x;

    //reconstruct world space position of the sample
    vec3 ndc_sample = asample * 2 - 1;
    vec4 tmp = inv_mvp * vec4( ndc_sample, 1 );
    vec3 ms_sample_pos = tmp.xyz / tmp.w;

    //get the difference vector
    vec3 sample_dir = ms_sample_pos - ms_pos.xyz;

    ao +=
    //get the angle between the normal and the vector
    max( 0, dot( sample_dir, ms_normal ) - bias ) /
    //get the squared distance
    ( dot( sample_dir, sample_dir ) + epsilon );
  }

  ao = tweak( max( 0, 1 - 2 * sigma / float( samples ) * ao ), a, b, c );

  color = vec4( ao );
}

I tried toying with the "a" parameter, but it either killed the ssao result (no visible occlusion, or not enough) or it wasn't enough...

 

I may be facing just a case of bad parameters, but I tried to follow the pdf closely...

 

any ideas on how to overcome this?

 

best regards,

Yours3!f


PARTNERS